Skip to content

Commit c58cba3

Browse files
authored
Port blockstate validation patch (#13786)
1 parent 0c79f00 commit c58cba3

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

paper-server/patches/sources/net/minecraft/world/level/block/ComparatorBlock.java.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
--- a/net/minecraft/world/level/block/ComparatorBlock.java
22
+++ b/net/minecraft/world/level/block/ComparatorBlock.java
3+
@@ -137,7 +_,7 @@
4+
float pitch = state.getValue(MODE) == ComparatorMode.SUBTRACT ? 0.55F : 0.5F;
5+
level.playSound(player, pos, SoundEvents.COMPARATOR_CLICK, SoundSource.BLOCKS, 0.3F, pitch);
6+
level.setBlock(pos, state, Block.UPDATE_CLIENTS);
7+
- this.refreshOutputState(level, pos, state);
8+
+ if (level.getBlockState(pos).is(this)) { this.refreshOutputState(level, pos, state); } // Paper - Fix blockstate validation issues
9+
return InteractionResult.SUCCESS;
10+
}
11+
}
312
@@ -168,8 +_,18 @@
413
boolean sourceOn = this.shouldTurnOn(level, pos, state);
514
boolean isOn = state.getValue(POWERED);

paper-server/patches/sources/net/minecraft/world/level/block/DiodeBlock.java.patch

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@
1919
level.setBlock(pos, state.setValue(POWERED, true), Block.UPDATE_CLIENTS);
2020
if (!shouldTurnOn) {
2121
level.scheduleTick(pos, this, this.getDelay(state), TickPriority.VERY_HIGH);
22+
@@ -85,6 +_,7 @@
23+
protected void neighborChanged(
24+
final BlockState state, final Level level, final BlockPos pos, final Block block, final @Nullable Orientation orientation, final boolean movedByPiston
25+
) {
26+
+ if (!level.getBlockState(pos).is(this)) return; // Paper - Fix blockstate validation issues
27+
if (state.canSurvive(level, pos)) {
28+
this.checkTickOnNeighbor(level, pos, state);
29+
} else {

0 commit comments

Comments
 (0)