Make RedStoneWireBlock.isSignalSource return true if off-region

This may be invoked by a worldgen thread, in which case the
region data would be null and cause a crash. Returning true
is the default state of shouldSignal, so this should maintain
expected behavior.
This commit is contained in:
Spottedleaf 2024-03-24 13:10:56 -07:00
parent e97b1eee63
commit 035f8e33c5
2 changed files with 7 additions and 4 deletions

View File

@ -19905,7 +19905,7 @@ index 1f27ae8abd5891a0b8057b454f2210b088b4e95a..a978a6130f5f6fdd1dab194e753cbe24
return true;
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index b5a71fd4e2f55bf036c2c697da5d50cc90fc657c..1fd29331e928bc76de06d5eb5ba781390af76ebe 100644
index b5a71fd4e2f55bf036c2c697da5d50cc90fc657c..7f33db05284a957690eac6eb6f5b3b05586727bb 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -69,7 +69,7 @@ public class RedStoneWireBlock extends Block {
@ -19988,12 +19988,15 @@ index b5a71fd4e2f55bf036c2c697da5d50cc90fc657c..1fd29331e928bc76de06d5eb5ba78139
int i = (Integer) state.getValue(RedStoneWireBlock.POWER);
return i == 0 ? 0 : (direction != Direction.UP && !((RedstoneSide) this.getConnectionState(world, state, pos).getValue((Property) RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(direction.getOpposite()))).isConnected() ? 0 : i);
@@ -584,7 +588,7 @@ public class RedStoneWireBlock extends Block {
@@ -584,7 +588,10 @@ public class RedStoneWireBlock extends Block {
@Override
public boolean isSignalSource(BlockState state) {
- return this.shouldSignal;
+ return io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData().shouldSignal; // Folia - region threading
+ // Folia start - region threading
+ io.papermc.paper.threadedregions.RegionizedWorldData worldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData();
+ return worldData == null || worldData.shouldSignal;
+ // Folia end - region threading
}
public static int getColorForPower(int powerLevel) {

View File

@ -54,7 +54,7 @@ index b84c48902ef24fdae17578a304e6c93dc20c5dce..218c1954a7922c9e6bf6f34f9497f89c
} else {
RailShape blockpropertytrackposition1 = (RailShape) iblockdata.getValue(PoweredRailBlock.SHAPE);
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 1fd29331e928bc76de06d5eb5ba781390af76ebe..d6df2f1d3342fcbcf8ee5aa86c4d6f3431fac580 100644
index 7f33db05284a957690eac6eb6f5b3b05586727bb..cdf9434635e6d3d15e003f1f6e6a3be7df3f5b04 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -200,8 +200,9 @@ public class RedStoneWireBlock extends Block {