Fix getBlockStateIfLoaded world bounds check

Closes #8922
This commit is contained in:
Nassim Jahnke 2023-02-28 12:27:38 +01:00
parent 08e6622b81
commit 4ae202eb82
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
20 changed files with 63 additions and 62 deletions

View file

@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f39d927df5997cb0dd3d8c677a10099afa84da09..995278298b7feb61255cd8c1fea396ed0850099e 100644
index edb12eb2a567febe01dd3160b193b0d8a7d17270..7b4fe58cb6b9e0b4b9a09c79a5385c785983c955 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -151,7 +151,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -30,7 +30,7 @@ index f39d927df5997cb0dd3d8c677a10099afa84da09..995278298b7feb61255cd8c1fea396ed
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
@@ -379,7 +379,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -380,7 +380,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -39,7 +39,7 @@ index f39d927df5997cb0dd3d8c677a10099afa84da09..995278298b7feb61255cd8c1fea396ed
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
this.capturedBlockStates.put(pos.immutable(), blockstate);
@@ -399,7 +399,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -400,7 +400,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start - capture blockstates
boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) {
@ -49,7 +49,7 @@ index f39d927df5997cb0dd3d8c677a10099afa84da09..995278298b7feb61255cd8c1fea396ed
this.capturedBlockStates.put(pos.immutable(), blockstate);
captured = true;
}
@@ -611,7 +612,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -612,7 +613,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockState getBlockState(BlockPos pos) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {