Skip to content

Commit 6178609

Browse files
committed
Fix tripwire state inconsistency
1 parent 8c5be16 commit 6178609

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Nassim Jahnke <jahnke.nassim@gmail.com>
3+
Date: Sun, 19 Dec 2021 21:11:20 +0100
4+
Subject: [PATCH] Fix tripwire state inconsistency
5+
6+
7+
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
8+
index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..335129abd06086d128f803bb488672b35f357389 100644
9+
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
10+
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
11+
@@ -74,7 +74,7 @@ public class TripWireBlock extends Block {
12+
@Override
13+
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
14+
if (!moved && !state.is(newState.getBlock())) {
15+
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
16+
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency
17+
}
18+
}
19+
20+
@@ -89,6 +89,12 @@ public class TripWireBlock extends Block {
21+
}
22+
23+
private void updateSource(Level world, BlockPos pos, BlockState state) {
24+
+ // Paper start - fix state inconsistency
25+
+ this.updateSource(world, pos, state, false);
26+
+ }
27+
+
28+
+ private void updateSource(Level world, BlockPos pos, BlockState state, boolean beingRemoved) {
29+
+ // Paper end
30+
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
31+
int i = aenumdirection.length;
32+
int j = 0;
33+
@@ -104,7 +110,11 @@ public class TripWireBlock extends Block {
34+
35+
if (iblockdata1.is((Block) this.hook)) {
36+
if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) {
37+
- this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state);
38+
+ // Paper - fix state inconsistency
39+
+ final int distance = beingRemoved ? -1 : k;
40+
+ final BlockState self = beingRemoved ? null : state;
41+
+ this.hook.calculateState(world, blockposition1, iblockdata1, false, true, distance, self);
42+
+ // Paper end
43+
}
44+
} else if (iblockdata1.is((Block) this)) {
45+
++k;

0 commit comments

Comments
 (0)