Updated to 1.19.3, made dependency on Gamestages less strict

This commit is contained in:
Tschipp 2022-12-17 15:38:59 +01:00
parent 78402e9cc7
commit 3f61e6c5a9
16 changed files with 108 additions and 75 deletions

View File

@ -9,8 +9,7 @@ import net.minecraft.commands.arguments.blocks.BlockStateParser;
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
import net.minecraft.commands.arguments.item.ItemParser;
import net.minecraft.commands.arguments.item.ItemParser.ItemResult;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState;
@ -61,8 +60,8 @@ public class ModelOverride
BlockResult res;
try {
res = BlockStateParser.parseForBlock(Registry.BLOCK, from, true);
} catch (CommandSyntaxException e) {
res = BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), from, true);
} catch (Exception e) {
return DataResult.error("Error while parsing " + from + ":" + e.getMessage());
}
@ -79,9 +78,9 @@ public class ModelOverride
Either<ItemResult, BlockResult> either;
try {
if(type == Type.ITEM)
either = Either.left(ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(to)));
either = Either.left(ItemParser.parseForItem(BuiltInRegistries.ITEM.asLookup(), new StringReader(to)));
else
either = Either.right(BlockStateParser.parseForBlock(Registry.BLOCK, to, true));
either = Either.right(BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), to, true));
}catch (CommandSyntaxException e) {
return DataResult.error("Error while parsing " + to + ":" + e.getMessage());
}

View File

@ -3,7 +3,7 @@ package tschipp.carryon.client.render;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
@ -62,10 +62,10 @@ public class CarriedObjectRender
CarryOnData carry = CarryOnDataManager.getCarryData(player);
if (Constants.CLIENT_CONFIG.facePlayer != CarryRenderHelper.isChest(state.getBlock())) {
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
matrix.mulPose(Vector3f.XN.rotationDegrees(8));
matrix.mulPose(Axis.YP.rotationDegrees(180));
matrix.mulPose(Axis.XN.rotationDegrees(8));
} else {
matrix.mulPose(Vector3f.XP.rotationDegrees(8));
matrix.mulPose(Axis.XP.rotationDegrees(8));
}
if(carry.getActiveScript().isPresent())
@ -101,7 +101,7 @@ public class CarriedObjectRender
matrix.pushPose();
matrix.scale(0.8f, 0.8f, 0.8f);
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
matrix.mulPose(Axis.YP.rotationDegrees(180));
matrix.translate(0.0, -height - .1, width + 0.1);
manager.setRenderShadow(false);

View File

@ -1,15 +1,14 @@
package tschipp.carryon.client.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
@ -23,6 +22,7 @@ import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.joml.Quaternionf;
import tschipp.carryon.Constants;
import tschipp.carryon.client.modeloverride.ModelOverride;
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
@ -52,15 +52,15 @@ public class CarryRenderHelper
return -(entity.yBodyRotO + (entity.yBodyRot - entity.yBodyRotO) * partialticks);
}
public static Quaternion getExactBodyRotation(LivingEntity entity, float partialticks)
public static Quaternionf getExactBodyRotation(LivingEntity entity, float partialticks)
{
return Vector3f.YP.rotationDegrees(getExactBodyRotationDegrees(entity, partialticks));
return Axis.YP.rotationDegrees(getExactBodyRotationDegrees(entity, partialticks));
}
public static void applyGeneralTransformations(Player player, float partialticks, PoseStack matrix)
{
int perspective = CarryRenderHelper.getPerspective();
Quaternion playerrot = CarryRenderHelper.getExactBodyRotation(player, partialticks);
Quaternionf playerrot = CarryRenderHelper.getExactBodyRotation(player, partialticks);
Vec3 playerpos = CarryRenderHelper.getExactPos(player, partialticks);
Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition();
Vec3 offset = playerpos.subtract(cameraPos);
@ -70,7 +70,7 @@ public class CarryRenderHelper
matrix.translate(offset.x, offset.y, offset.z);
if (perspective == 2)
playerrot.mul(Vector3f.YP.rotationDegrees(180));
playerrot.mul(Axis.YP.rotationDegrees(180));
matrix.mulPose(playerrot);
matrix.pushPose();
@ -92,10 +92,10 @@ public class CarryRenderHelper
if (perspective == 2)
{
matrix.translate(0, 0, 1.35);
matrix.mulPose(Vector3f.XP.rotationDegrees(f4));
matrix.mulPose(Axis.XP.rotationDegrees(f4));
}
else
matrix.mulPose(Vector3f.XN.rotationDegrees(f4));
matrix.mulPose(Axis.XN.rotationDegrees(f4));
matrix.translate(0, -1.5, -1.848);
if (perspective == 2)
@ -112,9 +112,9 @@ public class CarryRenderHelper
matrix.translate(0, 0, 1.35);
if (perspective == 2)
matrix.mulPose(Vector3f.XP.rotationDegrees(f2 * (-90.0F - player.xRotO)));
matrix.mulPose(Axis.XP.rotationDegrees(f2 * (-90.0F - player.xRotO)));
else
matrix.mulPose(Vector3f.XN.rotationDegrees(f2 * (-90.0F - player.xRotO)));
matrix.mulPose(Axis.XN.rotationDegrees(f2 * (-90.0F - player.xRotO)));
}
Vec3 viewVector = player.getViewVector(partialticks);
@ -126,7 +126,7 @@ public class CarryRenderHelper
double d2 = (deltaMovement.x * viewVector.x + deltaMovement.z * viewVector.z) / (Math.sqrt(d0) * Math.sqrt(d1));
double d3 = deltaMovement.x * viewVector.z - deltaMovement.z * viewVector.x;
matrix.mulPose(Vector3f.YP.rotation((float) (Math.signum(d3) * Math.acos(d2))));
matrix.mulPose(Axis.YP.rotation((float) (Math.signum(d3) * Math.acos(d2))));
}
if (perspective != 2)
@ -148,18 +148,18 @@ public class CarryRenderHelper
//TODO: RealFirstPersonRender
//if ((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && perspective == 0)
// matrix.translate(0, 0, -0.4);
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
matrix.mulPose(Axis.YP.rotationDegrees(180));
}
// if(perspective == 1)
// {
// matrix.pushPose();
// //matrix.mulPose(Vector3f.YP.rotationDegrees(180));
// //matrix.mulPose(Axis.YP.rotationDegrees(180));
// matrix.popPose();
// }
//else if ((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && perspective == 0)
// matrix.translate(0, 0, 0.4);
//matrix.mulPose(Vector3f.YP.rotationDegrees(180));
//matrix.mulPose(Axis.YP.rotationDegrees(180));
@ -191,14 +191,14 @@ public class CarryRenderHelper
entity.xRotO = 0.0f;
if (perspective == 2)
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
matrix.mulPose(Axis.YP.rotationDegrees(180));
matrix.scale((10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f);
matrix.translate(0.0, height / 2 + -(height / 2) + 1, width - 0.1 < 0.7 ? width - 0.1 + (0.7 - (width - 0.1)) : width - 0.1);
if (pose == Pose.SWIMMING || pose == Pose.FALL_FLYING)
{
matrix.mulPose(Vector3f.XN.rotationDegrees(90));
matrix.mulPose(Axis.XN.rotationDegrees(90));
matrix.translate(0, -0.2 * height, 0);
if (pose == Pose.FALL_FLYING)
@ -218,9 +218,9 @@ public class CarryRenderHelper
Vec3 rotation = render.renderRotation().getVec();
Vec3 scale = render.renderscale().getVec(1, 1, 1);
Quaternion rot = Vector3f.XP.rotationDegrees((float) rotation.x);
rot.mul(Vector3f.YP.rotationDegrees((float) rotation.y));
rot.mul(Vector3f.ZP.rotationDegrees((float) rotation.z));
Quaternionf rot = Axis.XP.rotationDegrees((float) rotation.x);
rot.mul(Axis.YP.rotationDegrees((float) rotation.y));
rot.mul(Axis.ZP.rotationDegrees((float) rotation.z));
matrix.mulPose(rot);
matrix.translate(translation.x, translation.y, perspective == 1 && script.isBlock() ? -translation.z : translation.z);
@ -244,7 +244,9 @@ public class CarryRenderHelper
{
ScriptRender render = carry.getActiveScript().get().scriptRender();
if(render.renderNameBlock().isPresent())
state = Registry.BLOCK.get(render.renderNameBlock().get()).defaultBlockState();
{
state = BuiltInRegistries.BLOCK.get(render.renderNameBlock().get()).defaultBlockState();
}
}
Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt());
@ -291,7 +293,7 @@ public class CarryRenderHelper
CarryOnScript script = carry.getActiveScript().get();
ScriptRender render = script.scriptRender();
if(render.renderNameEntity().isPresent())
entity = Registry.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level);
entity = BuiltInRegistries.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level);
if(render.renderNBT().isPresent())
entity.load(render.renderNBT().get());

View File

@ -2,6 +2,7 @@ package tschipp.carryon.common.carry;
import com.mojang.serialization.DataResult;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.NbtUtils;
@ -93,7 +94,7 @@ public class CarryOnData {
if(this.type != CarryType.BLOCK)
throw new IllegalStateException("Called getBlock on data that contained " + this.type);
return NbtUtils.readBlockState(nbt.getCompound("block"));
return NbtUtils.readBlockState(BuiltInRegistries.BLOCK.asLookup(), nbt.getCompound("block"));
}
@Nullable

View File

@ -1,6 +1,7 @@
package tschipp.carryon.common.config;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.Entity;
@ -64,7 +65,7 @@ public class ListHandler {
private static boolean doCheck(Block block, Set<String> regular, List<TagKey<Block>> tags)
{
String name = Registry.BLOCK.getKey(block).toString();
String name = BuiltInRegistries.BLOCK.getKey(block).toString();
if(regular.contains(name))
return true;
for(TagKey<Block> tag : tags)
@ -75,7 +76,7 @@ public class ListHandler {
private static boolean doCheck(Entity entity, Set<String> regular, List<TagKey<EntityType<?>>> tags)
{
String name = Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
String name = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
if(regular.contains(name))
return true;
for(TagKey<EntityType<?>> tag : tags)
@ -100,32 +101,32 @@ public class ListHandler {
ALLOWED_TILES_TAGS.clear();
PROPERTY_EXCEPTION_CLASSES.clear();
Map<ResourceLocation, TagKey<Block>> blocktags = Registry.BLOCK.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = Registry.ENTITY_TYPE.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
Map<ResourceLocation, TagKey<Block>> blocktags = BuiltInRegistries.BLOCK.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = BuiltInRegistries.ENTITY_TYPE.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
List<String> forbidden = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenTiles));
forbidden.add("#carryon:block_blacklist");
addWithWildcards(forbidden, FORBIDDEN_TILES, Registry.BLOCK, blocktags, FORBIDDEN_TILES_TAGS);
addWithWildcards(forbidden, FORBIDDEN_TILES, BuiltInRegistries.BLOCK, blocktags, FORBIDDEN_TILES_TAGS);
List<String> forbiddenEntity = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenEntities));
forbiddenEntity.add("#carryon:entity_blacklist");
addWithWildcards(forbiddenEntity, FORBIDDEN_ENTITIES, Registry.ENTITY_TYPE, entitytags, FORBIDDEN_ENTITIES_TAGS);
addWithWildcards(forbiddenEntity, FORBIDDEN_ENTITIES, BuiltInRegistries.ENTITY_TYPE, entitytags, FORBIDDEN_ENTITIES_TAGS);
List<String> allowedEntities = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedEntities));
allowedEntities.add("#carryon:entity_whitelist");
addWithWildcards(allowedEntities, ALLOWED_ENTITIES, Registry.ENTITY_TYPE, entitytags, ALLOWED_ENTITIES_TAGS);
addWithWildcards(allowedEntities, ALLOWED_ENTITIES, BuiltInRegistries.ENTITY_TYPE, entitytags, ALLOWED_ENTITIES_TAGS);
List<String> allowedBlocks = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedBlocks));
allowedBlocks.add("#carryon:block_whitelist");
addWithWildcards(allowedBlocks, ALLOWED_TILES, Registry.BLOCK, blocktags, ALLOWED_TILES_TAGS);
addWithWildcards(allowedBlocks, ALLOWED_TILES, BuiltInRegistries.BLOCK, blocktags, ALLOWED_TILES_TAGS);
List<String> forbiddenStacking = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenStacking));
forbiddenStacking.add("#carryon:stacking_blacklist");
addWithWildcards(forbiddenStacking, FORBIDDEN_STACKING, Registry.ENTITY_TYPE, entitytags, FORBIDDEN_STACKING_TAGS);
addWithWildcards(forbiddenStacking, FORBIDDEN_STACKING, BuiltInRegistries.ENTITY_TYPE, entitytags, FORBIDDEN_STACKING_TAGS);
List<String> allowedStacking = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedStacking));
allowedStacking.add("#carryon:stacking_whitelist");
addWithWildcards(allowedStacking, ALLOWED_STACKING, Registry.ENTITY_TYPE, entitytags, ALLOWED_STACKING_TAGS);
addWithWildcards(allowedStacking, ALLOWED_STACKING, BuiltInRegistries.ENTITY_TYPE, entitytags, ALLOWED_STACKING_TAGS);
for(String propString : Constants.COMMON_CONFIG.settings.placementStateExceptions)
{
@ -133,7 +134,7 @@ public class ListHandler {
continue;
String name = propString.substring(0, propString.indexOf("["));
String props = propString.substring(propString.indexOf("[") + 1, propString.indexOf("]"));
Block blk = Registry.BLOCK.get(new ResourceLocation(name));
Block blk = BuiltInRegistries.BLOCK.get(new ResourceLocation(name));
for(String propName : props.split(",")) {
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
if (prop.getName().equals(propName))

View File

@ -5,7 +5,7 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import net.minecraft.commands.arguments.blocks.BlockStateParser;
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.state.BlockState;
@ -51,7 +51,7 @@ public class PickupCondition
{
String name = match.contains("[") ? match.substring(0, match.indexOf("[")) : match;
String[] split = name.replace("*", ",").split(",");
String stateName = Registry.BLOCK.getKey(state.getBlock()).toString();
String stateName = BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString();
if(StringHelper.matchesWildcards(stateName, split))
{
@ -76,7 +76,7 @@ public class PickupCondition
public boolean matches(Entity entity)
{
String entityName = Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
String entityName = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
if(wildcards)
{
String[] split = match.replace("*", ",").split(",");
@ -99,7 +99,7 @@ public class PickupCondition
private BlockResult parseState(String state)
{
try {
BlockResult result = BlockStateParser.parseForBlock(Registry.BLOCK, state, false);
BlockResult result = BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), state, false);
return result;
} catch (CommandSyntaxException e) {
e.printStackTrace();

View File

@ -2,7 +2,7 @@ package tschipp.carryon.common.scripting;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerPlayer;
@ -83,7 +83,7 @@ public record CarryOnScript(
public static final Codec<ScriptObjectBlock> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
ResourceKey.codec(Registry.BLOCK_REGISTRY).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock),
ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock),
MaterialCondition.CODEC.optionalFieldOf("material", MaterialCondition.NONE).forGetter(ScriptObjectBlock::typeMaterial),
NumberBoundCondition.CODEC.optionalFieldOf("hardness", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeHardness),
NumberBoundCondition.CODEC.optionalFieldOf("resistance", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeResistance),
@ -103,7 +103,7 @@ public record CarryOnScript(
public static final Codec<ScriptObjectEntity> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
ResourceKey.codec(Registry.ENTITY_TYPE_REGISTRY).optionalFieldOf("name").forGetter(ScriptObjectEntity::typeNameEntity),
ResourceKey.codec(Registries.ENTITY_TYPE).optionalFieldOf("name").forGetter(ScriptObjectEntity::typeNameEntity),
NumberBoundCondition.CODEC.optionalFieldOf("health", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeHealth),
NumberBoundCondition.CODEC.optionalFieldOf("height", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeHeight),
NumberBoundCondition.CODEC.optionalFieldOf("width", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeWidth),
@ -153,8 +153,8 @@ public record CarryOnScript(
public static final Codec<ScriptRender> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
ResourceKey.codec(Registry.BLOCK_REGISTRY).optionalFieldOf("name_block").forGetter(ScriptRender::renderNameBlock),
ResourceKey.codec(Registry.ENTITY_TYPE_REGISTRY).optionalFieldOf("name_entity").forGetter(ScriptRender::renderNameEntity),
ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name_block").forGetter(ScriptRender::renderNameBlock),
ResourceKey.codec(Registries.ENTITY_TYPE).optionalFieldOf("name_entity").forGetter(ScriptRender::renderNameEntity),
CompoundTag.CODEC.optionalFieldOf("nbt").forGetter(ScriptRender::renderNBT),
OptionalVec3.CODEC.optionalFieldOf("translation", OptionalVec3.NONE).forGetter(ScriptRender::renderTranslation),
OptionalVec3.CODEC.optionalFieldOf("rotation", OptionalVec3.NONE).forGetter(ScriptRender::renderRotation),

View File

@ -3,7 +3,7 @@ package tschipp.carryon.common.scripting;
import com.mojang.serialization.Codec;
import net.minecraft.advancements.Advancement;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
@ -338,7 +338,7 @@ public final class Matchables
for (MobEffectInstance effect : fx)
{
int amp = effect.getAmplifier();
String name = Registry.MOB_EFFECT.getKey(effect.getEffect()).toString();
String name = BuiltInRegistries.MOB_EFFECT.getKey(effect.getEffect()).toString();
if (names.contains(name))
{

View File

@ -1,7 +1,7 @@
package tschipp.carryon.common.scripting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
@ -67,7 +67,7 @@ public class ScriptManager
boolean matchname = true;
if(scEntity.typeNameEntity().isPresent())
matchname = entity.getType().equals(Registry.ENTITY_TYPE.get(scEntity.typeNameEntity().get()));
matchname = entity.getType().equals(BuiltInRegistries.ENTITY_TYPE.get(scEntity.typeNameEntity().get()));
boolean matchheight = scEntity.typeHeight().matches(height);
boolean matchwidth = scEntity.typeWidth().matches(width);
boolean matchhealth = scEntity.typeHealth().matches(health);
@ -82,7 +82,7 @@ public class ScriptManager
boolean matchblock = true;
if(scBlock.typeNameBlock().isPresent())
matchblock = block == Registry.BLOCK.get(scBlock.typeNameBlock().get());
matchblock = block == BuiltInRegistries.BLOCK.get(scBlock.typeNameBlock().get());
boolean matchnbt = scBlock.typeBlockTag().matches(nbt);
boolean matchmaterial = scBlock.typeMaterial().matches(material);
boolean matchhardness = scBlock.typeHardness().matches(hardness);

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id 'idea'
}
@ -17,7 +17,10 @@ if (System.getenv('BUILD_NUMBER') != null) {
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${parchment_mappings_fabric}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'

View File

@ -32,8 +32,8 @@
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
"minecraft": "1.19.x",
"fabric-api": "*",
"minecraft": ">=1.19.3",
"java": ">=17"
}
}

View File

@ -106,8 +106,8 @@ repositories {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly project(":Common")
implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.2:16.1.9")
//implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
//implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.3:17.0.2")
annotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
}

View File

@ -1,12 +1,34 @@
package tschipp.carryon.compat;
import net.darkhax.gamestages.GameStageHelper;
import net.minecraft.world.entity.player.Player;
import tschipp.carryon.Constants;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class GamestageCompat
{
private static Method hasStage;
static {
try {
Class<?> gamestageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
hasStage = gamestageHelper.getMethod("hasStage", Player.class, String.class);
} catch (Exception e) {
Constants.LOG.info("Gamestages not found. Disabling.");
}
}
public static boolean hasStage(Player player, String stage)
{
return GameStageHelper.hasStage(player, stage);
if(hasStage == null)
return true;
try {
return (boolean) hasStage.invoke(null, player, stage);
} catch (IllegalAccessException | InvocationTargetException e) {
}
return true;
}
}

View File

@ -1,5 +1,5 @@
modLoader="javafml" #mandatory
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[44,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="GNU LGPLv3"
issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
@ -19,7 +19,7 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[43,)" #mandatory
versionRange="[44,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -28,6 +28,6 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
[[dependencies.carryon]]
modId="minecraft"
mandatory=true
versionRange="[1.19.2,1.20)"
versionRange="[1.19.3,1.20)"
ordering="NONE"
side="BOTH"

View File

@ -3,19 +3,20 @@ version=2.0.0
group=tschipp.carryon
# Common
minecraft_version=1.19.2
minecraft_version=1.19.3
common_runs_enabled=false
common_client_run_name=Common Client
common_server_run_name=Common Server
# Forge
forge_version=43.1.30
parchment_mappings=2022.11.20-1.19.2
forge_version=44.0.11
parchment_mappings=1.19.2-2022.11.27-1.19.3
//forge_ats_enabled=true
# Fabric
fabric_version=0.62.0+1.19.2
fabric_loader_version=0.14.9
fabric_version=0.69.0+1.19.3
fabric_loader_version=0.14.11
parchment_mappings_fabric=1.19.2:2022.11.27
# Quilt
quilt_loader_version=0.16.0-beta.7

View File

@ -9,6 +9,10 @@ pluginManagement {
name = 'Sponge Snapshots'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}
}
}