Initialise default nibble arrays in ChunkAccess directly

When ChunkAccess was converted to an abstract class some versions
ago, the code to initialise nibble arrays should have been moved.
However, the code was not moved and so now mods constructing their
own implementations of ChunkAccess would not have the nibble arrays
initialised.

This is ported to Paper from Starlight to keep the code base in sync,
not because it fixes anything known.
This commit is contained in:
Spottedleaf 2023-10-16 18:57:45 -07:00
parent 00331d943e
commit 4b0bc74c90
10 changed files with 54 additions and 70 deletions

View file

@ -4922,7 +4922,7 @@ index 2b8e88a75e9a974e1ecafe0360a9d69b79326d11..6c171199dcc30f56a6d0ab7ecf398b50
this.legacySolid = this.calculateSolid();
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index e5e562f75e7d4b6a750f192842940c5e3af81e7d..a2658f3bd45b28478f3d3c4fe5dfef92d7b3b39c 100644
index e5e562f75e7d4b6a750f192842940c5e3af81e7d..3e5addb60ae8f466dad09edb3ae1fc88fe2681e9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -74,7 +74,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@ -4934,7 +4934,7 @@ index e5e562f75e7d4b6a750f192842940c5e3af81e7d..a2658f3bd45b28478f3d3c4fe5dfef92
private final Map<Structure, StructureStart> structureStarts = Maps.newHashMap();
private final Map<Structure, LongSet> structuresRefences = Maps.newHashMap();
protected final Map<BlockPos, CompoundTag> pendingBlockEntities = Maps.newHashMap();
@@ -86,6 +86,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -86,8 +86,55 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY);
// CraftBukkit end
@ -4981,8 +4981,16 @@ index e5e562f75e7d4b6a750f192842940c5e3af81e7d..a2658f3bd45b28478f3d3c4fe5dfef92
+ // Paper end - rewrite light engine
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) {
+ // Paper start - rewrite light engine
+ if (!(this instanceof ImposterProtoChunk)) {
+ this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(heightLimitView));
+ this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(heightLimitView));
+ }
+ // Paper end - rewrite light engine
this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
@@ -96,7 +137,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
this.upgradeData = upgradeData;
@@ -96,7 +143,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
this.inhabitedTime = inhabitedTime;
this.postProcessing = new ShortList[heightLimitView.getSectionsCount()];
this.blendingData = blendingData;
@ -4991,7 +4999,7 @@ index e5e562f75e7d4b6a750f192842940c5e3af81e7d..a2658f3bd45b28478f3d3c4fe5dfef92
if (sectionArray != null) {
if (this.sections.length == sectionArray.length) {
System.arraycopy(sectionArray, 0, this.sections, 0, this.sections.length);
@@ -507,12 +548,12 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -507,12 +554,12 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
}
public void initializeLightSources() {
@ -5127,21 +5135,10 @@ index 6bb508105641b5729572736c5c3f9bd6711e309a..60e760b42dd6471a229dfd45490dcf8c
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 1e434faaf56f7d1501367c4371131a8da30c0421..f225a51d284a64d5a962256ab5d7b2d07544dc88 100644
index 1e434faaf56f7d1501367c4371131a8da30c0421..f75d37091018d5544099861e2fe7d3fd04870750 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -90,6 +90,10 @@ public class LevelChunk extends ChunkAccess {
public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) {
super(pos, upgradeData, world, world.registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sectionArrayInitializer, blendingData);
+ // Paper start - rewrite light engine
+ this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
+ this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
+ // Paper end - rewrite light engine
this.tickersInLevel = Maps.newHashMap();
this.level = (ServerLevel) world; // CraftBukkit - type
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
@@ -219,6 +223,12 @@ public class LevelChunk extends ChunkAccess {
@@ -219,6 +219,12 @@ public class LevelChunk extends ChunkAccess {
public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor entityLoader) {
this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), entityLoader, protoChunk.getBlendingData());
@ -5154,7 +5151,7 @@ index 1e434faaf56f7d1501367c4371131a8da30c0421..f225a51d284a64d5a962256ab5d7b2d0
Iterator iterator = protoChunk.getBlockEntities().values().iterator();
while (iterator.hasNext()) {
@@ -245,7 +255,7 @@ public class LevelChunk extends ChunkAccess {
@@ -245,7 +251,7 @@ public class LevelChunk extends ChunkAccess {
}
}
@ -5163,7 +5160,7 @@ index 1e434faaf56f7d1501367c4371131a8da30c0421..f225a51d284a64d5a962256ab5d7b2d0
this.setLightCorrect(protoChunk.isLightCorrect());
this.unsaved = true;
this.needsDecoration = true; // CraftBukkit
@@ -409,7 +419,7 @@ public class LevelChunk extends ChunkAccess {
@@ -409,7 +415,7 @@ public class LevelChunk extends ChunkAccess {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.push("updateSkyLightSources");
@ -5186,23 +5183,10 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..1219200cd915d6239a32a2bd09d325cd
return data.palette.valueFor(data.storage.get(index));
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index 38ec21faaa16df5485a81a581506700a5ab0a440..54db27af1a55539e86c775a78d30a3afa7be7f9c 100644
index 38ec21faaa16df5485a81a581506700a5ab0a440..7da1ed9640211b0e064162dcdb0000538e7b30f3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -53,6 +53,12 @@ public class ProtoChunk extends ChunkAccess {
public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] sections, ProtoChunkTicks<Block> blockTickScheduler, ProtoChunkTicks<Fluid> fluidTickScheduler, LevelHeightAccessor world, Registry<Biome> biomeRegistry, @Nullable BlendingData blendingData) {
super(pos, upgradeData, world, biomeRegistry, 0L, sections, blendingData);
+ // Paper start - rewrite light engine
+ if (!(this instanceof ImposterProtoChunk)) {
+ this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
+ this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
+ }
+ // Paper end - rewrite light engine
this.blockTicks = blockTickScheduler;
this.fluidTicks = fluidTickScheduler;
}
@@ -130,7 +136,7 @@ public class ProtoChunk extends ChunkAccess {
@@ -130,7 +130,7 @@ public class ProtoChunk extends ChunkAccess {
}
if (LightEngine.hasDifferentLightProperties(this, pos, blockState, state)) {

View file

@ -21314,7 +21314,7 @@ index 846ae3fd184a1d63b743aa25e045604576697c96..a907b79fd8291a0e92db138f37239d17
public int getIndex() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128d35b260a 100644
index f75d37091018d5544099861e2fe7d3fd04870750..9da26705d41931e77bff0e6a4d73bb9263e6989e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -83,6 +83,7 @@ public class LevelChunk extends ChunkAccess {
@ -21325,7 +21325,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
public LevelChunk(Level world, ChunkPos pos) {
this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null);
@@ -661,9 +662,26 @@ public class LevelChunk extends ChunkAccess {
@@ -657,9 +658,26 @@ public class LevelChunk extends ChunkAccess {
}
@ -21355,7 +21355,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
int chunkX = this.chunkPos.x;
int chunkZ = this.chunkPos.z;
net.minecraft.server.level.ServerChunkCache chunkProvider = this.level.getChunkSource();
@@ -678,10 +696,55 @@ public class LevelChunk extends ChunkAccess {
@@ -674,10 +692,55 @@ public class LevelChunk extends ChunkAccess {
}
}
this.setNeighbourLoaded(0, 0, this);
@ -21413,7 +21413,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
@@ -690,6 +753,7 @@ public class LevelChunk extends ChunkAccess {
@@ -686,6 +749,7 @@ public class LevelChunk extends ChunkAccess {
*/
org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
@ -21421,7 +21421,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
if (this.needsDecoration) {
try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
@@ -718,9 +782,11 @@ public class LevelChunk extends ChunkAccess {
@@ -714,9 +778,11 @@ public class LevelChunk extends ChunkAccess {
}
public void unloadCallback() {
@ -21434,7 +21434,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk();
@@ -742,9 +808,26 @@ public class LevelChunk extends ChunkAccess {
@@ -738,9 +804,26 @@ public class LevelChunk extends ChunkAccess {
// Paper end
}
@ -21462,7 +21462,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
}
// CraftBukkit end
@@ -813,7 +896,9 @@ public class LevelChunk extends ChunkAccess {
@@ -809,7 +892,9 @@ public class LevelChunk extends ChunkAccess {
return this.blockEntities;
}
@ -21472,7 +21472,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
ChunkPos chunkcoordintpair = this.getPos();
for (int i = 0; i < this.postProcessing.length; ++i) {
@@ -834,6 +919,7 @@ public class LevelChunk extends ChunkAccess {
@@ -830,6 +915,7 @@ public class LevelChunk extends ChunkAccess {
BlockState iblockdata1 = Block.updateFromNeighbourShapes(iblockdata, this.level, blockposition);
this.level.setBlock(blockposition, iblockdata1, 20);
@ -21480,7 +21480,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
}
}
@@ -851,6 +937,10 @@ public class LevelChunk extends ChunkAccess {
@@ -847,6 +933,10 @@ public class LevelChunk extends ChunkAccess {
this.pendingBlockEntities.clear();
this.upgradeData.upgrade(this);
@ -21491,7 +21491,7 @@ index f225a51d284a64d5a962256ab5d7b2d07544dc88..998ca8d123e8b373f0ce5c10f76ec128
}
@Nullable
@@ -900,7 +990,7 @@ public class LevelChunk extends ChunkAccess {
@@ -896,7 +986,7 @@ public class LevelChunk extends ChunkAccess {
}
public FullChunkStatus getFullStatus() {

View file

@ -44,10 +44,10 @@ index b300d12e9e00519028b53aca9c3fb01f589eaa91..63acd109a79ed752a05df3d4f1b99309
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 85b38592c87bbc071d3fc5de5db131c6626fe004..fde60133d2c5557cd8d4a4d2e3a16aa96974fcbb 100644
index 9da26705d41931e77bff0e6a4d73bb9263e6989e..aaf363b7074df5a8113242da1be140417e056e3d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1147,11 +1147,11 @@ public class LevelChunk extends ChunkAccess {
@@ -1143,11 +1143,11 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {

View file

@ -131,7 +131,7 @@ index 5d65baba605dd83e5f74d526aeda36d8ede8c014..92e76dd39dc3575e9466031dd799080a
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index fde60133d2c5557cd8d4a4d2e3a16aa96974fcbb..d13652d5001c117582b8c470d40207a6c10cb096 100644
index aaf363b7074df5a8113242da1be140417e056e3d..080615881c93e73f207be1aa1105b0b1067fa308 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,6 +1,7 @@
@ -142,7 +142,7 @@ index fde60133d2c5557cd8d4a4d2e3a16aa96974fcbb..d13652d5001c117582b8c470d40207a6
import com.google.common.collect.Maps;
import com.google.common.collect.UnmodifiableIterator;
import com.mojang.logging.LogUtils;
@@ -569,10 +570,16 @@ public class LevelChunk extends ChunkAccess {
@@ -565,10 +566,16 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start
} else {
@ -163,7 +163,7 @@ index fde60133d2c5557cd8d4a4d2e3a16aa96974fcbb..d13652d5001c117582b8c470d40207a6
// CraftBukkit end
}
}
@@ -1150,6 +1157,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1146,6 +1153,7 @@ public class LevelChunk extends ChunkAccess {
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);

View file

@ -42,10 +42,10 @@ index 37d5abf5a18b90695d1cea9e365c764e93b918bf..5502d037279ba876f5e4c6728cc678f1
public static boolean isInSpawnableBounds(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 2caac1a3d80e6c490aa16aa6bc1067065b665c69..525c89bc926f13af6f94fc46c897525e37477eca 100644
index 3e5addb60ae8f466dad09edb3ae1fc88fe2681e9..5e8d2e4245757a0889645ea79ee68afb53f7dde4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -166,6 +166,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -172,6 +172,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
return GameEventListenerRegistry.NOOP;
}
@ -88,10 +88,10 @@ index 60e760b42dd6471a229dfd45490dcf8c51979d35..4a3ac7dedf5cb1e76f16ec4f18e82afc
@Override
public FluidState getFluidState(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index d13652d5001c117582b8c470d40207a6c10cb096..f6286284b95df0ab6109ff14fda33a48b163f8c2 100644
index 080615881c93e73f207be1aa1105b0b1067fa308..b16e32720196b40a617122dbefe34e59b1a2ac8e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -296,12 +296,29 @@ public class LevelChunk extends ChunkAccess {
@@ -292,12 +292,29 @@ public class LevelChunk extends ChunkAccess {
}
}
@ -138,10 +138,10 @@ index d59392c322936ce89b759ac9787c8f4f0b228af6..2c3ea88bac229df67bd742e16d2106d8
private short tickingFluidCount;
public final PalettedContainer<BlockState> states;
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index b2c0c7fd06fcd720b4c0875f08a90b6b672c96b2..6c72eb36020bc05104b21e52cea89de09b85f2d7 100644
index 7da1ed9640211b0e064162dcdb0000538e7b30f3..7aa585875dad5296526bb5d67fc5ea0f8875e452 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -92,14 +92,18 @@ public class ProtoChunk extends ChunkAccess {
@@ -86,14 +86,18 @@ public class ProtoChunk extends ChunkAccess {
@Override
public BlockState getBlockState(BlockPos pos) {

View file

@ -11,10 +11,10 @@ For people who want all chunks to be treated equally, you can chose a fixed valu
This allows to fine-tune vanilla gameplay.
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f6286284b95df0ab6109ff14fda33a48b163f8c2..391ef1eb8c842a1a2dbce45eec8a030f615926d6 100644
index b16e32720196b40a617122dbefe34e59b1a2ac8e..43cb8c3240fa058557f67d632a713747c1a19a39 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -281,6 +281,13 @@ public class LevelChunk extends ChunkAccess {
@@ -277,6 +277,13 @@ public class LevelChunk extends ChunkAccess {
return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks);
}

View file

@ -1188,10 +1188,10 @@ index 9a6ed3aa55f988ed30669fab2a2513741eda399b..7a1886585bd00dc8213ce22130b8b6fe
if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 525c89bc926f13af6f94fc46c897525e37477eca..8b96d1b7548d354fbcabe6d1b5e9d6c3e2a5cb9d 100644
index 5e8d2e4245757a0889645ea79ee68afb53f7dde4..f7e5e016a7028a9196e689e950805b0d5b31fe38 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -146,17 +146,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -152,17 +152,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
}
}
@ -1213,7 +1213,7 @@ index 525c89bc926f13af6f94fc46c897525e37477eca..8b96d1b7548d354fbcabe6d1b5e9d6c3
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 391ef1eb8c842a1a2dbce45eec8a030f615926d6..abb75d8bea8f975c5b04c9a9fff7187a3520ac26 100644
index 43cb8c3240fa058557f67d632a713747c1a19a39..44ef27e5c297055f7a2512ae49d68d50cfcde72a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -91,7 +91,7 @@ public class LevelChunk extends ChunkAccess {
@ -1222,9 +1222,9 @@ index 391ef1eb8c842a1a2dbce45eec8a030f615926d6..abb75d8bea8f975c5b04c9a9fff7187a
public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) {
- super(pos, upgradeData, world, world.registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sectionArrayInitializer, blendingData);
+ super(pos, upgradeData, world, net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sectionArrayInitializer, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry
// Paper start - rewrite light engine
this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
this.tickersInLevel = Maps.newHashMap();
this.level = (ServerLevel) world; // CraftBukkit - type
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 2c3ea88bac229df67bd742e16d2106d80bcc8889..4eeb719b40ff1c18a7cdda7ecc6b135dbedd626e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java

View file

@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index abb75d8bea8f975c5b04c9a9fff7187a3520ac26..d2cdb8100fbbdc3d92eb7a61748340c40de343f7 100644
index 44ef27e5c297055f7a2512ae49d68d50cfcde72a..78004403ca444b2880a663b72c9e15c5b57faedd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -381,18 +381,20 @@ public class LevelChunk extends ChunkAccess {
@@ -377,18 +377,20 @@ public class LevelChunk extends ChunkAccess {
}
public FluidState getFluidState(int x, int y, int z) {
@ -38,7 +38,7 @@ index abb75d8bea8f975c5b04c9a9fff7187a3520ac26..d2cdb8100fbbdc3d92eb7a61748340c4
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@@ -402,6 +404,7 @@ public class LevelChunk extends ChunkAccess {
@@ -398,6 +400,7 @@ public class LevelChunk extends ChunkAccess {
});
throw new ReportedException(crashreport);
}

View file

@ -308,10 +308,10 @@ index 7a1886585bd00dc8213ce22130b8b6fea52c5cf6..52a44510d0499df56d2ebef0963fe816
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index d2cdb8100fbbdc3d92eb7a61748340c40de343f7..535e71bdb2531432974dc91ec9d5edb2b3ebc744 100644
index 78004403ca444b2880a663b72c9e15c5b57faedd..9b96d67acfae823598695e7ed5c61a5118bd0e0b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1181,6 +1181,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1177,6 +1177,7 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {

View file

@ -612,10 +612,10 @@ index 5db27d7bcaaa2eeaeeb08401513d8d23f6cb63c7..ce43cb0152ba07c6c21e08142d65813d
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 535e71bdb2531432974dc91ec9d5edb2b3ebc744..4abec88caab4116cfa318f7b66c6b1a8346a7401 100644
index 9b96d67acfae823598695e7ed5c61a5118bd0e0b..3e9758fa40bf93fe3d315cc66389193bd57bc393 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -604,7 +604,7 @@ public class LevelChunk extends ChunkAccess {
@@ -600,7 +600,7 @@ public class LevelChunk extends ChunkAccess {
+ " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
"\nWorld: " + level.getLevel().dimension().location());