mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
PaperPR - Fix piston physics inconsistency
This commit is contained in:
@@ -1 +1 @@
|
||||
1.15.2--dc22d81897d4817ea11861a54cf32ced1c5c942c
|
||||
1.15.2--b6540df4044681cbe619f073205a24aa8633c00a
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From 8a8266685fcae04ff147307be88cb5a79083572e Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Thu, 11 Jun 2020 17:29:42 -0700
|
||||
Subject: [PATCH] PaperPR - Fix piston physics inconsistency
|
||||
|
||||
Pistons invoke physics when they move blocks. The physics can cause
|
||||
tnt blocks to ignite. However, pistons (when storing the blocks they "moved")
|
||||
don't actually go back to the world state sometimes to check if something
|
||||
like that happened. As a result they end up moving the tnt like it was
|
||||
never ignited. This resulted in the ability to create machines
|
||||
that can duplicate tnt, called "world eaters".
|
||||
This patch makes the piston logic retrieve the block state from the world
|
||||
prevent this from occuring.
|
||||
|
||||
Tested against the following tnt duper design:
|
||||
https://www.youtube.com/watch?v=mS7xxNGhjxs
|
||||
|
||||
This patch also affects every type of machine that utilises
|
||||
this mechanic. For example, dead coral is removed by a physics
|
||||
update when being moved while it is attached to slimeblocks.
|
||||
|
||||
Standard piston machines that don't destroy or modify the
|
||||
blocks they move by physics updates should be entirely
|
||||
unaffected.
|
||||
---
|
||||
src/main/java/net/minecraft/server/BlockPiston.java | 4 ++--
|
||||
src/main/java/net/minecraft/server/TileEntityPiston.java | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
index 1e72b3bbc5..fbcc016941 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
@@ -374,11 +374,11 @@ public class BlockPiston extends BlockDirectional {
|
||||
|
||||
for (k = list.size() - 1; k >= 0; --k) {
|
||||
blockposition3 = (BlockPosition) list.get(k);
|
||||
- iblockdata1 = world.getType(blockposition3);
|
||||
+ iblockdata1 = world.getType(blockposition3); map.replace(blockposition3, iblockdata1); // Purpur - fix piston physics inconsistency
|
||||
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));
|
||||
+ world.setTileEntity(blockposition3, BlockPistonMoving.a(iblockdata1, enumdirection, flag, false)); // Purpur - fix piston physics inconsistency
|
||||
--j;
|
||||
aiblockdata[j] = iblockdata1;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java
|
||||
index 79df42f5e5..00608d09b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityPiston.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java
|
||||
@@ -137,7 +137,7 @@ public class TileEntityPiston extends TileEntity implements ITickable {
|
||||
private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) {
|
||||
TileEntityPiston.h.set(enumdirection);
|
||||
entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ()));
|
||||
- TileEntityPiston.h.set((Object) null);
|
||||
+ TileEntityPiston.h.set(null); // Purpur - decompile error
|
||||
}
|
||||
|
||||
private void g(float f) {
|
||||
@@ -275,7 +275,7 @@ public class TileEntityPiston extends TileEntity implements ITickable {
|
||||
IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position);
|
||||
|
||||
if (iblockdata.isAir()) {
|
||||
- this.world.setTypeAndData(this.position, this.a, 84);
|
||||
+ this.world.setTypeAndData(this.position, this.a, 84 | 2); // Purpur - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air
|
||||
Block.a(this.a, iblockdata, this.world, this.position, 3);
|
||||
} else {
|
||||
if (iblockdata.b((IBlockState) BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C)) {
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 0c7c76793aed4ba8f6fc011dd1c6911a62b660cb Mon Sep 17 00:00:00 2001
|
||||
From a3f8ec0d266ba76257ec9c88ef6123fdfb6fcc2d Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
Date: Fri, 3 Apr 2020 02:21:13 -0700
|
||||
Subject: [PATCH] Tuinity - Always able to execute tasks on the main server
|
||||
@@ -12,7 +12,7 @@ chunks.
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 13a3fab573..565e3b72bb 100644
|
||||
index 8f4668a3bd..9cf8e1918f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1113,7 +1113,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1,4 +1,4 @@
|
||||
From 3686071d088263fab9c911084f54ff1b75b2702a Mon Sep 17 00:00:00 2001
|
||||
From e991caa8684ce34b54eb1484a9725236ef169459 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 5 Mar 2020 23:08:01 +0100
|
||||
Subject: [PATCH] YAPFA - Disable mojang profiler
|
||||
@@ -43,7 +43,7 @@ index f0d72ea39d..e38a684060 100644
|
||||
throw CommandDebug.b.create();
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 565e3b72bb..d1c92c6984 100644
|
||||
index 9cf8e1918f..37a6a8002e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -80,7 +80,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
Reference in New Issue
Block a user