mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
e035fd7034
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities f23325b6 Add API for per-world simulation distances 26e1774e Add API for per-world view distances 0b541e60 Add PlayerLoginEvent#getRealAddress 5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types CraftBukkit Changes: bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs 7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst 752aac669 Implement APIs for per world view and simulation distances 57d7ef433 Preserve empty enchantment tags for glow effect 465ec3fb4 Remove connected check on setScoreboard f90ce621e Use one PermissibleBase for all command blocks 5876cca44 SPIGOT-7550: Fix creation of Arrow instances f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition 9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item Spigot Changes: ed9ba9a4 Drop no longer required patch ignoring -o option 86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message aa7cde7a Remove obsolete APIs for per world view and simulation distances 6dff577e Remove obsolete patch preserving empty `ench` tags a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress 1b02f5d6 Remove obsolete connected check on setScoreboard patch acf717eb Remove obsolete command block PermissibleBase patch 053fa2a9 Remove redundant patch dealing with null tile entities
88 lines
5.2 KiB
Diff
88 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
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 bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b3684c21946 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
@@ -87,7 +87,7 @@ public class TripWireBlock extends Block {
|
|
@Override
|
|
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
|
if (!moved && !state.is(newState.getBlock())) {
|
|
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
|
|
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency
|
|
}
|
|
}
|
|
|
|
@@ -102,6 +102,12 @@ public class TripWireBlock extends Block {
|
|
}
|
|
|
|
private void updateSource(Level world, BlockPos pos, BlockState state) {
|
|
+ // 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;
|
|
@@ -117,7 +123,7 @@ public class TripWireBlock extends Block {
|
|
|
|
if (iblockdata1.is(this.hook)) {
|
|
if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) {
|
|
- TripWireHookBlock.calculateState(world, blockposition1, iblockdata1, false, true, k, state);
|
|
+ TripWireHookBlock.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 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134cf25c282a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
|
@@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block {
|
|
TripWireHookBlock.calculateState(world, pos, state, false, false, -1, (BlockState) null);
|
|
}
|
|
|
|
- public static void calculateState(Level world, BlockPos pos, BlockState state, boolean flag, boolean flag1, int i, @Nullable BlockState iblockdata1) {
|
|
+ public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) {
|
|
+ // Paper start - fix tripwire inconsistency
|
|
+ calculateState(world, pos, state, beingRemoved, flag1, i, iblockdata1, false);
|
|
+ }
|
|
+
|
|
+ public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1, boolean tripWireBeingRemoved) {
|
|
+ // Paper end
|
|
Optional<Direction> optional = state.getOptionalValue(TripWireHookBlock.FACING);
|
|
|
|
if (optional.isPresent()) {
|
|
@@ -126,7 +132,7 @@ public class TripWireHookBlock extends Block {
|
|
boolean flag2 = (Boolean) state.getOptionalValue(TripWireHookBlock.ATTACHED).orElse(false);
|
|
boolean flag3 = (Boolean) state.getOptionalValue(TripWireHookBlock.POWERED).orElse(false);
|
|
Block block = state.getBlock();
|
|
- boolean flag4 = !flag;
|
|
+ boolean flag4 = !beingRemoved; // Paper
|
|
boolean flag5 = false;
|
|
int j = 0;
|
|
BlockState[] aiblockdata = new BlockState[42];
|
|
@@ -156,6 +162,7 @@ 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, 10);
|
|
@@ -187,7 +194,7 @@ public class TripWireHookBlock extends Block {
|
|
// CraftBukkit end
|
|
|
|
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
|
|
- if (!flag) {
|
|
+ if (!beingRemoved) { // Paper
|
|
if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate
|
|
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
|
|
if (flag1) {
|