@@ -1,17 +0,0 @@
|
||||
--- a/net/minecraft/world/level/chunk/BiomeStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/BiomeStorage.java
|
||||
@@ -109,4 +109,14 @@
|
||||
|
||||
return this.biomes[i1 << BiomeStorage.WIDTH_BITS + BiomeStorage.WIDTH_BITS | j1 << BiomeStorage.WIDTH_BITS | l];
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void setBiome(int i, int j, int k, BiomeBase biome) {
|
||||
+ int l = i & BiomeStorage.HORIZONTAL_MASK;
|
||||
+ int i1 = MathHelper.clamp(j - this.quartMinY, 0, this.quartHeight);
|
||||
+ int j1 = k & BiomeStorage.HORIZONTAL_MASK;
|
||||
+
|
||||
+ this.biomes[i1 << BiomeStorage.WIDTH_BITS + BiomeStorage.WIDTH_BITS | j1 << BiomeStorage.WIDTH_BITS | l] = biome;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
--- a/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -92,7 +92,7 @@
|
||||
private final Map<BlockPosition, NBTTagCompound> pendingBlockEntities;
|
||||
private final Map<BlockPosition, Chunk.c> tickersInLevel;
|
||||
@@ -77,7 +77,7 @@
|
||||
private final Map<BlockPosition, Chunk.d> tickersInLevel;
|
||||
public boolean loaded;
|
||||
private boolean clientLightReady;
|
||||
- public final World level;
|
||||
+ public final WorldServer level; // CraftBukkit - type
|
||||
public final Map<HeightMap.Type, HeightMap> heightmaps;
|
||||
private final ChunkConverter upgradeData;
|
||||
public final Map<BlockPosition, TileEntity> blockEntities;
|
||||
@@ -122,7 +122,7 @@
|
||||
this.blockEntities = Maps.newHashMap();
|
||||
this.structureStarts = Maps.newHashMap();
|
||||
this.structuresRefences = Maps.newHashMap();
|
||||
@Nullable
|
||||
private Supplier<PlayerChunk.State> fullStatus;
|
||||
@Nullable
|
||||
@@ -94,7 +94,7 @@
|
||||
super(chunkcoordintpair, chunkconverter, world, world.registryAccess().registryOrThrow(IRegistry.BIOME_REGISTRY), i, achunksection, blendingdata);
|
||||
this.tickersInLevel = Maps.newHashMap();
|
||||
this.clientLightReady = false;
|
||||
- this.level = world;
|
||||
+ this.level = (WorldServer) world; // CraftBukkit - type
|
||||
this.chunkPos = chunkcoordintpair;
|
||||
this.upgradeData = chunkconverter;
|
||||
this.gameEventDispatcherSections = new Int2ObjectOpenHashMap();
|
||||
@@ -152,8 +152,22 @@
|
||||
}
|
||||
|
||||
this.postProcessing = new ShortList[world.getSectionsCount()];
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
int j = aheightmap_type.length;
|
||||
@@ -110,8 +110,22 @@
|
||||
this.postLoad = chunk_c;
|
||||
this.blockTicks = levelchunkticks;
|
||||
this.fluidTicks = levelchunkticks1;
|
||||
+ // CraftBukkit start
|
||||
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
}
|
||||
@@ -38,48 +38,48 @@
|
||||
+ public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public Chunk(WorldServer worldserver, ProtoChunk protochunk, @Nullable Consumer<Chunk> consumer) {
|
||||
this(worldserver, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.q(), protochunk.o(), protochunk.p(), protochunk.getInhabitedTime(), protochunk.getSections(), consumer);
|
||||
Iterator iterator = protochunk.y().values().iterator();
|
||||
@@ -184,6 +198,7 @@
|
||||
public Chunk(WorldServer worldserver, ProtoChunk protochunk, @Nullable Chunk.c chunk_c) {
|
||||
this(worldserver, protochunk.getPos(), protochunk.getUpgradeData(), protochunk.unpackBlockTicks(), protochunk.unpackFluidTicks(), protochunk.getInhabitedTime(), protochunk.getSections(), chunk_c, protochunk.getBlendingData());
|
||||
Iterator iterator = protochunk.getBlockEntities().values().iterator();
|
||||
@@ -142,6 +156,7 @@
|
||||
|
||||
this.b(protochunk.s());
|
||||
this.setLightCorrect(protochunk.isLightCorrect());
|
||||
this.unsaved = true;
|
||||
+ this.needsDecoration = true; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,9 +300,16 @@
|
||||
@@ -238,9 +253,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@Nullable
|
||||
@Override
|
||||
public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
|
||||
+ return this.setType(blockposition, iblockdata, flag, true);
|
||||
public IBlockData setBlockState(BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
|
||||
+ return this.setBlockState(blockposition, iblockdata, flag, true);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
|
||||
+ public IBlockData setBlockState(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
|
||||
+ // CraftBukkit end
|
||||
int i = blockposition.getY();
|
||||
int j = this.getSectionIndex(i);
|
||||
ChunkSection chunksection = this.sections[j];
|
||||
@@ -333,7 +355,8 @@
|
||||
if (!chunksection.getType(k, l, i1).a(block)) {
|
||||
return null;
|
||||
} else {
|
||||
- if (!this.level.isClientSide) {
|
||||
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
+ if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BlockTileEntity)) {
|
||||
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
|
||||
}
|
||||
ChunkSection chunksection = this.getSection(this.getSectionIndex(i));
|
||||
boolean flag1 = chunksection.hasOnlyAir();
|
||||
@@ -279,7 +301,8 @@
|
||||
if (!chunksection.getBlockState(j, k, l).is(block)) {
|
||||
return null;
|
||||
} else {
|
||||
- if (!this.level.isClientSide) {
|
||||
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
+ if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BlockTileEntity)) {
|
||||
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
|
||||
}
|
||||
|
||||
@@ -401,7 +424,12 @@
|
||||
@@ -323,7 +346,12 @@
|
||||
|
||||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
- TileEntity tileentity = (TileEntity) this.blockEntities.get(blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ TileEntity tileentity = level.capturedTileEntities.get(blockposition);
|
||||
@@ -90,22 +90,22 @@
|
||||
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
|
||||
@@ -460,6 +488,13 @@
|
||||
tileentity1.aa_();
|
||||
@@ -394,6 +422,13 @@
|
||||
tileentity1.setRemoved();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ()
|
||||
+ + " (" + getType(blockposition) + ") where there was no entity tile!");
|
||||
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getBlockPos().getX() + "," + tileentity.getBlockPos().getY() + "," + tileentity.getBlockPos().getZ()
|
||||
+ + " (" + getBlockState(blockposition) + ") where there was no entity tile!");
|
||||
+ System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
+ new Exception().printStackTrace();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,6 +529,12 @@
|
||||
if (this.E()) {
|
||||
@@ -423,6 +458,12 @@
|
||||
if (this.isInLevel()) {
|
||||
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-5561: Also remove from pending map
|
||||
@@ -115,9 +115,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (tileentity != null) {
|
||||
this.c(tileentity);
|
||||
tileentity.aa_();
|
||||
@@ -541,6 +582,50 @@
|
||||
this.removeGameEventListener(tileentity);
|
||||
tileentity.setRemoved();
|
||||
@@ -470,6 +511,55 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -158,70 +158,31 @@
|
||||
+
|
||||
+ public void unloadCallback() {
|
||||
+ org.bukkit.Server server = this.level.getCraftServer();
|
||||
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isNeedsSaving());
|
||||
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
|
||||
+ server.getPluginManager().callEvent(unloadEvent);
|
||||
+ // note: saving can be prevented, but not forced if no saving is actually required
|
||||
+ this.mustNotSave = !unloadEvent.isSaveChunk();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isUnsaved() {
|
||||
+ return super.isUnsaved() && !this.mustNotSave;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void markDirty() {
|
||||
this.unsaved = true;
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
@@ -664,7 +749,7 @@
|
||||
@@ -658,7 +748,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isNeedsSaving() {
|
||||
- return this.unsaved;
|
||||
+ return this.unsaved && !this.mustNotSave; // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -795,7 +880,7 @@
|
||||
|
||||
public void B() {
|
||||
if (this.blockTicks instanceof ProtoChunkTickList) {
|
||||
- ((ProtoChunkTickList) this.blockTicks).a(this.level.getBlockTickList(), (blockposition) -> {
|
||||
+ ((ProtoChunkTickList<Block>) this.blockTicks).a(this.level.getBlockTickList(), (blockposition) -> { // CraftBukkit - decompile error
|
||||
return this.getType(blockposition).getBlock();
|
||||
});
|
||||
this.blockTicks = TickListEmpty.b();
|
||||
@@ -805,7 +890,7 @@
|
||||
}
|
||||
|
||||
if (this.liquidTicks instanceof ProtoChunkTickList) {
|
||||
- ((ProtoChunkTickList) this.liquidTicks).a(this.level.getFluidTickList(), (blockposition) -> {
|
||||
+ ((ProtoChunkTickList<FluidType>) this.liquidTicks).a(this.level.getFluidTickList(), (blockposition) -> { // CraftBukkit - decompile error
|
||||
return this.getFluid(blockposition).getType();
|
||||
});
|
||||
this.liquidTicks = TickListEmpty.b();
|
||||
@@ -819,14 +904,14 @@
|
||||
public void a(WorldServer worldserver) {
|
||||
RegistryBlocks registryblocks;
|
||||
|
||||
- if (this.blockTicks == TickListEmpty.b()) {
|
||||
+ if (this.blockTicks == TickListEmpty.<Block>b()) { // CraftBukkit - decompile error
|
||||
registryblocks = IRegistry.BLOCK;
|
||||
Objects.requireNonNull(registryblocks);
|
||||
this.blockTicks = new TickListChunk<>(registryblocks::getKey, worldserver.getBlockTickList().a(this.chunkPos, true, false), worldserver.getTime());
|
||||
this.setNeedsSaving(true);
|
||||
}
|
||||
|
||||
- if (this.liquidTicks == TickListEmpty.b()) {
|
||||
+ if (this.liquidTicks == TickListEmpty.<FluidType>b()) { // CraftBukkit - decompile error
|
||||
registryblocks = IRegistry.FLUID;
|
||||
Objects.requireNonNull(registryblocks);
|
||||
this.liquidTicks = new TickListChunk<>(registryblocks::getKey, worldserver.getFluidTickList().a(this.chunkPos, true, false), worldserver.getTime());
|
||||
@@ -899,7 +984,7 @@
|
||||
|
||||
private <T extends TileEntity> void f(T t0) {
|
||||
IBlockData iblockdata = t0.getBlock();
|
||||
- BlockEntityTicker<T> blockentityticker = iblockdata.a(this.level, t0.getTileType());
|
||||
+ BlockEntityTicker<T> blockentityticker = iblockdata.a(this.level, (TileEntityTypes<T>) t0.getTileType()); // CraftBukkit - decompile error
|
||||
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
|
||||
IBlockData iblockdata = t0.getBlockState();
|
||||
- BlockEntityTicker<T> blockentityticker = iblockdata.getTicker(this.level, t0.getType());
|
||||
+ BlockEntityTicker<T> blockentityticker = iblockdata.getTicker(this.level, (TileEntityTypes<T>) t0.getType()); // CraftBukkit - decompile error
|
||||
|
||||
if (blockentityticker == null) {
|
||||
this.l(t0.getPosition());
|
||||
@@ -978,7 +1063,7 @@
|
||||
this.removeBlockEntityTicker(t0.getBlockPos());
|
||||
@@ -751,7 +841,7 @@
|
||||
private boolean loggedInvalidBlockState;
|
||||
|
||||
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {
|
||||
@@ -230,12 +191,12 @@
|
||||
this.ticker = blockentityticker;
|
||||
}
|
||||
|
||||
@@ -1001,7 +1086,7 @@
|
||||
@@ -774,7 +864,7 @@
|
||||
this.loggedInvalidBlockState = true;
|
||||
Chunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new org.apache.logging.log4j.util.Supplier[]{this::d, this::c, () -> {
|
||||
Chunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new org.apache.logging.log4j.util.Supplier[]{this::getType, this::getPos, () -> {
|
||||
return iblockdata;
|
||||
- }});
|
||||
+ }}); // CraftBukkit - squelch checkstyle
|
||||
}
|
||||
|
||||
gameprofilerfiller.exit();
|
||||
gameprofilerfiller.pop();
|
||||
|
||||
@@ -1,46 +1,55 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -63,7 +63,7 @@
|
||||
protected final WorldChunkManager biomeSource;
|
||||
protected final WorldChunkManager runtimeBiomeSource;
|
||||
private final StructureSettings settings;
|
||||
- private final long strongholdSeed;
|
||||
+ public final long strongholdSeed; // PAIL private -> public
|
||||
private final List<ChunkCoordIntPair> strongholdPositions;
|
||||
private final BaseStoneSource defaultBaseStoneSource;
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
@@ -225,7 +225,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess, StructureManager structuremanager) {
|
||||
+ public void addVanillaDecorations(RegionLimitedWorldAccess regionlimitedworldaccess, StructureManager structuremanager) { // CraftBukkit
|
||||
ChunkCoordIntPair chunkcoordintpair = regionlimitedworldaccess.a();
|
||||
int i = chunkcoordintpair.d();
|
||||
int j = chunkcoordintpair.e();
|
||||
@@ -236,8 +236,45 @@
|
||||
- public void applyBiomeDecoration(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager) {
|
||||
+ public void addVanillaDecorations(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager) { // CraftBukkit
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
|
||||
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
|
||||
@@ -249,7 +249,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ChunkSection chunksection = achunksection[k];
|
||||
- DataPaletteBlock datapaletteblock = chunksection.getBiomes();
|
||||
+ DataPaletteBlock<BiomeBase> datapaletteblock = chunksection.getBiomes(); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(set);
|
||||
datapaletteblock.getAll(set::add);
|
||||
@@ -278,7 +278,7 @@
|
||||
StructureGenerator<?> structuregenerator = (StructureGenerator) iterator.next();
|
||||
|
||||
seededrandom.setFeatureSeed(i, i1, l);
|
||||
- Supplier supplier = () -> {
|
||||
+ Supplier<String> supplier = () -> { // CraftBukkit - decompile error
|
||||
Optional optional = iregistry1.getResourceKey(structuregenerator).map(Object::toString);
|
||||
|
||||
Objects.requireNonNull(structuregenerator);
|
||||
@@ -364,6 +364,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess, StructureManager structuremanager) {
|
||||
+ public void applyBiomeDecoration(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager) {
|
||||
+ // CraftBukkit start
|
||||
+ addDecorations(regionlimitedworldaccess, structuremanager, true);
|
||||
+ applyBiomeDecoration(generatoraccessseed, ichunkaccess, structuremanager, true);
|
||||
+ }
|
||||
+
|
||||
+ public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess, StructureManager structuremanager, boolean vanilla) {
|
||||
+ public void applyBiomeDecoration(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager, boolean vanilla) {
|
||||
+ if (vanilla) {
|
||||
+ addVanillaDecorations(regionlimitedworldaccess, structuremanager);
|
||||
+ addVanillaDecorations(generatoraccessseed, ichunkaccess, structuremanager);
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.World world = regionlimitedworldaccess.getMinecraftWorld().getWorld();
|
||||
+ org.bukkit.World world = generatoraccessseed.getMinecraftWorld().getWorld();
|
||||
+ // only call when a populator is present (prevents unnecessary entity conversion)
|
||||
+ if (world.getPopulators().size() != 0) {
|
||||
+ org.bukkit.craftbukkit.generator.CraftLimitedRegion limitedRegion = new org.bukkit.craftbukkit.generator.CraftLimitedRegion(regionlimitedworldaccess);
|
||||
+ int x = regionlimitedworldaccess.a().x;
|
||||
+ int z = regionlimitedworldaccess.a().z;
|
||||
+ if (!world.getPopulators().isEmpty()) {
|
||||
+ org.bukkit.craftbukkit.generator.CraftLimitedRegion limitedRegion = new org.bukkit.craftbukkit.generator.CraftLimitedRegion(generatoraccessseed, ichunkaccess.getPos());
|
||||
+ int x = ichunkaccess.getPos().x;
|
||||
+ int z = ichunkaccess.getPos().z;
|
||||
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
+ SeededRandom seededrandom = new SeededRandom();
|
||||
+ seededrandom.a(regionlimitedworldaccess.getSeed(), x, z);
|
||||
+ SeededRandom seededrandom = new SeededRandom(new LegacyRandomSource(generatoraccessseed.getSeed()));
|
||||
+ seededrandom.setDecorationSeed(generatoraccessseed.getSeed(), x, z);
|
||||
+ populator.populate(world, seededrandom, x, z, limitedRegion);
|
||||
+ }
|
||||
+ limitedRegion.saveEntities();
|
||||
@@ -49,51 +58,15 @@
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
public abstract void buildBase(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkAccess ichunkaccess);
|
||||
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
int i = chunkcoordintpair.getMinBlockX();
|
||||
@@ -439,7 +466,7 @@
|
||||
|
||||
+ // CraftBukkit start - spilt surface and bedrock generation code
|
||||
+ public SeededRandom buildSurface(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkAccess iChunkAccess) {
|
||||
+ throw new UnsupportedOperationException("Methode not overridden");
|
||||
+ }
|
||||
+
|
||||
+ public void buildBedrock(IChunkAccess iChunkAccess, Random random) {
|
||||
+ throw new UnsupportedOperationException("Methode not overridden");
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void addMobs(RegionLimitedWorldAccess regionlimitedworldaccess) {}
|
||||
Entry<StructureFeature<?, ?>, Collection<ResourceKey<BiomeBase>>> entry = (Entry) unmodifiableiterator.next();
|
||||
|
||||
public StructureSettings getSettings() {
|
||||
@@ -269,7 +306,16 @@
|
||||
while (iterator.hasNext()) {
|
||||
Supplier<StructureFeature<?, ?>> supplier = (Supplier) iterator.next();
|
||||
- structurestart3 = ((StructureFeature) entry.getKey()).generate(iregistrycustom, this, this.biomeSource, definedstructuremanager, i, chunkcoordintpair, j, structuresettingsfeature1, ichunkaccess, (biomebase) -> {
|
||||
+ structurestart3 = (entry.getKey()).generate(iregistrycustom, this, this.biomeSource, definedstructuremanager, i, chunkcoordintpair, j, structuresettingsfeature1, ichunkaccess, (biomebase) -> { // CraftBukkit - decompile error
|
||||
Collection collection = (Collection) entry.getValue();
|
||||
|
||||
- this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ // CraftBukkit start
|
||||
+ StructureFeature<?, ?> structurefeature = (StructureFeature) supplier.get();
|
||||
+ if (structurefeature.LIST_CODEC == StructureGenerator.STRONGHOLD) {
|
||||
+ synchronized (structurefeature) {
|
||||
+ this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ }
|
||||
+ } else {
|
||||
+ this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -364,9 +410,11 @@
|
||||
}
|
||||
|
||||
static {
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", (Object) ChunkGeneratorAbstract.CODEC);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", (Object) ChunkProviderFlat.CODEC);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", (Object) ChunkProviderDebug.CODEC);
|
||||
+ // CraftBukkit start - decompile errors
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", ChunkGeneratorAbstract.CODEC);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", ChunkProviderFlat.CODEC);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", ChunkProviderDebug.CODEC);
|
||||
+ // CraftBukkit end
|
||||
CODEC = IRegistry.CHUNK_GENERATOR.dispatchStable(ChunkGenerator::a, Function.identity());
|
||||
}
|
||||
}
|
||||
Objects.requireNonNull(collection);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkSection.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkSection.java
|
||||
@@ -176,6 +176,12 @@
|
||||
return (BiomeBase) this.biomes.get(i, j, k);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void setBiome(int i, int j, int k, BiomeBase biome) {
|
||||
+ this.biomes.set(i, j, k, biome);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler, int i, int j) {
|
||||
DataPaletteBlock<BiomeBase> datapaletteblock = this.getBiomes();
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
@@ -39,7 +39,7 @@
|
||||
@@ -47,7 +47,7 @@
|
||||
});
|
||||
public static final ChunkStatus STRUCTURE_STARTS = a("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, definedstructuremanager, lightenginethreaded, function, list, ichunkaccess) -> {
|
||||
if (!ichunkaccess.getChunkStatus().b(chunkstatus)) {
|
||||
- if (worldserver.getMinecraftServer().getSaveData().getGeneratorSettings().shouldGenerateMapFeatures()) {
|
||||
+ if (worldserver.serverLevelData.getGeneratorSettings().shouldGenerateMapFeatures()) { // CraftBukkit
|
||||
chunkgenerator.createStructures(worldserver.t(), worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
|
||||
public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, definedstructuremanager, lightenginethreaded, function, list, ichunkaccess, flag) -> {
|
||||
if (!ichunkaccess.getStatus().isOrAfter(chunkstatus)) {
|
||||
- if (worldserver.getServer().getWorldData().worldGenSettings().generateFeatures()) {
|
||||
+ if (worldserver.serverLevelData.worldGenSettings().generateFeatures()) { // CraftBukkit
|
||||
chunkgenerator.createStructures(worldserver.registryAccess(), worldserver.structureFeatureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
return (CompletableFuture) function.apply(ichunkaccess);
|
||||
});
|
||||
private static final List<ChunkStatus> STATUS_BY_RANGE = ImmutableList.of(ChunkStatus.FULL, ChunkStatus.FEATURES, ChunkStatus.LIQUID_CARVERS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS);
|
||||
- private static final IntList RANGE_BY_STATUS = (IntList) SystemUtils.a((Object) (new IntArrayList(a().size())), (intarraylist) -> {
|
||||
+ private static final IntList RANGE_BY_STATUS = (IntList) SystemUtils.a((new IntArrayList(a().size())), (java.util.function.Consumer<IntArrayList>) (intarraylist) -> { // CraftBukkit - decompile error
|
||||
int i = 0;
|
||||
|
||||
for (int j = a().size() - 1; j >= 0; --j) {
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
--- a/net/minecraft/world/level/chunk/DataPaletteBlock.java
|
||||
+++ b/net/minecraft/world/level/chunk/DataPaletteBlock.java
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
public static <T> Codec<DataPaletteBlock<T>> codec(Registry<T> registry, Codec<T> codec, DataPaletteBlock.e datapaletteblock_e, T t0) {
|
||||
- return RecordCodecBuilder.create((instance) -> {
|
||||
+ return RecordCodecBuilder.<DataPaletteBlock.d<T>>create((instance) -> { // CraftBukkit - decompile error
|
||||
return instance.group(codec.mapResult(ExtraCodecs.orElsePartial(t0)).listOf().fieldOf("palette").forGetter(DataPaletteBlock.d::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(DataPaletteBlock.d::storage)).apply(instance, DataPaletteBlock.d::new);
|
||||
}).comapFlatMap((datapaletteblock_d) -> {
|
||||
return read(registry, datapaletteblock_e, datapaletteblock_d);
|
||||
@@ -97,7 +97,7 @@
|
||||
public T getAndSet(int i, int j, int k, T t0) {
|
||||
this.acquire();
|
||||
|
||||
- Object object;
|
||||
+ T object; // CraftBukkit - decompile error
|
||||
|
||||
try {
|
||||
object = this.getAndSet(this.strategy.getIndex(i, j, k), t0);
|
||||
@@ -309,19 +309,19 @@
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
|
||||
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, 4);
|
||||
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, 4); // CraftBukkit - decompile error
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
- datapaletteblock_a = new DataPaletteBlock.a<>(null.HASHMAP_PALETTE_FACTORY, i);
|
||||
+ datapaletteblock_a = new DataPaletteBlock.a<>(HASHMAP_PALETTE_FACTORY, i); // CraftBukkit - decompile error
|
||||
break;
|
||||
default:
|
||||
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
|
||||
@@ -337,12 +337,12 @@
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
|
||||
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, i);
|
||||
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, i); // CraftBukkit - decompile error
|
||||
break;
|
||||
default:
|
||||
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
|
||||
@@ -375,8 +375,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static final class a<T> extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ private static final record a<T>(DataPalette.a factory, int bits) {
|
||||
|
||||
+ /*
|
||||
private final DataPalette.a factory;
|
||||
private final int bits;
|
||||
|
||||
@@ -384,6 +386,8 @@
|
||||
this.factory = datapalette_a;
|
||||
this.bits = i;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public DataPaletteBlock.c<T> createData(Registry<T> registry, DataPaletteExpandable<T> datapaletteexpandable, int i) {
|
||||
Object object = this.bits == 0 ? new ZeroBitStorage(i) : new SimpleBitStorage(this.bits, i);
|
||||
@@ -392,6 +396,8 @@
|
||||
return new DataPaletteBlock.c(this, (DataBits) object, datapalette);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
public final String toString() {
|
||||
return this.toString < invokedynamic > (this);
|
||||
}
|
||||
@@ -403,6 +409,8 @@
|
||||
public final boolean equals(Object object) {
|
||||
return this.equals<invokedynamic>(this, object);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public DataPalette.a factory() {
|
||||
return this.factory;
|
||||
@@ -413,8 +421,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static final class c extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ private static final record c<T>(DataPaletteBlock.a<T> configuration, DataBits storage, DataPalette<T> palette) {
|
||||
|
||||
+ /*
|
||||
private final DataPaletteBlock.a<T> configuration;
|
||||
final DataBits storage;
|
||||
final DataPalette<T> palette;
|
||||
@@ -424,6 +434,8 @@
|
||||
this.storage = databits;
|
||||
this.palette = datapalette;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public void copyFrom(DataPalette<T> datapalette, DataBits databits) {
|
||||
for (int i = 0; i < databits.getSize(); ++i) {
|
||||
@@ -444,6 +456,8 @@
|
||||
packetdataserializer.writeLongArray(this.storage.getRaw());
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
public final String toString() {
|
||||
return this.toString < invokedynamic > (this);
|
||||
}
|
||||
@@ -467,10 +481,14 @@
|
||||
public DataPalette<T> palette() {
|
||||
return this.palette;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- private static final class d extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ private static final record d<T>(List<T> paletteEntries, Optional<LongStream> storage) {
|
||||
|
||||
+ /*
|
||||
private final List<T> paletteEntries;
|
||||
private final Optional<LongStream> storage;
|
||||
|
||||
@@ -498,6 +516,8 @@
|
||||
public Optional<LongStream> storage() {
|
||||
return this.storage;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
@@ -0,0 +1,63 @@
|
||||
--- a/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
+++ b/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
@@ -93,7 +93,11 @@
|
||||
}
|
||||
|
||||
replaceMissingSections(levelheightaccessor, iregistry, this.sections);
|
||||
+ // CraftBukkit start
|
||||
+ this.biomeRegistry = iregistry;
|
||||
}
|
||||
+ public final IRegistry<BiomeBase> biomeRegistry;
|
||||
+ // CraftBukkit end
|
||||
|
||||
private static void replaceMissingSections(LevelHeightAccessor levelheightaccessor, IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
|
||||
for (int i = 0; i < achunksection.length; ++i) {
|
||||
@@ -392,6 +396,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void setBiome(int i, int j, int k, BiomeBase biome) {
|
||||
+ try {
|
||||
+ int l = QuartPos.fromBlock(this.getMinBuildHeight());
|
||||
+ int i1 = l + QuartPos.fromBlock(this.getHeight()) - 1;
|
||||
+ int j1 = MathHelper.clamp(j, l, i1);
|
||||
+ int k1 = this.getSectionIndex(QuartPos.toBlock(j1));
|
||||
+
|
||||
+ this.sections[k1].setBiome(i & 3, j1 & 3, k & 3, biome);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ CrashReport crashreport = CrashReport.forThrowable(throwable, "Setting biome");
|
||||
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Biome being set");
|
||||
+
|
||||
+ crashreportsystemdetails.setDetail("Location", () -> {
|
||||
+ return CrashReportSystemDetails.formatLocation(this, i, j, k);
|
||||
+ });
|
||||
+ throw new ReportedException(crashreport);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler) {
|
||||
ChunkCoordIntPair chunkcoordintpair = this.getPos();
|
||||
int i = QuartPos.fromBlock(chunkcoordintpair.getMinBlockX());
|
||||
@@ -423,8 +448,10 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
- public static final class a extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ public static final record a(SerializableTickContainer<Block> blocks, SerializableTickContainer<FluidType> fluids) {
|
||||
|
||||
+ /*
|
||||
private final SerializableTickContainer<Block> blocks;
|
||||
private final SerializableTickContainer<FluidType> fluids;
|
||||
|
||||
@@ -444,6 +471,8 @@
|
||||
public final boolean equals(Object object) {
|
||||
return this.equals<invokedynamic>(this, object);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public SerializableTickContainer<Block> blocks() {
|
||||
return this.blocks;
|
||||
@@ -1,38 +1,45 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
@@ -163,6 +163,12 @@
|
||||
@@ -190,7 +190,7 @@
|
||||
dataresult = BelowZeroRetrogen.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("below_zero_retrogen")));
|
||||
logger1 = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger1);
|
||||
- Optional optional = dataresult.resultOrPartial(logger1::error);
|
||||
+ Optional<BelowZeroRetrogen> optional = dataresult.resultOrPartial(logger1::error); // CraftBukkit - decompile error
|
||||
|
||||
object = new Chunk(worldserver.getLevel(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, k, achunksection, (chunk) -> {
|
||||
loadEntities(worldserver, nbttagcompound1, chunk);
|
||||
+ // CraftBukkit start - load chunk persistent data from nbt
|
||||
+ net.minecraft.nbt.NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues");
|
||||
+ if (persistentBase instanceof NBTTagCompound) {
|
||||
+ chunk.persistentDataContainer.putAll((NBTTagCompound) persistentBase);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
} else {
|
||||
ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver);
|
||||
@@ -294,8 +300,9 @@
|
||||
boolean flag = ichunkaccess.s();
|
||||
Objects.requireNonNull(protochunk);
|
||||
optional.ifPresent(protochunk::setBelowZeroRetrogen);
|
||||
@@ -321,7 +321,7 @@
|
||||
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
|
||||
nbttagcompound.putString("Status", ichunkaccess.getStatus().getName());
|
||||
BlendingData blendingdata = ichunkaccess.getBlendingData();
|
||||
- DataResult dataresult;
|
||||
+ DataResult<NBTBase> dataresult; // CraftBukkit - decompile error
|
||||
Logger logger;
|
||||
|
||||
for (int i = lightenginethreaded.c(); i < lightenginethreaded.d(); ++i) {
|
||||
+ int finalI = i; // CraftBukkit - decompile errors
|
||||
ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> {
|
||||
- return chunksection1 != null && SectionPosition.a(chunksection1.getYPosition()) == i;
|
||||
+ return chunksection1 != null && SectionPosition.a(chunksection1.getYPosition()) == finalI; // CraftBukkit - decompile errors
|
||||
}).findFirst().orElse(Chunk.EMPTY_SECTION);
|
||||
NibbleArray nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i));
|
||||
NibbleArray nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i));
|
||||
@@ -403,6 +410,11 @@
|
||||
if (blendingdata != null) {
|
||||
@@ -452,6 +452,11 @@
|
||||
|
||||
nbttagcompound1.set("Heightmaps", nbttagcompound3);
|
||||
nbttagcompound1.set("Structures", a(worldserver, chunkcoordintpair, ichunkaccess.g(), ichunkaccess.w()));
|
||||
nbttagcompound.put("Heightmaps", nbttagcompound3);
|
||||
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));
|
||||
+ // CraftBukkit start - store chunk persistent data in nbt
|
||||
+ if (ichunkaccess instanceof Chunk && !((Chunk) ichunkaccess).persistentDataContainer.isEmpty()) {
|
||||
+ nbttagcompound1.set("ChunkBukkitValues", ((Chunk) ichunkaccess).persistentDataContainer.toTagCompound());
|
||||
+ nbttagcompound.put("ChunkBukkitValues", ((Chunk) ichunkaccess).persistentDataContainer.toTagCompound());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -498,6 +503,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - load chunk persistent data from nbt
|
||||
+ net.minecraft.nbt.NBTBase persistentBase = nbttagcompound.get("ChunkBukkitValues");
|
||||
+ if (persistentBase instanceof NBTTagCompound) {
|
||||
+ chunk.persistentDataContainer.putAll((NBTTagCompound) persistentBase);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
@@ -33,10 +33,10 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final String ENTITIES_TAG = "Entities";
|
||||
private static final String POSITION_TAG = "Position";
|
||||
- private final WorldServer level;
|
||||
+ public final WorldServer level; // PAIL private -> public
|
||||
private final IOWorker worker;
|
||||
private final LongSet emptyChunks = new LongOpenHashSet();
|
||||
- private final ThreadedMailbox<Runnable> entityDeserializerQueue;
|
||||
+ public final ThreadedMailbox<Runnable> entityDeserializerQueue; // PAIL private -> public
|
||||
protected final DataFixer fixerUpper;
|
||||
|
||||
public EntityStorage(WorldServer worldserver, File file, DataFixer datafixer, boolean flag, Executor executor) {
|
||||
@@ -51,8 +51,8 @@
|
||||
if (this.emptyChunks.contains(chunkcoordintpair.pair())) {
|
||||
return CompletableFuture.completedFuture(b(chunkcoordintpair));
|
||||
} else {
|
||||
- CompletableFuture completablefuture = this.worker.b(chunkcoordintpair);
|
||||
- Function function = (nbttagcompound) -> {
|
||||
+ CompletableFuture<NBTTagCompound> completablefuture = this.worker.b(chunkcoordintpair); // CraftBukkit - decompile error
|
||||
+ Function<NBTTagCompound, ChunkEntities<Entity>> function = (nbttagcompound) -> { // CraftBukkit - decompile error
|
||||
if (nbttagcompound == null) {
|
||||
this.emptyChunks.add(chunkcoordintpair.pair());
|
||||
return b(chunkcoordintpair);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
||||
@@ -15,6 +15,14 @@
|
||||
@@ -18,6 +18,14 @@
|
||||
import net.minecraft.world.level.levelgen.structure.PersistentStructureLegacy;
|
||||
import net.minecraft.world.level.storage.WorldPersistentData;
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
+
|
||||
public class IChunkLoader implements AutoCloseable {
|
||||
|
||||
private final IOWorker worker;
|
||||
@@ -27,10 +35,49 @@
|
||||
this.worker = new IOWorker(file, flag, "chunk");
|
||||
public static final int LAST_MONOLYTH_STRUCTURE_DATA_VERSION = 1493;
|
||||
@@ -31,9 +39,48 @@
|
||||
this.worker = new IOWorker(path, flag, "chunk");
|
||||
}
|
||||
|
||||
- public NBTTagCompound getChunkData(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound) {
|
||||
- public NBTTagCompound upgradeChunkTag(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
|
||||
+ // CraftBukkit start
|
||||
+ private boolean check(ChunkProviderServer cps, int x, int z) throws IOException {
|
||||
+ ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
|
||||
+ if (cps != null) {
|
||||
+ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread");
|
||||
+ if (cps.isLoaded(x, z)) {
|
||||
+ if (cps.hasChunk(x, z)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
@@ -37,8 +37,8 @@
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ ChunkStatus status = ChunkStatus.a(level.getString("Status"));
|
||||
+ if (status != null && status.b(ChunkStatus.FEATURES)) {
|
||||
+ ChunkStatus status = ChunkStatus.byName(level.getString("Status"));
|
||||
+ if (status != null && status.isOrAfter(ChunkStatus.FEATURES)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
@@ -46,23 +46,31 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public NBTTagCompound getChunkData(ResourceKey<DimensionManager> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) throws IOException {
|
||||
+ public NBTTagCompound upgradeChunkTag(ResourceKey<DimensionManager> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) throws IOException {
|
||||
+ // CraftBukkit end
|
||||
int i = a(nbttagcompound);
|
||||
boolean flag = true;
|
||||
int i = getVersion(nbttagcompound);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (i < 1466) {
|
||||
+ NBTTagCompound level = nbttagcompound.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProvider();
|
||||
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkSource();
|
||||
+ if (check(cps, pos.x - 1, pos.z) && check(cps, pos.x - 1, pos.z - 1) && check(cps, pos.x, pos.z - 1)) {
|
||||
+ level.setBoolean("LightPopulated", true);
|
||||
+ level.putBoolean("LightPopulated", true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i < 1493) {
|
||||
nbttagcompound = GameProfileSerializer.a(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
|
||||
nbttagcompound = GameProfileSerializer.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
@@ -55,7 +102,7 @@
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
- public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<World> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
|
||||
+ public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<DimensionManager> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) { // CraftBukkit
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.putString("dimension", resourcekey.location().toString());
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package net.minecraft.world.level.chunk.storage;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -60,8 +61,8 @@
|
||||
@@ -57,8 +58,8 @@
|
||||
} else {
|
||||
this.externalFileDir = path1;
|
||||
this.offsets = this.header.asIntBuffer();
|
||||
@@ -16,16 +16,16 @@
|
||||
this.timestamps = this.header.asIntBuffer();
|
||||
if (flag) {
|
||||
this.file = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.DSYNC);
|
||||
@@ -70,7 +71,7 @@
|
||||
@@ -67,7 +68,7 @@
|
||||
}
|
||||
|
||||
this.usedSectors.a(0, 2);
|
||||
this.usedSectors.force(0, 2);
|
||||
- this.header.position(0);
|
||||
+ ((java.nio.Buffer) this.header).position(0); // CraftBukkit - decompile error
|
||||
int i = this.file.read(this.header, 0L);
|
||||
|
||||
if (i != -1) {
|
||||
@@ -125,7 +126,7 @@
|
||||
@@ -122,7 +123,7 @@
|
||||
ByteBuffer bytebuffer = ByteBuffer.allocate(l);
|
||||
|
||||
this.file.read(bytebuffer, (long) (j * 4096));
|
||||
@@ -34,7 +34,7 @@
|
||||
if (bytebuffer.remaining() < 5) {
|
||||
RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", chunkcoordintpair, l, bytebuffer.remaining());
|
||||
return null;
|
||||
@@ -227,7 +228,7 @@
|
||||
@@ -224,7 +225,7 @@
|
||||
|
||||
try {
|
||||
this.file.read(bytebuffer, (long) (j * 4096));
|
||||
@@ -43,16 +43,16 @@
|
||||
if (bytebuffer.remaining() != 5) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -330,7 +331,7 @@
|
||||
@@ -327,7 +328,7 @@
|
||||
|
||||
bytebuffer.putInt(1);
|
||||
bytebuffer.put((byte) (this.version.a() | 128));
|
||||
bytebuffer.put((byte) (this.version.getId() | 128));
|
||||
- bytebuffer.flip();
|
||||
+ ((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error
|
||||
return bytebuffer;
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@
|
||||
@@ -336,7 +337,7 @@
|
||||
FileChannel filechannel = FileChannel.open(path1, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
|
||||
|
||||
try {
|
||||
@@ -61,16 +61,16 @@
|
||||
filechannel.write(bytebuffer);
|
||||
} catch (Throwable throwable) {
|
||||
if (filechannel != null) {
|
||||
@@ -363,7 +364,7 @@
|
||||
@@ -360,7 +361,7 @@
|
||||
}
|
||||
|
||||
private void d() throws IOException {
|
||||
private void writeHeader() throws IOException {
|
||||
- this.header.position(0);
|
||||
+ ((java.nio.Buffer) this.header).position(0); // CraftBukkit - decompile error
|
||||
this.file.write(this.header, 0L);
|
||||
}
|
||||
|
||||
@@ -399,7 +400,7 @@
|
||||
@@ -396,7 +397,7 @@
|
||||
if (i != j) {
|
||||
ByteBuffer bytebuffer = RegionFile.PADDING_BUFFER.duplicate();
|
||||
|
||||
|
||||
@@ -1,42 +1,56 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
@@ -27,7 +27,7 @@
|
||||
@@ -29,7 +29,7 @@
|
||||
this.sync = flag;
|
||||
}
|
||||
|
||||
- private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
+ private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit
|
||||
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
|
||||
- private RegionFile getRegionFile(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
+ private RegionFile getRegionFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit
|
||||
long i = ChunkCoordIntPair.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
|
||||
RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
File file = this.folder;
|
||||
@@ -44,6 +44,7 @@
|
||||
Path path = this.folder;
|
||||
int j = chunkcoordintpair.getRegionX();
|
||||
File file1 = new File(file, "r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||
+ if (existingOnly && !file1.exists()) return null; // CraftBukkit
|
||||
RegionFile regionfile1 = new RegionFile(file1, this.folder, this.sync);
|
||||
Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||
+ if (existingOnly && !Files.exists(path1)) return null; // CraftBukkit
|
||||
RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
|
||||
|
||||
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
||||
@@ -54,7 +55,12 @@
|
||||
@@ -53,7 +54,12 @@
|
||||
|
||||
@Nullable
|
||||
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
||||
- RegionFile regionfile = this.getRegionFile(chunkcoordintpair);
|
||||
+ // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
||||
+ RegionFile regionfile = this.getFile(chunkcoordintpair, true);
|
||||
+ RegionFile regionfile = this.getRegionFile(chunkcoordintpair, true);
|
||||
+ if (regionfile == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
|
||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkcoordintpair);
|
||||
|
||||
NBTTagCompound nbttagcompound;
|
||||
@@ -94,7 +100,7 @@
|
||||
@@ -93,7 +99,12 @@
|
||||
}
|
||||
|
||||
public void scanChunk(ChunkCoordIntPair chunkcoordintpair, StreamTagVisitor streamtagvisitor) throws IOException {
|
||||
- RegionFile regionfile = this.getRegionFile(chunkcoordintpair);
|
||||
+ // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
||||
+ RegionFile regionfile = this.getRegionFile(chunkcoordintpair, true);
|
||||
+ if (regionfile == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkcoordintpair);
|
||||
|
||||
try {
|
||||
@@ -119,7 +130,7 @@
|
||||
}
|
||||
|
||||
protected void write(ChunkCoordIntPair chunkcoordintpair, @Nullable NBTTagCompound nbttagcompound) throws IOException {
|
||||
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
||||
+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
|
||||
- RegionFile regionfile = this.getRegionFile(chunkcoordintpair);
|
||||
+ RegionFile regionfile = this.getRegionFile(chunkcoordintpair, false); // CraftBukkit
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
regionfile.d(chunkcoordintpair);
|
||||
regionfile.clear(chunkcoordintpair);
|
||||
|
||||
Reference in New Issue
Block a user