diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index a90c6b2..ee6b1cb 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -14,3 +14,5 @@ minecraft net.minecraft.world.item.ItemNameBlockItem minecraft net.minecraft.world.level.block.FallingBlock minecraft net.minecraft.world.level.block.piston.MovingPistonBlock minecraft net.minecraft.world.level.block.piston.PistonHeadBlock +minecraft net.minecraft.world.level.block.LadderBlock +minecraft net.minecraft.world.level.block.Blocks \ No newline at end of file diff --git a/patches/server/0003-MC-Dev-Fixes.patch b/patches/server/0003-MC-Dev-Fixes.patch index f3117dd..2d17a16 100644 --- a/patches/server/0003-MC-Dev-Fixes.patch +++ b/patches/server/0003-MC-Dev-Fixes.patch @@ -39,3 +39,16 @@ index 50a9f33aa31e9273c7c52d4bb2b02f0f884f7ba5..5fb7573022c5af775b2e737dcd05c53c } } +diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java +index 9a2de546dc2af2ad4bf5d32ca6583f0e1f3f70d8..1e97f781c8cf1bc182bd802bbed1c19077d23bcd 100644 +--- a/src/main/java/net/minecraft/world/level/block/Blocks.java ++++ b/src/main/java/net/minecraft/world/level/block/Blocks.java +@@ -1215,7 +1215,7 @@ public class Blocks { + } + + private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType type) { +- return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT; ++ return type == EntityType.OCELOT || type == EntityType.PARROT; // Sakura - decompile fix + } + + private static Block bed(DyeColor color) { diff --git a/patches/server/0040-Configure-cannon-physics-by-version.patch b/patches/server/0040-Configure-cannon-physics-by-version.patch index 85baa1a..232c6fb 100644 --- a/patches/server/0040-Configure-cannon-physics-by-version.patch +++ b/patches/server/0040-Configure-cannon-physics-by-version.patch @@ -770,6 +770,71 @@ index 1079a99d6a6c9fba36414a863e1454bb2a7f298a..4ee105548df2a730f192d4b511a399d1 @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (isFree(world.getBlockState(pos.below())) && pos.getY() >= world.getMinBuildHeight()) { +diff --git a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java +index 6524272aab5a876e2a2164181da72c765959b550..4c242b501e7e5c7af6676b9554b00405838c4eb0 100644 +--- a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java +@@ -180,8 +180,13 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { + } + // CraftBukkit end + +- if ((Boolean) state.getValue(FenceGateBlock.POWERED) != flag1) { +- world.setBlock(pos, (BlockState) ((BlockState) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, flag1), 2); ++ // Sakura start ++ final boolean legacy = world.localConfig().config(pos).physicsVersion.before(1_11_0); ++ final boolean powered = state.getValue(FenceGateBlock.POWERED); ++ if (legacy ? (flag1 || sourceBlock.defaultBlockState().isSignalSource()) : powered != flag1) { ++ final boolean openGate = legacy && (flag1 == powered || state.getValue(FenceGateBlock.OPEN) != powered) ? state.getValue(OPEN) : flag1; ++ world.setBlock(pos, (BlockState) ((BlockState) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, openGate), 2); ++ // Sakura end + if ((Boolean) state.getValue(FenceGateBlock.OPEN) != flag1) { + world.playSound((Player) null, pos, flag1 ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.1F + 0.9F); + world.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); +diff --git a/src/main/java/net/minecraft/world/level/block/LadderBlock.java b/src/main/java/net/minecraft/world/level/block/LadderBlock.java +index de87b54895d5a63d32c1734ccdac63246c9f2c5f..79bced0e284430d57d4a7ec80a57d717249e7e36 100644 +--- a/src/main/java/net/minecraft/world/level/block/LadderBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/LadderBlock.java +@@ -28,6 +28,21 @@ public class LadderBlock extends Block implements SimpleWaterloggedBlock { + protected static final VoxelShape WEST_AABB = Block.box(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); + protected static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D); + protected static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D); ++ // Sakura start ++ protected static final VoxelShape LEGACY_EAST_AABB = Block.box(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 16.0D); ++ protected static final VoxelShape LEGACY_WEST_AABB = Block.box(14.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); ++ protected static final VoxelShape LEGACY_SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 2.0D); ++ protected static final VoxelShape LEGACY_NORTH_AABB = Block.box(0.0D, 0.0D, 14.0D, 16.0D, 16.0D, 16.0D); ++ ++ private static VoxelShape legacyShape(Direction facing) { ++ return switch (facing) { ++ case NORTH -> LEGACY_NORTH_AABB; ++ case SOUTH -> LEGACY_SOUTH_AABB; ++ case WEST -> LEGACY_WEST_AABB; ++ default -> LEGACY_EAST_AABB; ++ }; ++ } ++ // Sakura end + + @Override + public MapCodec codec() { +@@ -39,8 +54,18 @@ public class LadderBlock extends Block implements SimpleWaterloggedBlock { + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, Boolean.valueOf(false))); + } + ++ // Sakura start ++ @Override ++ public final boolean hasDynamicShape() { ++ return true; ++ } ++ + @Override + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { ++ if (world instanceof net.minecraft.world.level.Level level && level.localConfig().config(pos).physicsVersion.before(1_9_0)) { ++ return legacyShape(state.getValue(FACING)); ++ } ++ // Sakura end + switch ((Direction)state.getValue(FACING)) { + case NORTH: + return NORTH_AABB; diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java index 2bd097203f1e92d3fc343f91dc37220e09dd5066..2fe44dae063eb0cd7d4813fb6b2937830d432e51 100644 --- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java @@ -803,6 +868,52 @@ index 2bd097203f1e92d3fc343f91dc37220e09dd5066..2fe44dae063eb0cd7d4813fb6b293783 // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, pos, block.defaultBlockState())) { this.fizz(world, pos); +diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +index 82bde0e37971e806b19d17fbf48c663c82399739..570694ba570135542d4184ac9d03f29132b28df8 100644 +--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +@@ -685,6 +685,10 @@ public class RedStoneWireBlock extends Block { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if (!player.getAbilities().mayBuild) { + return InteractionResult.PASS; ++ // Sakura start ++ } else if (world.localConfig().config(pos).physicsVersion.before(1_16_0)) { ++ return InteractionResult.PASS; ++ // Sakura end + } else { + if (RedStoneWireBlock.isCross(state) || RedStoneWireBlock.isDot(state)) { + BlockState iblockdata1 = RedStoneWireBlock.isCross(state) ? this.defaultBlockState() : this.crossState; +diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java +index b6105d178778b326c11b7d29c5e4d8aa2c3a3875..7ff78fb671dc2791378802cda89c358eda15f2ae 100644 +--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java +@@ -21,6 +21,7 @@ public class WaterlilyBlock extends BushBlock { + + public static final MapCodec CODEC = simpleCodec(WaterlilyBlock::new); + protected static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D); ++ protected static final VoxelShape LEGACY_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 0.25D, 16.0D); // Sakura + + @Override + public MapCodec codec() { +@@ -46,8 +47,18 @@ public class WaterlilyBlock extends BushBlock { + + } + ++ // Sakura start ++ @Override ++ public final boolean hasDynamicShape() { ++ return true; ++ } ++ + @Override + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { ++ if (world instanceof net.minecraft.world.level.Level level && level.localConfig().config(pos).physicsVersion.before(1_9_0)) { ++ return LEGACY_AABB; ++ } ++ // Sakura end + return WaterlilyBlock.AABB; + } + diff --git a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java index d3d1ad7901411574b85b0febd1c7ddaa8ad7c9f4..cc2c601032b2a2d94aa74cc3ad7169c202b354ab 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java