9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-23 08:59:23 +00:00
Files
Leaf/patches/server/0015-Remove-Paper-s-Fix-tripwire-dupe.patch
2023-07-25 07:35:13 +08:00

79 lines
4.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sun, 6 Nov 2022 04:32:27 -0500
Subject: [PATCH] Remove Paper's Fix tripwire dupe
Revert Paper's Fix tripwire state inconsistency patches:
Fix-tripwire-state-inconsistency.patch
Validate-tripwire-hook-placement-before-update.patch
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 cb2ff8d94308c637a498d2737f86f6af4c9c1b83..89d3a2b1089a12d623431af9ae39631d5efa881f 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -78,7 +78,7 @@ public class TripWireBlock extends Block {
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
if (!moved && !state.is(newState.getBlock())) {
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
}
}
@@ -94,13 +94,6 @@ public class TripWireBlock extends Block {
}
private void updateSource(Level world, BlockPos pos, BlockState state) {
- if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
- // Paper start - fix state inconsistency
- this.updateSource(world, pos, state, false);
- }
-
- private void updateSource(Level world, BlockPos pos, BlockState state, boolean beingRemoved) {
- // Paper end
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
int i = aenumdirection.length;
int j = 0;
@@ -116,7 +109,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, beingRemoved); // Paper - fix state inconsistency
+ this.hook.calculateState(world, blockposition1, iblockdata1, false, true, k, state);
}
} 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 004dce26ff073f1de52a84cd425c4f60fdab5e50..a5f8c7d9d9998eebce7f15e01c157651b9831516 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -108,12 +108,6 @@ 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);
@@ -147,7 +141,6 @@ public class TripWireHookBlock extends Block {
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);
flag5 |= flag6 && flag7;
- if (k != i || !tripWireBeingRemoved || !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);
@@ -182,7 +175,6 @@ public class TripWireHookBlock extends Block {
this.emitState(world, pos, flag4, flag5, flag2, flag3);
if (!beingRemoved) {
- if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
if (flag1) {
this.notifyNeighbors(world, pos, enumdirection);