Fix the piston duplication option when it is on

This commit is contained in:
Spottedleaf 2020-06-26 14:36:48 -07:00
parent 368fc7c8c0
commit 4fd1bd8aee

View File

@ -46,7 +46,7 @@ index 06adb1fa670e7d755560abae67d46447d63370f0..3b0f3127bcee8e9290b4640bcd4ec0d1
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 6b1253fe7e8d4bb71d4d19c063d3e84c167c4d7b..0fb6debc0cd5f522614f32f3df1b5f37a415a0f5 100644
index 6b1253fe7e8d4bb71d4d19c063d3e84c167c4d7b..c3133814f1349b2f70b12967b1b5abc88f71f98c 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -368,12 +368,24 @@ public class BlockPiston extends BlockDirectional {
@ -63,12 +63,13 @@ index 6b1253fe7e8d4bb71d4d19c063d3e84c167c4d7b..0fb6debc0cd5f522614f32f3df1b5f37
blockposition3 = blockposition3.shift(enumdirection1);
map.remove(blockposition3);
world.setTypeAndData(blockposition3, (IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPiston.FACING, enumdirection), 68);
- world.setTileEntity(blockposition3, BlockPistonMoving.a((IBlockData) list1.get(k), enumdirection, flag, false));
+ // Paper start - fix a variety of piston desync dupes
+ if (!allowDesync) {
+ iblockdata1 = world.getType(oldPos);
+ map.replace(oldPos, iblockdata1);
+ }
world.setTileEntity(blockposition3, BlockPistonMoving.a((IBlockData) list1.get(k), enumdirection, flag, false));
+ world.setTileEntity(blockposition3, BlockPistonMoving.a(allowDesync ? list1.get(k) : iblockdata1, enumdirection, flag, false));
+ if (!allowDesync) {
+ world.setTypeAndData(oldPos, Blocks.AIR.getBlockData(), 2 | 4 | 16 | 1024); // set air to prevent later physics updates from seeing this block
+ }