diff --git a/gradle.properties b/gradle.properties index 5b9a9640..fb8b49ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html minecraft_version=20w51a - yarn_mappings=20w51a+build.1 + yarn_mappings=20w51a+build.30 loader_version=0.11.0 # Mod Properties diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 7c242e09..87cb6eab 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.entity.vehicle.MinecartEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.s2c.play.HeldItemChangeS2CPacket; +import net.minecraft.network.packet.s2c.play.UpdateSelectedSlotS2CPacket; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.server.world.ServerWorld; @@ -280,7 +280,7 @@ public class EntityPlayerActionPack public void setSlot(int slot) { player.getInventory().selectedSlot = slot-1; - player.networkHandler.sendPacket(new HeldItemChangeS2CPacket(slot-1)); + player.networkHandler.sendPacket(new UpdateSelectedSlotS2CPacket(slot-1)); } public enum ActionType diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index ff82f24b..a86d2973 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -2,7 +2,7 @@ package carpet.helpers; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.ParticleArgumentType; +import net.minecraft.command.argument.ParticleEffectArgumentType; import net.minecraft.particle.ParticleEffect; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; @@ -19,7 +19,7 @@ public class ParticleDisplay { try { - return ParticleArgumentType.readParameters(new StringReader(name)); + return ParticleEffectArgumentType.readParameters(new StringReader(name)); } catch (CommandSyntaxException e) { diff --git a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java index 03bb1f38..0cad4711 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_tickspeedMixin.java @@ -40,7 +40,7 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec @Shadow protected abstract boolean shouldKeepTicking(); - @Shadow private long field_19248; + @Shadow private long nextTickTimestamp; @Shadow protected abstract void method_16208(); @@ -127,7 +127,7 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec while(this.runEveryTask()) {Thread.yield();} } this.waitingForNextTick = true; - this.field_19248 = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference); + this.nextTickTimestamp = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference); // run all tasks (this will not do a lot when warping), but that's fine since we already run them this.method_16208(); this.profiler.pop(); diff --git a/src/main/java/carpet/mixins/PistonBlockEntityRenderer_movableTEMixin.java b/src/main/java/carpet/mixins/PistonBlockEntityRenderer_movableTEMixin.java index d41652b0..801e9693 100644 --- a/src/main/java/carpet/mixins/PistonBlockEntityRenderer_movableTEMixin.java +++ b/src/main/java/carpet/mixins/PistonBlockEntityRenderer_movableTEMixin.java @@ -27,7 +27,7 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin implements BlockE } @Inject(method = "render", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;method_3575(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/world/World;ZI)V", ordinal = 3)) + target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;renderModel(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/world/World;ZI)V", ordinal = 3)) private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, float float_1, MatrixStack matrixStack_1, VertexConsumerProvider layeredVertexConsumerStorage_1, int int_1, int int_2, CallbackInfo ci) //private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci) { diff --git a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java index 559fbc91..d7ce33b2 100644 --- a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_scarpetEventsMixin.java @@ -75,6 +75,6 @@ public class ServerPlayerInteractionManager_scarpetEventsMixin implements Server public void setBlockBreakingProgress(int progress) { blockBreakingProgress = MathHelper.clamp(progress, -1, 10); - world.setBlockBreakingInfo(-1*this.player.getEntityId(), miningPos, blockBreakingProgress); + world.setBlockBreakingInfo(-1*this.player.getId(), miningPos, blockBreakingProgress); } } diff --git a/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java b/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java index 99598274..8cad062d 100644 --- a/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java @@ -3,16 +3,17 @@ package carpet.mixins; import carpet.CarpetSettings; import carpet.fakes.ServerWorldInterface; import carpet.script.CarpetEventServer; -import net.minecraft.class_5568; -import net.minecraft.class_5579; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLike; import net.minecraft.entity.LightningEntity; +import net.minecraft.server.world.ServerEntityManager; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.profiler.Profiler; import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.level.ServerWorldProperties; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -42,12 +43,12 @@ public class ServerWorld_scarpetMixin implements ServerWorldInterface @Redirect(method = "addEntity", at = @At( value = "INVOKE", - target = "Lnet/minecraft/class_5579;addEntity(Lnet/minecraft/class_5568;)Z" + target = "Lnet/minecraft/server/world/ServerEntityManager;addEntity(Lnet/minecraft/entity/EntityLike;)Z" )) - private boolean onEntityAddedToWorld(class_5579 class_5579, class_5568 arg) + private boolean onEntityAddedToWorld(ServerEntityManager serverEntityManager, EntityLike entityLike) { - Entity entity = (Entity)arg; - boolean success = class_5579.addEntity(entity); + Entity entity = (Entity)entityLike; + boolean success = serverEntityManager.addEntity(entity); if (success) { CarpetEventServer.Event event = ENTITY_LOAD.get(entity.getType()); if (event != null) { @@ -61,6 +62,7 @@ public class ServerWorld_scarpetMixin implements ServerWorldInterface return success; } + @Final @Shadow private ServerWorldProperties worldProperties; public ServerWorldProperties getWorldPropertiesCM(){ diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index 0548101f..6cdb86ec 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -73,7 +73,7 @@ public class Inventories { CarpetContext cc = (CarpetContext)c; TagManager tagManager = cc.s.getMinecraftServer().getTagManager(); String tag = lv.get(0).evalValue(c).getString(); - net.minecraft.tag.Tag itemTag = tagManager.method_33164(Registry.ITEM_KEY).getTag(new Identifier(tag)); + net.minecraft.tag.Tag itemTag = tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTag(new Identifier(tag)); if (itemTag == null) return LazyValue.NULL; Value ret = ListValue.wrap(itemTag.values().stream().map(b -> ValueConversions.of(Registry.ITEM.getId(b))).collect(Collectors.toList())); return (_c, _t) -> ret; @@ -85,17 +85,17 @@ public class Inventories { TagManager tagManager = cc.s.getMinecraftServer().getTagManager(); if (lv.size() == 0) { - Value ret = ListValue.wrap(tagManager.method_33164(Registry.ITEM_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList())); + Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList())); return (_c, _t) -> ret; } Item item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString()).getItem(); if (lv.size() == 1) { - Value ret = ListValue.wrap(tagManager.method_33164(Registry.ITEM_KEY).getTagsFor(item).stream().map(ValueConversions::of).collect(Collectors.toList())); + Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTagsFor(item).stream().map(ValueConversions::of).collect(Collectors.toList())); return (_c, _t) -> ret; } String tag = lv.get(1).evalValue(c).getString(); - net.minecraft.tag.Tag itemTag = tagManager.method_33164(Registry.ITEM_KEY).getTag(new Identifier(tag)); + net.minecraft.tag.Tag itemTag = tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTag(new Identifier(tag)); if (itemTag == null) return LazyValue.NULL; return itemTag.contains(item)?LazyValue.TRUE:LazyValue.FALSE; }); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index c72b47b0..0e7b019c 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -245,7 +245,7 @@ public class WorldAccess { return true; } else { ItemStack itemStack_1 = player.getMainHandStack(); - boolean boolean_2 = player.isUsingEffectiveTool(blockState_1); + boolean boolean_2 = player.canHarvest(blockState_1); itemStack_1.postMine(player.world, blockState_1, blockPos_1, player); if (boolean_1 && boolean_2) { ItemStack itemStack_2 = itemStack_1.isEmpty() ? ItemStack.EMPTY : itemStack_1.copy(); @@ -905,7 +905,7 @@ public class WorldAccess { boolean dropLoot = true; if (playerBreak) { - boolean isUsingEffectiveTool = !state.isToolRequired() || tool.isEffectiveOn(state); + boolean isUsingEffectiveTool = !state.isToolRequired() || tool.isSuitableFor(state); //postMine() durability from item classes float hardness = state.getHardness(world, where); int damageAmount = 0; @@ -1109,7 +1109,7 @@ public class WorldAccess { CarpetContext cc = (CarpetContext)c; TagManager tagManager = cc.s.getMinecraftServer().getTagManager(); String tag = lv.get(0).evalValue(c).getString(); - net.minecraft.tag.Tag blockTag = tagManager.method_33164(Registry.BLOCK_KEY).getTag(new Identifier(tag)); + net.minecraft.tag.Tag blockTag = tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTag(new Identifier(tag)); if (blockTag == null) return LazyValue.NULL; Value ret = ListValue.wrap(blockTag.values().stream().map(b -> ValueConversions.of(Registry.BLOCK.getId(b))).collect(Collectors.toList())); return (_c, _t) -> ret; @@ -1121,17 +1121,17 @@ public class WorldAccess { TagManager tagManager = cc.s.getMinecraftServer().getTagManager(); if (lv.size() == 0) { - Value ret = ListValue.wrap(tagManager.method_33164(Registry.BLOCK_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList())); + Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList())); return (_c, _t) -> ret; } BlockArgument blockLocator = BlockArgument.findIn(cc, lv, 0, true); if (blockLocator.offset == lv.size()) { - Value ret = ListValue.wrap(tagManager.method_33164(Registry.BLOCK_KEY).getTagsFor(blockLocator.block.getBlockState().getBlock()).stream().map(ValueConversions::of).collect(Collectors.toList())); + Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTagsFor(blockLocator.block.getBlockState().getBlock()).stream().map(ValueConversions::of).collect(Collectors.toList())); return (_c, _t) -> ret; } String tag = lv.get(blockLocator.offset).evalValue(c).getString(); - net.minecraft.tag.Tag blockTag = tagManager.method_33164(Registry.BLOCK_KEY).getTag(new Identifier(tag)); + net.minecraft.tag.Tag blockTag = tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTag(new Identifier(tag)); if (blockTag == null) return LazyValue.NULL; return blockLocator.block.getBlockState().isIn(blockTag)?LazyValue.TRUE:LazyValue.FALSE; }); diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index cae45ed2..01163359 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -47,18 +47,18 @@ import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.command.argument.EntitySummonArgumentType; import net.minecraft.command.argument.GameProfileArgumentType; import net.minecraft.command.argument.IdentifierArgumentType; -import net.minecraft.command.argument.ItemEnchantmentArgumentType; +import net.minecraft.command.argument.EnchantmentArgumentType; import net.minecraft.command.argument.ItemSlotArgumentType; import net.minecraft.command.argument.ItemStackArgumentType; import net.minecraft.command.argument.MessageArgumentType; -import net.minecraft.command.argument.MobEffectArgumentType; +import net.minecraft.command.argument.StatusEffectArgumentType; import net.minecraft.command.argument.NbtCompoundTagArgumentType; import net.minecraft.command.argument.NbtPathArgumentType; import net.minecraft.command.argument.NbtTagArgumentType; import net.minecraft.command.argument.NumberRangeArgumentType; -import net.minecraft.command.argument.ObjectiveArgumentType; -import net.minecraft.command.argument.ObjectiveCriteriaArgumentType; -import net.minecraft.command.argument.ParticleArgumentType; +import net.minecraft.command.argument.ScoreboardObjectiveArgumentType; +import net.minecraft.command.argument.ScoreboardCriterionArgumentType; +import net.minecraft.command.argument.ParticleEffectArgumentType; import net.minecraft.command.argument.RotationArgumentType; import net.minecraft.command.argument.ScoreHolderArgumentType; import net.minecraft.command.argument.ScoreboardSlotArgumentType; @@ -152,17 +152,17 @@ public abstract class CommandArgument new VanillaUnconfigurableArgument("entitytype", EntitySummonArgumentType::entitySummon, (c, p) -> ValueConversions.of(EntitySummonArgumentType.getEntitySummon(c, p)), SuggestionProviders.SUMMONABLE_ENTITIES ), - new VanillaUnconfigurableArgument("floatrange", NumberRangeArgumentType::method_30918, + new VanillaUnconfigurableArgument("floatrange", NumberRangeArgumentType::floatRange, (c, p) -> ValueConversions.of(c.getArgument(p, NumberRange.FloatRange.class)), true ), // function?? new PlayerProfileArgument(), - new VanillaUnconfigurableArgument("intrange", NumberRangeArgumentType::numberRange, + new VanillaUnconfigurableArgument("intrange", NumberRangeArgumentType::intRange, (c, p) -> ValueConversions.of(NumberRangeArgumentType.IntRangeArgumentType.getRangeArgument(c, p)), true ), - new VanillaUnconfigurableArgument("enchantment", ItemEnchantmentArgumentType::itemEnchantment, - (c, p) -> ValueConversions.of(Registry.ENCHANTMENT.getId(ItemEnchantmentArgumentType.getEnchantment(c, p))), false + new VanillaUnconfigurableArgument("enchantment", EnchantmentArgumentType::enchantment, + (c, p) -> ValueConversions.of(Registry.ENCHANTMENT.getId(EnchantmentArgumentType.getEnchantment(c, p))), false ), // item_predicate ?? //same as item but accepts tags, not sure right now new SlotArgument(), @@ -172,22 +172,22 @@ public abstract class CommandArgument new VanillaUnconfigurableArgument("message", MessageArgumentType::message, (c, p) -> new FormattedTextValue(MessageArgumentType.getMessage(c, p)), true ), - new VanillaUnconfigurableArgument("effect", MobEffectArgumentType::mobEffect, - (c, p) -> ValueConversions.of(Registry.STATUS_EFFECT.getId(MobEffectArgumentType.getMobEffect(c, p))),false + new VanillaUnconfigurableArgument("effect", StatusEffectArgumentType::statusEffect, + (c, p) -> ValueConversions.of(Registry.STATUS_EFFECT.getId(StatusEffectArgumentType.getStatusEffect(c, p))),false ), new TagArgument(), // for nbt_compound_tag and nbt_tag new VanillaUnconfigurableArgument("path", NbtPathArgumentType::nbtPath, (c, p) -> StringValue.of(NbtPathArgumentType.getNbtPath(c, p).toString()), true ), - new VanillaUnconfigurableArgument("objective", ObjectiveArgumentType::objective, - (c, p) -> ValueConversions.of(ObjectiveArgumentType.getObjective(c, p)), false + new VanillaUnconfigurableArgument("objective", ScoreboardObjectiveArgumentType::scoreboardObjective, + (c, p) -> ValueConversions.of(ScoreboardObjectiveArgumentType.getObjective(c, p)), false ), - new VanillaUnconfigurableArgument("criterion", ObjectiveCriteriaArgumentType::objectiveCriteria, - (c, p) -> StringValue.of(ObjectiveCriteriaArgumentType.getCriteria(c, p).getName()), false + new VanillaUnconfigurableArgument("criterion", ScoreboardCriterionArgumentType::scoreboardCriterion, + (c, p) -> StringValue.of(ScoreboardCriterionArgumentType.getCriterion(c, p).getName()), false ), // operation // not sure if we need it, you have scarpet for that - new VanillaUnconfigurableArgument("particle", ParticleArgumentType::particle, - (c, p) -> ValueConversions.of(ParticleArgumentType.getParticle(c, p)), false + new VanillaUnconfigurableArgument("particle", ParticleEffectArgumentType::particleEffect, + (c, p) -> ValueConversions.of(ParticleEffectArgumentType.getParticle(c, p)), false ), // resource / identifier section diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 761b8420..871d55aa 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -18,7 +18,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.ParticleArgumentType; +import net.minecraft.command.argument.ParticleEffectArgumentType; import net.minecraft.entity.Entity; import net.minecraft.nbt.ByteTag; import net.minecraft.nbt.CompoundTag; @@ -152,7 +152,7 @@ public class ShapeDispatcher return particle; try { - particle = ParticleArgumentType.readParameters(new StringReader(name)); + particle = ParticleEffectArgumentType.readParameters(new StringReader(name)); } catch (CommandSyntaxException e) { @@ -1225,11 +1225,11 @@ public class ShapeDispatcher @Override public Value validate(Map options, CarpetContext cc, Value value) { - if (value instanceof EntityValue) return new NumericValue(((EntityValue) value).getEntity().getEntityId()); + if (value instanceof EntityValue) return new NumericValue(((EntityValue) value).getEntity().getId()); ServerPlayerEntity player = EntityValue.getPlayerByValue(cc.s.getMinecraftServer(), value); if (player == null) throw new InternalExpressionException(id+" parameter needs to represent an entity or player"); - return new NumericValue(player.getEntityId()); + return new NumericValue(player.getId()); } public Value decode(Tag tag) { return new NumericValue(((IntTag)tag).getInt()); } diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index 1993c9a4..ca3c3354 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -97,7 +97,7 @@ public class WorldTools ChunkGenerator chunkGenerator2; DimensionType dimensionType2; if (dimensionOptions == null) { - dimensionType2 = (DimensionType)server.getRegistryManager().method_33309(Registry.DIMENSION_TYPE_KEY).getOrThrow(DimensionType.OVERWORLD_REGISTRY_KEY); + dimensionType2 = server.getRegistryManager().getMutable(Registry.DIMENSION_TYPE_KEY).getOrThrow(DimensionType.OVERWORLD_REGISTRY_KEY); chunkGenerator2 = GeneratorOptions.createOverworldGenerator(server.getRegistryManager().get(Registry.BIOME_KEY), server.getRegistryManager().get(Registry.NOISE_SETTINGS_WORLDGEN), (new Random()).nextLong()); } else { dimensionType2 = dimensionOptions.getDimensionType(); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 3c958902..7ef07900 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -191,7 +191,7 @@ public class EntityValue extends Value { if (v instanceof EntityValue) { - return getEntity().getEntityId()==((EntityValue) v).getEntity().getEntityId(); + return getEntity().getId()==((EntityValue) v).getEntity().getId(); } return super.equals((Value)v); } @@ -241,7 +241,7 @@ public class EntityValue extends Value positive = false; who = who.substring(1); } - net.minecraft.tag.Tag> eTag = server.getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(who)); + net.minecraft.tag.Tag> eTag = server.getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(who)); if (eTag == null) throw new InternalExpressionException(who+" is not a valid entity descriptor"); if (positive) { @@ -415,7 +415,7 @@ public class EntityValue extends Value //put("test", (e, a) -> a == null ? Value.NULL : new StringValue(a.getString())); put("removed", (entity, arg) -> new NumericValue(entity.isRemoved())); put("uuid",(e, a) -> new StringValue(e.getUuidAsString())); - put("id",(e, a) -> new NumericValue(e.getEntityId())); + put("id",(e, a) -> new NumericValue(e.getId())); put("pos", (e, a) -> ListValue.of(new NumericValue(e.getX()), new NumericValue(e.getY()), new NumericValue(e.getZ()))); put("location", (e, a) -> ListValue.of(new NumericValue(e.getX()), new NumericValue(e.getY()), new NumericValue(e.getZ()), new NumericValue(e.yaw), new NumericValue(e.pitch))); put("x", (e, a) -> new NumericValue(e.getX())); @@ -444,13 +444,13 @@ public class EntityValue extends Value put("tags", (e, a) -> ListValue.wrap(e.getScoreboardTags().stream().map(StringValue::new).collect(Collectors.toList()))); put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getScoreboardTags().stream().map(StringValue::new).collect(Collectors.toList()))); - put("entity_tags", (e, a) -> ListValue.wrap(e.getServer().getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTagsFor(e.getType()).stream().map(ValueConversions::of).collect(Collectors.toList()))); + put("entity_tags", (e, a) -> ListValue.wrap(e.getServer().getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTagsFor(e.getType()).stream().map(ValueConversions::of).collect(Collectors.toList()))); // deprecated put("has_tag", (e, a) -> new NumericValue(e.getScoreboardTags().contains(a.getString()))); put("has_scoreboard_tag", (e, a) -> new NumericValue(e.getScoreboardTags().contains(a.getString()))); put("has_entity_tag", (e, a) -> { - net.minecraft.tag.Tag> tag = e.getServer().getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(a.getString())); + net.minecraft.tag.Tag> tag = e.getServer().getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(a.getString())); if (tag == null) return Value.NULL; return new NumericValue(e.getType().isIn(tag)); }); diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 8699dc54..1874238d 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -389,7 +389,7 @@ public class ValueConversions BlockPredicateInterface predicateData = (BlockPredicateInterface) blockPredicate; return ListValue.of( predicateData.getCMBlockState()==null?Value.NULL:of(Registry.BLOCK.getId(predicateData.getCMBlockState().getBlock())), - predicateData.getCMBlockTag()==null?Value.NULL:of(tagManager.method_33164(Registry.BLOCK_KEY).getUncheckedTagId(predicateData.getCMBlockTag())), + predicateData.getCMBlockTag()==null?Value.NULL:of(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getUncheckedTagId(predicateData.getCMBlockTag())), MapValue.wrap(predicateData.getCMProperties()), predicateData.getCMDataTag() == null?Value.NULL:new NBTSerializableValue(predicateData.getCMDataTag()) ); diff --git a/src/main/java/carpet/utils/BlockInfo.java b/src/main/java/carpet/utils/BlockInfo.java index 6705c82d..2136d1a4 100644 --- a/src/main/java/carpet/utils/BlockInfo.java +++ b/src/main/java/carpet/utils/BlockInfo.java @@ -85,20 +85,20 @@ public class BlockInfo public static final Map mapColourName = new HashMap() {{ put(MapColor.CLEAR , "air" ); - put(MapColor.GRASS , "grass" ); - put(MapColor.SAND , "sand" ); - put(MapColor.WEB , "wool" ); - put(MapColor.LAVA , "tnt" ); - put(MapColor.ICE , "ice" ); - put(MapColor.IRON , "iron" ); - put(MapColor.FOLIAGE , "foliage" ); + put(MapColor.PALE_GREEN , "grass" ); + put(MapColor.PALE_YELLOW , "sand" ); + put(MapColor.WHITE_GRAY , "wool" ); + put(MapColor.BRIGHT_RED , "tnt" ); + put(MapColor.PALE_PURPLE , "ice" ); + put(MapColor.IRON_GRAY , "iron" ); + put(MapColor.DARK_GREEN , "foliage" ); put(MapColor.WHITE , "snow" ); - put(MapColor.CLAY , "clay" ); - put(MapColor.DIRT , "dirt" ); - put(MapColor.STONE , "stone" ); - put(MapColor.WATER , "water" ); - put(MapColor.WOOD , "wood" ); - put(MapColor.QUARTZ , "quartz" ); + put(MapColor.LIGHT_BLUE_GRAY , "clay" ); + put(MapColor.DIRT_BROWN , "dirt" ); + put(MapColor.STONE_GRAY , "stone" ); + put(MapColor.WATER_BLUE , "water" ); + put(MapColor.OAK_TAN , "wood" ); + put(MapColor.OFF_WHITE , "quartz" ); put(MapColor.ORANGE , "adobe" ); put(MapColor.MAGENTA , "magenta" ); put(MapColor.LIGHT_BLUE, "light_blue"); @@ -115,34 +115,34 @@ public class BlockInfo put(MapColor.RED , "red" ); put(MapColor.BLACK , "black" ); put(MapColor.GOLD , "gold" ); - put(MapColor.DIAMOND , "diamond" ); - put(MapColor.LAPIS , "lapis" ); - put(MapColor.EMERALD , "emerald" ); - put(MapColor.SPRUCE , "obsidian" ); - put(MapColor.NETHER , "netherrack"); //TODO fix these - put(MapColor.WHITE_TERRACOTTA , "white_terracotta" ); - put(MapColor.ORANGE_TERRACOTTA , "orange_terracotta" ); - put(MapColor.MAGENTA_TERRACOTTA , "magenta_terracotta" ); - put(MapColor.LIGHT_BLUE_TERRACOTTA, "light_blue_terracotta" ); - put(MapColor.YELLOW_TERRACOTTA , "yellow_terracotta" ); - put(MapColor.LIME_TERRACOTTA , "lime_terracotta" ); - put(MapColor.PINK_TERRACOTTA , "pink_terracotta" ); - put(MapColor.GRAY_TERRACOTTA , "gray_terracotta" ); - put(MapColor.LIGHT_GRAY_TERRACOTTA, "light_gray_terracotta" ); - put(MapColor.CYAN_TERRACOTTA , "cyan_terracotta" ); - put(MapColor.PURPLE_TERRACOTTA , "purple_terracotta" ); - put(MapColor.BLUE_TERRACOTTA , "blue_terracotta" ); - put(MapColor.BROWN_TERRACOTTA , "brown_terracotta" ); - put(MapColor.GREEN_TERRACOTTA , "green_terracotta" ); - put(MapColor.RED_TERRACOTTA , "red_terracotta" ); - put(MapColor.BLACK_TERRACOTTA , "black_terracotta" ); - put(MapColor.CRIMSON_NYLIUM , "crimson_nylium" ); - put(MapColor.CRIMSON_STEM , "crimson_stem" ); - put(MapColor.CRIMSON_HYPHAE , "crimson_hyphae" ); - put(MapColor.WARPED_NYLIUM , "warped_nylium" ); - put(MapColor.WARPED_STEM , "warped_stem" ); - put(MapColor.WARPED_HYPHAE , "warped_hyphae" ); - put(MapColor.WARPED_WART , "warped_wart" ); + put(MapColor.DIAMOND_BLUE , "diamond" ); + put(MapColor.LAPIS_BLUE , "lapis" ); + put(MapColor.EMERALD_GREEN , "emerald" ); + put(MapColor.SPRUCE_BROWN , "obsidian" ); + put(MapColor.DARK_RED , "netherrack"); //TODO fix these + put(MapColor.TERRACOTTA_WHITE , "white_terracotta" ); + put(MapColor.TERRACOTTA_ORANGE , "orange_terracotta" ); + put(MapColor.TERRACOTTA_MAGENTA , "magenta_terracotta" ); + put(MapColor.TERRACOTTA_LIGHT_BLUE, "light_blue_terracotta" ); + put(MapColor.TERRACOTTA_YELLOW , "yellow_terracotta" ); + put(MapColor.TERRACOTTA_LIME , "lime_terracotta" ); + put(MapColor.TERRACOTTA_PINK , "pink_terracotta" ); + put(MapColor.TERRACOTTA_GRAY , "gray_terracotta" ); + put(MapColor.TERRACOTTA_LIGHT_GRAY, "light_gray_terracotta" ); + put(MapColor.TERRACOTTA_CYAN , "cyan_terracotta" ); + put(MapColor.TERRACOTTA_PURPLE , "purple_terracotta" ); + put(MapColor.TERRACOTTA_BLUE , "blue_terracotta" ); + put(MapColor.TERRACOTTA_BROWN , "brown_terracotta" ); + put(MapColor.TERRACOTTA_GREEN , "green_terracotta" ); + put(MapColor.TERRACOTTA_RED , "red_terracotta" ); + put(MapColor.TERRACOTTA_BLACK , "black_terracotta" ); + put(MapColor.DULL_RED , "crimson_nylium" ); + put(MapColor.DULL_PINK , "crimson_stem" ); + put(MapColor.DARK_CRIMSON , "crimson_hyphae" ); + put(MapColor.TEAL , "warped_nylium" ); + put(MapColor.DARK_AQUA , "warped_stem" ); + put(MapColor.DARK_DULL_PINK , "warped_hyphae" ); + put(MapColor.BRIGHT_TEAL , "warped_wart" ); }}; public static final Map materialName = new HashMap() {{ @@ -159,7 +159,7 @@ public class BlockInfo put(Material.LAVA , "lava" ); put(Material.SNOW_LAYER , "snow_layer" ); put(Material.FIRE , "fire" ); - put(Material.SUPPORTED , "decoration" ); + put(Material.DECORATION , "decoration" ); put(Material.COBWEB , "cobweb" ); put(Material.REDSTONE_LAMP , "redstone_lamp"); put(Material.ORGANIC_PRODUCT, "clay" );