Skip to content

Commit f845886

Browse files
committed
Fix blockstate validation issues
1 parent bd74bf6 commit f845886

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
3+
Date: Wed, 8 Apr 2026 18:25:47 -0400
4+
Subject: [PATCH] Fix Comparator State Issues
5+
6+
7+
diff --git a/net/minecraft/world/level/block/ComparatorBlock.java b/net/minecraft/world/level/block/ComparatorBlock.java
8+
index 578e7c8dc601f53cf2a068685c6901bfaf47e763..7e87d56cd42f27c115b575b9acf2ce9ac0953af8 100644
9+
--- a/net/minecraft/world/level/block/ComparatorBlock.java
10+
+++ b/net/minecraft/world/level/block/ComparatorBlock.java
11+
@@ -136,7 +136,7 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock {
12+
float f = state.getValue(MODE) == ComparatorMode.SUBTRACT ? 0.55F : 0.5F;
13+
level.playSound(player, pos, SoundEvents.COMPARATOR_CLICK, SoundSource.BLOCKS, 0.3F, f);
14+
level.setBlock(pos, state, Block.UPDATE_CLIENTS);
15+
- this.refreshOutputState(level, pos, state);
16+
+ if (level.getBlockState(pos).is(this)) { this.refreshOutputState(level, pos, state); } // Paper
17+
return InteractionResult.SUCCESS;
18+
}
19+
}
20+
diff --git a/net/minecraft/world/level/block/DiodeBlock.java b/net/minecraft/world/level/block/DiodeBlock.java
21+
index 02ffb5569e2405d86b3a4a695dd17c9372169ff7..a750e2d7f6c5ac7561c8b06870e022b07875c587 100644
22+
--- a/net/minecraft/world/level/block/DiodeBlock.java
23+
+++ b/net/minecraft/world/level/block/DiodeBlock.java
24+
@@ -92,6 +92,7 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock {
25+
26+
@Override
27+
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) {
28+
+ if (!level.getBlockState(pos).is(this)) return; // Paper
29+
if (state.canSurvive(level, pos)) {
30+
this.checkTickOnNeighbor(level, pos, state);
31+
} else {
32+
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
33+
index 3acc1374a7ef968d88e9f566ce7b812fb8d580af..11a72bcc8c74e4ed874f9c80e0e7c068b125269d 100644
34+
--- a/net/minecraft/world/level/chunk/LevelChunk.java
35+
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
36+
@@ -425,6 +425,12 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
37+
state.onPlace(this.level, pos, blockState, flag1);
38+
}
39+
40+
+ // Paper start - Some blocks may break here
41+
+ if (!section.getBlockState(i, i1, i2).is(block)) {
42+
+ return null;
43+
+ }
44+
+ // Paper end - Some blocks may break here
45+
+
46+
if (state.hasBlockEntity()) {
47+
BlockEntity blockEntity = this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK);
48+
if (blockEntity != null && !blockEntity.isValidBlockState(state)) {

0 commit comments

Comments
 (0)