diff --git a/src/main/java/carpet/commands/DistanceCommand.java b/src/main/java/carpet/commands/DistanceCommand.java index a4bd4669..3562dd38 100644 --- a/src/main/java/carpet/commands/DistanceCommand.java +++ b/src/main/java/carpet/commands/DistanceCommand.java @@ -18,7 +18,7 @@ public class DistanceCommand requires((player) -> CarpetSettings.commandDistance). then(literal("from"). executes( (c) -> DistanceCalculator.setStart(c.getSource(), c.getSource().getPosition())). - then(argument("from", Vec3ArgumentType.create()). + then(argument("from", Vec3ArgumentType.vec3()). executes( (c) -> DistanceCalculator.setStart( c.getSource(), Vec3ArgumentType.getVec3(c, "from"))). @@ -27,7 +27,7 @@ public class DistanceCommand c.getSource(), Vec3ArgumentType.getVec3(c, "from"), c.getSource().getPosition())). - then(argument("to", Vec3ArgumentType.create()). + then(argument("to", Vec3ArgumentType.vec3()). executes( (c) -> DistanceCalculator.distance( c.getSource(), Vec3ArgumentType.getVec3(c, "from"), @@ -35,7 +35,7 @@ public class DistanceCommand )))))). then(literal("to"). executes( (c) -> DistanceCalculator.setEnd(c.getSource(), c.getSource().getPosition()) ). - then(argument("to", Vec3ArgumentType.create()). + then(argument("to", Vec3ArgumentType.vec3()). executes( (c) -> DistanceCalculator.setEnd(c.getSource(), Vec3ArgumentType.getVec3(c, "to"))))); dispatcher.register(command); } diff --git a/src/main/java/carpet/commands/DrawCommand.java b/src/main/java/carpet/commands/DrawCommand.java index dc1b92c2..ca5a3447 100644 --- a/src/main/java/carpet/commands/DrawCommand.java +++ b/src/main/java/carpet/commands/DrawCommand.java @@ -31,9 +31,9 @@ public class DrawCommand LiteralArgumentBuilder command = literal("draw"). requires((player) -> CarpetSettings.commandDraw). then(literal("sphere"). - then(argument("center",BlockPosArgumentType.create()). + then(argument("center",BlockPosArgumentType.blockPos()). then(argument("radius",IntegerArgumentType.integer(1)). - then(argument("block",BlockStateArgumentType.create()). + then(argument("block",BlockStateArgumentType.blockState()). executes((c)-> drawCircle( c.getSource(), BlockPosArgumentType.getBlockPos(c, "center"), @@ -43,7 +43,7 @@ public class DrawCommand ) ). then(literal("replace"). - then(argument("filter",BlockPredicateArgumentType.create()) + then(argument("filter",BlockPredicateArgumentType.blockPredicate()) .executes((c)-> drawCircle( c.getSource(), BlockPosArgumentType.getBlockPos(c, "center"), diff --git a/src/main/java/carpet/commands/InfoCommand.java b/src/main/java/carpet/commands/InfoCommand.java index 3c7db9a7..9521b0a4 100644 --- a/src/main/java/carpet/commands/InfoCommand.java +++ b/src/main/java/carpet/commands/InfoCommand.java @@ -31,7 +31,7 @@ public class InfoCommand LiteralArgumentBuilder command = literal("info"). requires((player) -> CarpetSettings.commandInfo). then(literal("block"). - then(argument("block position", BlockPosArgumentType.create()). + then(argument("block position", BlockPosArgumentType.blockPos()). executes( (c) -> infoBlock( c.getSource(), BlockPosArgumentType.getBlockPos(c, "block position"), null)). diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index acb336eb..e6b04435 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -27,12 +27,12 @@ public class PerimeterInfoCommand c.getSource(), new BlockPos(c.getSource().getPosition()), null)). - then(argument("center position", BlockPosArgumentType.create()). + then(argument("center position", BlockPosArgumentType.blockPos()). executes( (c) -> perimeterDiagnose( c.getSource(), BlockPosArgumentType.getBlockPos(c, "center position"), null)). - then(argument("mob",EntitySummonArgumentType.create()). + then(argument("mob",EntitySummonArgumentType.entitySummon()). suggests(SuggestionProviders.SUMMONABLE_ENTITIES). executes( (c) -> perimeterDiagnose( c.getSource(), diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index 7cd88ffc..eba82471 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -99,7 +99,7 @@ public class PlayerCommand executes(PlayerCommand::lookUp)). then(literal("down"). executes(PlayerCommand::lookDown)). - then(argument("direction", RotationArgumentType.create()). + then(argument("direction", RotationArgumentType.rotation()). executes(PlayerCommand::lookAround))). then(literal("turn"). then(literal("left"). @@ -108,7 +108,7 @@ public class PlayerCommand executes(PlayerCommand::turnRight)). then(literal("back"). executes(PlayerCommand::turnBack)). - then(argument("direction",RotationArgumentType.create()). + then(argument("direction",RotationArgumentType.rotation()). executes(PlayerCommand::turn))). then(literal("move"). then(literal("forward"). @@ -122,13 +122,13 @@ public class PlayerCommand then(literal("spawn"). executes(PlayerCommand::spawn). then(literal("at"). - then(argument("position", Vec3ArgumentType.create()). + then(argument("position", Vec3ArgumentType.vec3()). executes(PlayerCommand::spawn). then(literal("facing"). - then(argument("direction",RotationArgumentType.create()). + then(argument("direction",RotationArgumentType.rotation()). executes(PlayerCommand::spawn). then(literal("in"). - then(argument("dimension", DimensionArgumentType.create()). + then(argument("dimension", DimensionArgumentType.dimension()). executes(PlayerCommand::spawn))))))))); dispatcher.register(literalargumentbuilder); diff --git a/src/main/java/carpet/commands/ScriptCommand.java b/src/main/java/carpet/commands/ScriptCommand.java index 2068990f..dbd31102 100644 --- a/src/main/java/carpet/commands/ScriptCommand.java +++ b/src/main/java/carpet/commands/ScriptCommand.java @@ -99,7 +99,7 @@ public class ScriptCommand )))); LiteralArgumentBuilder c = literal("invokepoint"). then(argument("call", StringArgumentType.word()).suggests( (cc, bb)->suggestMatching(suggestFunctionCalls(cc),bb)). - then(argument("origin", BlockPosArgumentType.create()). + then(argument("origin", BlockPosArgumentType.blockPos()). executes( (cc) -> invoke( cc, StringArgumentType.getString(cc, "call"), @@ -117,8 +117,8 @@ public class ScriptCommand ))))); LiteralArgumentBuilder h = literal("invokearea"). then(argument("call", StringArgumentType.word()).suggests( (cc, bb)->suggestMatching(suggestFunctionCalls(cc),bb)). - then(argument("from", BlockPosArgumentType.create()). - then(argument("to", BlockPosArgumentType.create()). + then(argument("from", BlockPosArgumentType.blockPos()). + then(argument("to", BlockPosArgumentType.blockPos()). executes( (cc) -> invoke( cc, StringArgumentType.getString(cc, "call"), @@ -135,9 +135,9 @@ public class ScriptCommand StringArgumentType.getString(cc, "arguments") )))))); LiteralArgumentBuilder i = literal("scan").requires((player) -> player.hasPermissionLevel(2)). - then(argument("origin", BlockPosArgumentType.create()). - then(argument("from", BlockPosArgumentType.create()). - then(argument("to", BlockPosArgumentType.create()). + then(argument("origin", BlockPosArgumentType.blockPos()). + then(argument("from", BlockPosArgumentType.blockPos()). + then(argument("to", BlockPosArgumentType.blockPos()). then(argument("expr", StringArgumentType.greedyString()). suggests((cc, bb) -> suggestCode(cc, bb)). executes( (cc) -> scriptScan( @@ -148,11 +148,11 @@ public class ScriptCommand StringArgumentType.getString(cc, "expr") )))))); LiteralArgumentBuilder e = literal("fill").requires((player) -> player.hasPermissionLevel(2)). - then(argument("origin", BlockPosArgumentType.create()). - then(argument("from", BlockPosArgumentType.create()). - then(argument("to", BlockPosArgumentType.create()). + then(argument("origin", BlockPosArgumentType.blockPos()). + then(argument("from", BlockPosArgumentType.blockPos()). + then(argument("to", BlockPosArgumentType.blockPos()). then(argument("expr", StringArgumentType.string()). - then(argument("block", BlockStateArgumentType.create()). + then(argument("block", BlockStateArgumentType.blockState()). executes((cc) -> scriptFill( cc, BlockPosArgumentType.getBlockPos(cc, "origin"), @@ -163,7 +163,7 @@ public class ScriptCommand null, "solid" )). then(literal("replace"). - then(argument("filter", BlockPredicateArgumentType.create()) + then(argument("filter", BlockPredicateArgumentType.blockPredicate()) .executes((cc) -> scriptFill( cc, BlockPosArgumentType.getBlockPos(cc, "origin"), @@ -175,11 +175,11 @@ public class ScriptCommand "solid" ))))))))); LiteralArgumentBuilder t = literal("outline").requires((player) -> player.hasPermissionLevel(2)). - then(argument("origin", BlockPosArgumentType.create()). - then(argument("from", BlockPosArgumentType.create()). - then(argument("to", BlockPosArgumentType.create()). + then(argument("origin", BlockPosArgumentType.blockPos()). + then(argument("from", BlockPosArgumentType.blockPos()). + then(argument("to", BlockPosArgumentType.blockPos()). then(argument("expr", StringArgumentType.string()). - then(argument("block", BlockStateArgumentType.create()). + then(argument("block", BlockStateArgumentType.blockState()). executes((cc) -> scriptFill( cc, BlockPosArgumentType.getBlockPos(cc, "origin"), @@ -190,7 +190,7 @@ public class ScriptCommand null, "outline" )). then(literal("replace"). - then(argument("filter", BlockPredicateArgumentType.create()) + then(argument("filter", BlockPredicateArgumentType.blockPredicate()) .executes((cc) -> scriptFill( cc, BlockPosArgumentType.getBlockPos(cc, "origin"), diff --git a/src/main/java/carpet/commands/SpawnCommand.java b/src/main/java/carpet/commands/SpawnCommand.java index c1763fbd..d2282472 100644 --- a/src/main/java/carpet/commands/SpawnCommand.java +++ b/src/main/java/carpet/commands/SpawnCommand.java @@ -41,14 +41,14 @@ public class SpawnCommand literalargumentbuilder. then(literal("list"). - then(argument("pos", BlockPosArgumentType.create()). + then(argument("pos", BlockPosArgumentType.blockPos()). executes( (c) -> listSpawns(c.getSource(), BlockPosArgumentType.getBlockPos(c, "pos"))))). then(literal("tracking"). executes( (c) -> printTrackingReport(c.getSource())). then(literal("start"). executes( (c) -> startTracking(c.getSource(), null, null)). - then(argument("from", BlockPosArgumentType.create()). - then(argument("to", BlockPosArgumentType.create()). + then(argument("from", BlockPosArgumentType.blockPos()). + then(argument("to", BlockPosArgumentType.blockPos()). executes( (c) -> startTracking( c.getSource(), BlockPosArgumentType.getBlockPos(c, "from"), @@ -91,7 +91,7 @@ public class SpawnCommand then(literal("set"). then(argument("cap (hostile)", integer(1,1400)). executes( (c) -> setMobcaps(c.getSource(), getInteger(c, "cap (hostile)"))))). - then(argument("dimension", DimensionArgumentType.create()). + then(argument("dimension", DimensionArgumentType.dimension()). executes( (c)-> mobcapsForDimension(c.getSource(), DimensionArgumentType.getDimensionArgument(c, "dimension"))))). then(literal("entities"). executes( (c) -> generalMobcaps(c.getSource()) ). diff --git a/src/main/java/carpet/helpers/BlockRotator.java b/src/main/java/carpet/helpers/BlockRotator.java index 5b169389..4ac7b02d 100644 --- a/src/main/java/carpet/helpers/BlockRotator.java +++ b/src/main/java/carpet/helpers/BlockRotator.java @@ -196,36 +196,37 @@ public class BlockRotator BlockPos pos = hit.getBlockPos(); Vec3d hitVec = hit.getPos().subtract(pos.getX(), pos.getY(), pos.getZ()); Direction facing = hit.getSide(); + BlockState newState = null; if ( (block instanceof GlazedTerracottaBlock) || (block instanceof AbstractRedstoneGateBlock) || (block instanceof RailBlock) || (block instanceof TrapdoorBlock) || (block instanceof LeverBlock) || (block instanceof FenceGateBlock)) { - world.setBlockState(pos, state.rotate(BlockRotation.CLOCKWISE_90), 2 | 1024); + newState = state.rotate(BlockRotation.CLOCKWISE_90); } else if ((block instanceof ObserverBlock) || (block instanceof EndRodBlock)) { - world.setBlockState(pos, state.with(FacingBlock.FACING, (Direction) state.get(FacingBlock.FACING).getOpposite()), 2 | 1024); + newState = state.with(FacingBlock.FACING, (Direction) state.get(FacingBlock.FACING).getOpposite()); } else if (block instanceof DispenserBlock) { - world.setBlockState(pos, state.with(DispenserBlock.FACING, state.get(DispenserBlock.FACING).getOpposite()), 2 | 1024); + newState = state.with(DispenserBlock.FACING, state.get(DispenserBlock.FACING).getOpposite()); } else if (block instanceof PistonBlock) { if (!(state.get(PistonBlock.EXTENDED))) - world.setBlockState(pos, state.with(FacingBlock.FACING, state.get(FacingBlock.FACING).getOpposite()), 2 | 1024); + newState = state.with(FacingBlock.FACING, state.get(FacingBlock.FACING).getOpposite()); } else if (block instanceof SlabBlock) { if (((SlabBlock) block).hasSidedTransparency(state)) { - world.setBlockState(pos, state.with(SlabBlock.TYPE, state.get(SlabBlock.TYPE) == SlabType.TOP ? SlabType.BOTTOM : SlabType.TOP), 2 | 1024); + newState = state.with(SlabBlock.TYPE, state.get(SlabBlock.TYPE) == SlabType.TOP ? SlabType.BOTTOM : SlabType.TOP); } } else if (block instanceof HopperBlock) { if ((Direction)state.get(HopperBlock.FACING) != Direction.DOWN) { - world.setBlockState(pos, state.with(HopperBlock.FACING, state.get(HopperBlock.FACING).rotateYClockwise()), 2 | 1024); + newState = state.with(HopperBlock.FACING, state.get(HopperBlock.FACING).rotateYClockwise()); } } else if (block instanceof StairsBlock) @@ -233,7 +234,7 @@ public class BlockRotator //LOG.error(String.format("hit with facing: %s, at side %.1fX, X %.1fY, Y %.1fZ",facing, hitX, hitY, hitZ)); if ((facing == Direction.UP && hitVec.y == 1.0f) || (facing == Direction.DOWN && hitVec.y == 0.0f)) { - world.setBlockState(pos, state.with(StairsBlock.HALF, state.get(StairsBlock.HALF) == BlockHalf.TOP ? BlockHalf.BOTTOM : BlockHalf.TOP ), 2 | 1024); + newState = state.with(StairsBlock.HALF, state.get(StairsBlock.HALF) == BlockHalf.TOP ? BlockHalf.BOTTOM : BlockHalf.TOP ); } else { @@ -260,11 +261,11 @@ public class BlockRotator } if (turn_right) { - world.setBlockState(pos, state.rotate(BlockRotation.COUNTERCLOCKWISE_90), 2 | 1024); + newState = state.rotate(BlockRotation.COUNTERCLOCKWISE_90); } else { - world.setBlockState(pos, state.rotate(BlockRotation.CLOCKWISE_90), 2 | 1024); + newState = state.rotate(BlockRotation.CLOCKWISE_90); } } } @@ -272,8 +273,13 @@ public class BlockRotator { return false; } - world.scheduleBlockRender(pos); - return true; + if (newState != null) + { + world.setBlockState(pos, newState, 2 | 1024); + world.scheduleBlockRender(pos, state, newState); + return true; + } + return false; } private static boolean player_holds_cactus_mainhand(PlayerEntity playerIn) { diff --git a/src/main/java/carpet/mixins/InGameHudMixin.java b/src/main/java/carpet/mixins/InGameHudMixin.java index 3f2fb460..d2c70761 100644 --- a/src/main/java/carpet/mixins/InGameHudMixin.java +++ b/src/main/java/carpet/mixins/InGameHudMixin.java @@ -19,7 +19,7 @@ public abstract class InGameHudMixin @Shadow @Final private PlayerListHud playerListHud; - @Redirect(method = "draw", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isInSingleplayer()Z")) + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isInSingleplayer()Z")) private boolean onDraw(MinecraftClient minecraftClient) { return this.client.isInSingleplayer() && !((PlayerListHudInterface) playerListHud).hasFooterOrHeader(); diff --git a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java index 73c96434..d630ec48 100644 --- a/src/main/java/carpet/mixins/ServerWorld_tickMixin.java +++ b/src/main/java/carpet/mixins/ServerWorld_tickMixin.java @@ -71,7 +71,7 @@ public abstract class ServerWorld_tickMixin extends World @Inject(method = "tick", at = @At( value = "CONSTANT", - args = "stringValue=village" + args = "stringValue=raid" )) private void stopBlockStartVillageSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci) { @@ -153,15 +153,6 @@ public abstract class ServerWorld_tickMixin extends World return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES; } - @Redirect(method = "tick", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/village/ZombieSiegeManager;tick()V" - )) - private void tickConditionally(ZombieSiegeManager zombieSiegeManager) - { - if (TickSpeed.process_entities) zombieSiegeManager.tick(); - } - @Redirect(method = "tick", at = @At( value = "INVOKE", target = "Lnet/minecraft/entity/raid/RaidManager;tick()V" diff --git a/src/main/java/carpet/mixins/World_movableTEMixin.java b/src/main/java/carpet/mixins/World_movableTEMixin.java index 2952d4e5..8fa1bbff 100644 --- a/src/main/java/carpet/mixins/World_movableTEMixin.java +++ b/src/main/java/carpet/mixins/World_movableTEMixin.java @@ -43,7 +43,7 @@ public abstract class World_movableTEMixin implements WorldInterface public abstract ChunkManager getChunkManager(); @Shadow - public abstract void scheduleBlockRender(BlockPos blockPos_1); + public abstract void scheduleBlockRender(BlockPos blockPos_1, BlockState s1, BlockState s2); @Shadow public abstract void updateListeners(BlockPos var1, BlockState var2, BlockState var3, int var4); @@ -103,7 +103,7 @@ public abstract class World_movableTEMixin implements WorldInterface { if (blockState_2 != blockState_3) { - this.scheduleBlockRender(blockPos_1); + this.scheduleBlockRender(blockPos_1, blockState_2, blockState_3); } if ((int_1 & 2) != 0 && (!this.isClient || (int_1 & 4) == 0) && (this.isClient || worldChunk_1.getLevelType() != null && worldChunk_1.getLevelType().isAfter(ChunkHolder.LevelType.TICKING))) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index c9eeb038..29b5ad6f 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -55,7 +55,7 @@ import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import net.minecraft.util.math.EulerRotation; +import net.minecraft.util.math.EulerAngle; import net.minecraft.util.math.Vec3d; import net.minecraft.util.registry.Registry; import net.minecraft.world.Heightmap; @@ -2359,7 +2359,7 @@ public class CarpetExpression armorstand.setCustomName(new LiteralText(name)); armorstand.setCustomNameVisible(true); } - armorstand.setHeadRotation(new EulerRotation((int)pointLocator.pitch,0,0)); + armorstand.setHeadRotation(new EulerAngle((int)pointLocator.pitch,0,0)); armorstand.setNoGravity(true); armorstand.setInvisible(true); armorstand.setInvulnerable(true); diff --git a/src/main/java/carpet/script/value/BlockValue.java b/src/main/java/carpet/script/value/BlockValue.java index 5d3ec2a8..8473a460 100644 --- a/src/main/java/carpet/script/value/BlockValue.java +++ b/src/main/java/carpet/script/value/BlockValue.java @@ -380,7 +380,7 @@ public class BlockValue extends Value @Override public Direction getPlayerFacing() { - return this.facing.getAxis() == Direction.Axis.Y ? Direction.NORTH : this.facing; + return this.facing.getAxis() == Direction.Axis.field_11052 ? Direction.NORTH : this.facing; } @Override diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 9845e712..2b73e5fa 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -315,7 +315,7 @@ public class EntityValue extends Value NbtPathArgumentType.NbtPath path; try { - path = NbtPathArgumentType.create().method_9362(new StringReader(a.getString())); + path = NbtPathArgumentType.nbtPath().method_9362(new StringReader(a.getString())); } catch (CommandSyntaxException exc) {