aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2020-06-20 14:53:15 -0400
committerAikar <[email protected]>2020-06-20 14:54:17 -0400
commit3e75d908100814a2d6ce0bf94fecf0d4eda5a22b (patch)
tree0fa69a3288dbdb8ba0eec6af8d8a3f02329ba4fc
parent01ce3cb0a5ddf7ddf98b081c21247203513e8d9c (diff)
downloadPaper-3e75d908100814a2d6ce0bf94fecf0d4eda5a22b.tar.gz
Paper-3e75d908100814a2d6ce0bf94fecf0d4eda5a22b.zip
Fix more cases of Bedrock breaking
This is still covered under the setting to re-enable this.
-rw-r--r--Spigot-Server-Patches/0520-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch53
-rw-r--r--Spigot-Server-Patches/0537-Optimize-Light-Engine.patch4
2 files changed, 50 insertions, 7 deletions
diff --git a/Spigot-Server-Patches/0520-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/0520-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
index 77e6d37759..6952b8854c 100644
--- a/Spigot-Server-Patches/0520-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
+++ b/Spigot-Server-Patches/0520-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
@@ -28,10 +28,10 @@ index 3ee7e5671dd2519cec72b81211f1f39176a228ba..cf9b9de8688e3f655631451409096d7e
+
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
-index e40375b67a4a321048c87002a07fde5c5d2395db..d051a54aa04326f84e211cd68ddd2bb209230770 100644
+index e40375b67a4a321048c87002a07fde5c5d2395db..d2207a2c95690de586ab2d181b64955a6d2ea70d 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
-@@ -32,6 +32,13 @@ public class Block implements IMaterial {
+@@ -32,6 +32,14 @@ public class Block implements IMaterial {
protected final SoundEffectType stepSound;
protected final Material material;
// Paper start
@@ -40,12 +40,13 @@ index e40375b67a4a321048c87002a07fde5c5d2395db..d051a54aa04326f84e211cd68ddd2bb2
+ this != Blocks.BEDROCK &&
+ this != Blocks.END_PORTAL_FRAME &&
+ this != Blocks.END_PORTAL &&
-+ this != Blocks.END_GATEWAY;
++ this != Blocks.END_GATEWAY &&
++ this != Blocks.MOVING_PISTON; // try to prevent creation of headless pistons
+ }
public co.aikar.timings.Timing timing;
public co.aikar.timings.Timing getTiming() {
if (timing == null) {
-@@ -276,7 +283,7 @@ public class Block implements IMaterial {
+@@ -276,7 +284,7 @@ public class Block implements IMaterial {
@Deprecated
public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) {
@@ -54,7 +55,7 @@ index e40375b67a4a321048c87002a07fde5c5d2395db..d051a54aa04326f84e211cd68ddd2bb2
}
@Deprecated
-@@ -596,7 +603,7 @@ public class Block implements IMaterial {
+@@ -596,7 +604,7 @@ public class Block implements IMaterial {
@Deprecated
public EnumPistonReaction getPushReaction(IBlockData iblockdata) {
@@ -63,6 +64,48 @@ index e40375b67a4a321048c87002a07fde5c5d2395db..d051a54aa04326f84e211cd68ddd2bb2
}
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
+diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
+index b29525c40dc8e3ae747b8ddf5a3bd79b7cc0b792..39cd8ab5925ceb9494e0ac910c73338c24ecda2c 100644
+--- a/src/main/java/net/minecraft/server/BlockPiston.java
++++ b/src/main/java/net/minecraft/server/BlockPiston.java
+@@ -175,6 +175,12 @@ public class BlockPiston extends BlockDirectional {
+ @Override
+ public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, int i, int j) {
+ EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING);
++ // Paper start - prevent retracting when we're facing the wrong way (we were replaced before retraction could occur)
++ EnumDirection directionQueuedAs = EnumDirection.fromType1(j & 7); // Paper - copied from below
++ if (!com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits && enumdirection != directionQueuedAs) {
++ return false;
++ }
++ // Paper end - prevent retracting when we're facing the wrong way
+
+ if (!world.isClientSide) {
+ boolean flag = this.a(world, blockposition, enumdirection);
+@@ -204,7 +210,7 @@ public class BlockPiston extends BlockDirectional {
+ }
+
+ world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPistonMoving.a, enumdirection)).set(BlockPistonMoving.b, this.sticky ? BlockPropertyPistonType.STICKY : BlockPropertyPistonType.DEFAULT), 3);
+- world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true));
++ world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); // Paper - diff on change, j is facing direction
+ if (this.sticky) {
+ BlockPosition blockposition1 = blockposition.b(enumdirection.getAdjacentX() * 2, enumdirection.getAdjacentY() * 2, enumdirection.getAdjacentZ() * 2);
+ IBlockData iblockdata1 = world.getType(blockposition1);
+@@ -232,7 +238,14 @@ public class BlockPiston extends BlockDirectional {
+ }
+ }
+ } else {
+- world.a(blockposition.shift(enumdirection), false);
++ // Paper start - fix headless pistons breaking blocks
++ BlockPosition headPos = blockposition.shift(enumdirection);
++ if (com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || world.getType(headPos) == Blocks.PISTON_HEAD.getBlockData().set(FACING, enumdirection)) { // double check to make sure we're not a headless piston.
++ world.setAir(headPos, false);
++ } else {
++ ((WorldServer)world).getChunkProvider().flagDirty(headPos); // ... fix client desync
++ }
++ // Paper end - fix headless pistons breaking blocks
+ }
+
+ world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index a353f3d5fa5a5f54335f73584589de3f5cb20d3e..2552f860ff7a25f74e9a0600e58cefe064fac484 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
diff --git a/Spigot-Server-Patches/0537-Optimize-Light-Engine.patch b/Spigot-Server-Patches/0537-Optimize-Light-Engine.patch
index 9894648b2d..0f10d61979 100644
--- a/Spigot-Server-Patches/0537-Optimize-Light-Engine.patch
+++ b/Spigot-Server-Patches/0537-Optimize-Light-Engine.patch
@@ -25,10 +25,10 @@ Massive update to light to improve performance and chunk loading/generation.
8) Fix NPE risk that crashes server in getting nibble data
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
-index d051a54aa04326f84e211cd68ddd2bb209230770..bd7a92599b4182739aafef9eeaaf8665d2f9f954 100644
+index d2207a2c95690de586ab2d181b64955a6d2ea70d..66244a9d0e253b3709df4ae2adcd21e44ebbfc90 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
-@@ -309,7 +309,7 @@ public class Block implements IMaterial {
+@@ -310,7 +310,7 @@ public class Block implements IMaterial {
return false;
}