mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
parent
79dd62ae62
commit
d0b8b1e972
1 changed files with 29 additions and 7 deletions
|
@ -3,9 +3,10 @@ From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
|||
Date: Sun, 19 Dec 2021 21:11:20 +0100
|
||||
Subject: [PATCH] Fix tripwire state inconsistency
|
||||
|
||||
This patch prevents updating and re-setting the tripwire when being removed in certain conditions
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..335129abd06086d128f803bb488672b35f357389 100644
|
||||
index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..7d89b9ed84209c161b2c6fec5304abbbf41f2e80 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
@@ -74,7 +74,7 @@ public class TripWireBlock extends Block {
|
||||
|
@ -30,16 +31,37 @@ index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..335129abd06086d128f803bb488672b3
|
|||
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
|
||||
int i = aenumdirection.length;
|
||||
int j = 0;
|
||||
@@ -104,7 +110,11 @@ public class TripWireBlock extends Block {
|
||||
@@ -104,7 +110,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
if (iblockdata1.is((Block) this.hook)) {
|
||||
if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) {
|
||||
- this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state);
|
||||
+ // Paper - fix state inconsistency
|
||||
+ final int distance = beingRemoved ? -1 : k;
|
||||
+ final BlockState self = beingRemoved ? null : state;
|
||||
+ this.hook.calculateState(world, blockposition1, iblockdata1, false, true, distance, self);
|
||||
+ // Paper end
|
||||
+ this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state, beingRemoved); // Paper - fix state inconsistency
|
||||
}
|
||||
} else if (iblockdata1.is((Block) this)) {
|
||||
++k;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 02a3e1ced592784b9c66927c76376c7ab413367d..30b2497d9596c6d8e240d0231adaad7e4873ff7a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -107,6 +107,12 @@ public class TripWireHookBlock extends Block {
|
||||
}
|
||||
|
||||
public void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) {
|
||||
+ // Paper start - fix tripwire inconsistency
|
||||
+ this.calculateState(world, pos, state, beingRemoved, flag1, i, iblockdata1, false);
|
||||
+ }
|
||||
+
|
||||
+ public void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1, boolean tripWireBeingRemoved) {
|
||||
+ // Paper end
|
||||
Direction enumdirection = (Direction) state.getValue(TripWireHookBlock.FACING);
|
||||
boolean flag2 = (Boolean) state.getValue(TripWireHookBlock.ATTACHED);
|
||||
boolean flag3 = (Boolean) state.getValue(TripWireHookBlock.POWERED);
|
||||
@@ -140,6 +146,7 @@ public class TripWireHookBlock extends Block {
|
||||
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);
|
||||
|
||||
flag5 |= flag6 && flag7;
|
||||
+ if (!tripWireBeingRemoved || (k == i && !flag6)) // Paper - don't update the tripwire again if being removed and not disarmed
|
||||
aiblockdata[k] = iblockdata2;
|
||||
if (k == i) {
|
||||
world.scheduleTick(pos, (Block) this, 10);
|
||||
|
|
Loading…
Reference in a new issue