@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/level/chunk/BiomeStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/BiomeStorage.java
|
||||
@@ -93,4 +93,14 @@
|
||||
@@ -109,4 +109,14 @@
|
||||
|
||||
return this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l];
|
||||
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.b;
|
||||
+ int i1 = MathHelper.clamp(j, 0, BiomeStorage.c);
|
||||
+ int j1 = k & BiomeStorage.b;
|
||||
+ int l = i & BiomeStorage.HORIZONTAL_MASK;
|
||||
+ int i1 = MathHelper.clamp(j - this.quartMinY, 0, this.quartHeight);
|
||||
+ int j1 = k & BiomeStorage.HORIZONTAL_MASK;
|
||||
+
|
||||
+ this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l] = biome;
|
||||
+ 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
|
||||
@@ -65,7 +65,7 @@
|
||||
private BiomeStorage d;
|
||||
private final Map<BlockPosition, NBTTagCompound> e;
|
||||
@@ -92,7 +92,7 @@
|
||||
private final Map<BlockPosition, NBTTagCompound> pendingBlockEntities;
|
||||
private final Map<BlockPosition, Chunk.c> tickersInLevel;
|
||||
public boolean loaded;
|
||||
- public final World world;
|
||||
+ public final WorldServer world; // CraftBukkit - type
|
||||
public final Map<HeightMap.Type, HeightMap> heightMap;
|
||||
private final ChunkConverter i;
|
||||
public final Map<BlockPosition, TileEntity> tileEntities;
|
||||
@@ -99,7 +99,7 @@
|
||||
this.m = Maps.newHashMap();
|
||||
this.n = new ShortList[16];
|
||||
this.entitySlices = (EntitySlice[]) (new EntitySlice[16]);
|
||||
- this.world = world;
|
||||
+ this.world = (WorldServer) world; // CraftBukkit - type
|
||||
this.loc = chunkcoordintpair;
|
||||
this.i = chunkconverter;
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
@@ -130,8 +130,22 @@
|
||||
}
|
||||
- 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();
|
||||
- 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()];
|
||||
+ // CraftBukkit start
|
||||
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
}
|
||||
@@ -38,18 +38,18 @@
|
||||
+ public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public Chunk(World world, ProtoChunk protochunk) {
|
||||
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
|
||||
Iterator iterator = protochunk.y().iterator();
|
||||
@@ -173,6 +187,7 @@
|
||||
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 @@
|
||||
|
||||
this.b(protochunk.r());
|
||||
this.s = true;
|
||||
this.b(protochunk.s());
|
||||
this.unsaved = true;
|
||||
+ this.needsDecoration = true; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,9 +278,16 @@
|
||||
@@ -285,9 +300,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,54 +63,54 @@
|
||||
+ @Nullable
|
||||
+ public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
|
||||
+ // CraftBukkit end
|
||||
int i = blockposition.getX() & 15;
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ() & 15;
|
||||
@@ -317,7 +339,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.world.isClientSide) {
|
||||
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.world.isClientSide && doPlace && (!this.world.captureBlockStates || block instanceof net.minecraft.world.level.block.BlockTileEntity)) {
|
||||
iblockdata.onPlace(this.world, blockposition, iblockdata1, flag);
|
||||
+ if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BlockTileEntity)) {
|
||||
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
|
||||
}
|
||||
|
||||
@@ -412,7 +435,12 @@
|
||||
@@ -401,7 +424,12 @@
|
||||
|
||||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
- TileEntity tileentity = (TileEntity) this.tileEntities.get(blockposition);
|
||||
- TileEntity tileentity = (TileEntity) this.blockEntities.get(blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ TileEntity tileentity = world.capturedTileEntities.get(blockposition);
|
||||
+ TileEntity tileentity = level.capturedTileEntities.get(blockposition);
|
||||
+ if (tileentity == null) {
|
||||
+ tileentity = (TileEntity) this.tileEntities.get(blockposition);
|
||||
+ tileentity = (TileEntity) this.blockEntities.get(blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
|
||||
@@ -458,6 +486,13 @@
|
||||
tileentity1.al_();
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
|
||||
@@ -460,6 +488,13 @@
|
||||
tileentity1.aa_();
|
||||
}
|
||||
|
||||
+ // 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("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
|
||||
+ System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
+ new Exception().printStackTrace();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,6 +542,50 @@
|
||||
@@ -541,6 +576,50 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void loadCallback() {
|
||||
+ org.bukkit.Server server = this.world.getServer();
|
||||
+ org.bukkit.Server server = this.level.getServer();
|
||||
+ if (server != null) {
|
||||
+ /*
|
||||
+ * If it's a new world, the first few chunks are generated inside
|
||||
@@ -122,20 +122,20 @@
|
||||
+ if (this.needsDecoration) {
|
||||
+ this.needsDecoration = false;
|
||||
+ java.util.Random random = new java.util.Random();
|
||||
+ random.setSeed(world.getSeed());
|
||||
+ random.setSeed(level.getSeed());
|
||||
+ long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ random.setSeed((long) this.loc.x * xRand + (long) this.loc.z * zRand ^ world.getSeed());
|
||||
+ random.setSeed((long) this.chunkPos.x * xRand + (long) this.chunkPos.z * zRand ^ level.getSeed());
|
||||
+
|
||||
+ org.bukkit.World world = this.world.getWorld();
|
||||
+ org.bukkit.World world = this.level.getWorld();
|
||||
+ if (world != null) {
|
||||
+ this.world.populating = true;
|
||||
+ this.level.populating = true;
|
||||
+ try {
|
||||
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
+ populator.populate(world, random, bukkitChunk);
|
||||
+ }
|
||||
+ } finally {
|
||||
+ this.world.populating = false;
|
||||
+ this.level.populating = false;
|
||||
+ }
|
||||
+ }
|
||||
+ server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
@@ -144,7 +144,7 @@
|
||||
+ }
|
||||
+
|
||||
+ public void unloadCallback() {
|
||||
+ org.bukkit.Server server = this.world.getServer();
|
||||
+ org.bukkit.Server server = this.level.getServer();
|
||||
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isNeedsSaving());
|
||||
+ server.getPluginManager().callEvent(unloadEvent);
|
||||
+ // note: saving can be prevented, but not forced if no saving is actually required
|
||||
@@ -153,65 +153,76 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void markDirty() {
|
||||
this.s = true;
|
||||
this.unsaved = true;
|
||||
}
|
||||
@@ -560,7 +639,7 @@
|
||||
Iterator iterator = this.entitySlices[k].a(Entity.class).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- Entity entity = (Entity) iterator.next();
|
||||
+ T entity = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
|
||||
list.add(entity);
|
||||
@@ -581,7 +660,7 @@
|
||||
Iterator iterator = this.entitySlices[k].a(oclass).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- T t0 = (Entity) iterator.next();
|
||||
+ T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
|
||||
list.add(t0);
|
||||
@@ -655,7 +734,7 @@
|
||||
@@ -664,7 +743,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isNeedsSaving() {
|
||||
- return this.s || this.q && this.world.getTime() != this.lastSaved;
|
||||
+ return (this.s || this.q && this.world.getTime() != this.lastSaved) && !this.mustNotSave; // CraftBukkit
|
||||
- return this.unsaved;
|
||||
+ return this.unsaved && !this.mustNotSave; // CraftBukkit
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
@@ -797,7 +876,7 @@
|
||||
@Nullable
|
||||
@@ -795,7 +874,7 @@
|
||||
|
||||
public void B() {
|
||||
if (this.o instanceof ProtoChunkTickList) {
|
||||
- ((ProtoChunkTickList) this.o).a(this.world.getBlockTickList(), (blockposition) -> {
|
||||
+ ((ProtoChunkTickList<Block>) this.o).a(this.world.getBlockTickList(), (blockposition) -> { // CraftBukkit - decompile error
|
||||
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.o = TickListEmpty.b();
|
||||
@@ -807,7 +886,7 @@
|
||||
this.blockTicks = TickListEmpty.b();
|
||||
@@ -805,7 +884,7 @@
|
||||
}
|
||||
|
||||
if (this.p instanceof ProtoChunkTickList) {
|
||||
- ((ProtoChunkTickList) this.p).a(this.world.getFluidTickList(), (blockposition) -> {
|
||||
+ ((ProtoChunkTickList<FluidType>) this.p).a(this.world.getFluidTickList(), (blockposition) -> { // CraftBukkit - decompile error
|
||||
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.p = TickListEmpty.b();
|
||||
@@ -819,12 +898,12 @@
|
||||
}
|
||||
|
||||
this.liquidTicks = TickListEmpty.b();
|
||||
@@ -819,14 +898,14 @@
|
||||
public void a(WorldServer worldserver) {
|
||||
- if (this.o == TickListEmpty.b()) {
|
||||
+ if (this.o == TickListEmpty.<Block>b()) { // CraftBukkit - decompile error
|
||||
this.o = new TickListChunk<>(IRegistry.BLOCK::getKey, worldserver.getBlockTickList().a(this.loc, true, false), worldserver.getTime());
|
||||
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.p == TickListEmpty.b()) {
|
||||
+ if (this.p == TickListEmpty.<FluidType>b()) { // CraftBukkit - decompile error
|
||||
this.p = new TickListChunk<>(IRegistry.FLUID::getKey, worldserver.getFluidTickList().a(this.loc, 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 +978,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
|
||||
|
||||
if (blockentityticker == null) {
|
||||
this.l(t0.getPosition());
|
||||
@@ -978,7 +1057,7 @@
|
||||
private boolean loggedInvalidBlockState;
|
||||
|
||||
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {
|
||||
- this.blockEntity = tileentity;
|
||||
+ this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
||||
this.ticker = blockentityticker;
|
||||
}
|
||||
|
||||
@@ -1001,7 +1080,7 @@
|
||||
this.loggedInvalidBlockState = true;
|
||||
Chunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new org.apache.logging.log4j.util.Supplier[]{this::d, this::c, () -> {
|
||||
return iblockdata;
|
||||
- }});
|
||||
+ }}); // CraftBukkit - squelch checkstyle
|
||||
}
|
||||
|
||||
gameprofilerfiller.exit();
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -246,7 +246,16 @@
|
||||
@@ -269,7 +269,16 @@
|
||||
while (iterator.hasNext()) {
|
||||
Supplier<StructureFeature<?, ?>> supplier = (Supplier) iterator.next();
|
||||
|
||||
- this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
|
||||
- this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ // CraftBukkit start
|
||||
+ StructureFeature<?, ?> structurefeature = (StructureFeature) supplier.get();
|
||||
+ if (structurefeature.c == StructureGenerator.STRONGHOLD) {
|
||||
+ if (structurefeature.LIST_CODEC == StructureGenerator.STRONGHOLD) {
|
||||
+ synchronized (structurefeature) {
|
||||
+ this.a(structurefeature, iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
|
||||
+ this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ }
|
||||
+ } else {
|
||||
+ this.a(structurefeature, iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
|
||||
+ this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, biomebase);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -330,9 +339,11 @@
|
||||
@@ -364,9 +373,11 @@
|
||||
}
|
||||
|
||||
static {
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", (Object) ChunkGeneratorAbstract.d);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", (Object) ChunkProviderFlat.d);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", (Object) ChunkProviderDebug.d);
|
||||
- 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.d);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", ChunkProviderFlat.d);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", ChunkProviderDebug.d);
|
||||
+ 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
|
||||
a = IRegistry.CHUNK_GENERATOR.dispatchStable(ChunkGenerator::a, Function.identity());
|
||||
CODEC = IRegistry.CHUNK_GENERATOR.dispatchStable(ChunkGenerator::a, Function.identity());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
@@ -38,7 +38,7 @@
|
||||
@@ -39,7 +39,7 @@
|
||||
});
|
||||
public static final ChunkStatus STRUCTURE_STARTS = a("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.n, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, worldserver, chunkgenerator, definedstructuremanager, lightenginethreaded, function, list, ichunkaccess) -> {
|
||||
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.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures()) { // CraftBukkit
|
||||
chunkgenerator.createStructures(worldserver.r(), worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
|
||||
+ if (worldserver.serverLevelData.getGeneratorSettings().shouldGenerateMapFeatures()) { // CraftBukkit
|
||||
chunkgenerator.createStructures(worldserver.t(), worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
@@ -112,7 +112,7 @@
|
||||
return (CompletableFuture) function.apply(ichunkaccess);
|
||||
});
|
||||
private static final List<ChunkStatus> q = 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 r = (IntList) SystemUtils.a((Object) (new IntArrayList(a().size())), (intarraylist) -> {
|
||||
+ private static final IntList r = (IntList) SystemUtils.a((new IntArrayList(a().size())), (java.util.function.Consumer<IntArrayList>) (intarraylist) -> { // CraftBukkit - decompile error
|
||||
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) {
|
||||
|
||||
@@ -1,27 +1,9 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
@@ -133,7 +133,7 @@
|
||||
@@ -163,6 +163,12 @@
|
||||
|
||||
if (nbttagcompound1.hasKeyOfType("TileTicks", 9)) {
|
||||
nbttaglist1 = nbttagcompound1.getList("TileTicks", 10);
|
||||
- function = IRegistry.BLOCK::getKey;
|
||||
+ function = (block) -> IRegistry.BLOCK.getKey((Block) block); // CraftBukkit - decompile error
|
||||
registryblocks = IRegistry.BLOCK;
|
||||
registryblocks.getClass();
|
||||
object1 = TickListChunk.a(nbttaglist1, function, registryblocks::get);
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
if (nbttagcompound1.hasKeyOfType("LiquidTicks", 9)) {
|
||||
nbttaglist1 = nbttagcompound1.getList("LiquidTicks", 10);
|
||||
- function = IRegistry.FLUID::getKey;
|
||||
+ function = (fluid) -> IRegistry.FLUID.getKey((FluidType) fluid); // CraftBukkit - decompile error
|
||||
registryblocks = IRegistry.FLUID;
|
||||
registryblocks.getClass();
|
||||
object2 = TickListChunk.a(nbttaglist1, function, registryblocks::get);
|
||||
@@ -155,6 +155,12 @@
|
||||
|
||||
object = new Chunk(worldserver.getMinecraftWorld(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, (chunk) -> {
|
||||
loadEntities(nbttagcompound1, chunk);
|
||||
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) {
|
||||
@@ -30,28 +12,27 @@
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
} else {
|
||||
ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1);
|
||||
@@ -288,8 +294,9 @@
|
||||
NBTTagCompound nbttagcompound2;
|
||||
ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver);
|
||||
@@ -294,8 +300,9 @@
|
||||
boolean flag = ichunkaccess.s();
|
||||
|
||||
for (int i = -1; i < 17; ++i) {
|
||||
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 && chunksection1.getYPosition() >> 4 == i;
|
||||
+ return chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI; // CraftBukkit - decompile errors
|
||||
}).findFirst().orElse(Chunk.a);
|
||||
- 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));
|
||||
@@ -344,6 +351,12 @@
|
||||
if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.LEVELCHUNK) {
|
||||
Chunk chunk = (Chunk) ichunkaccess;
|
||||
@@ -403,6 +410,11 @@
|
||||
|
||||
+ // CraftBukkit start - store chunk persistent data in nbt
|
||||
+ if (!chunk.persistentDataContainer.isEmpty()) {
|
||||
+ nbttagcompound1.set("ChunkBukkitValues", chunk.persistentDataContainer.toTagCompound());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
chunk.d(false);
|
||||
nbttagcompound1.set("Heightmaps", nbttagcompound3);
|
||||
nbttagcompound1.set("Structures", a(worldserver, chunkcoordintpair, ichunkaccess.g(), ichunkaccess.w()));
|
||||
+ // CraftBukkit start - store chunk persistent data in nbt
|
||||
+ if (ichunkaccess instanceof Chunk && !((Chunk) ichunkaccess).persistentDataContainer.isEmpty()) {
|
||||
+ nbttagcompound1.set("ChunkBukkitValues", ((Chunk) ichunkaccess).persistentDataContainer.toTagCompound());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
for (int j = 0; j < chunk.getEntitySlices().length; ++j) {
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
+
|
||||
public class IChunkLoader implements AutoCloseable {
|
||||
|
||||
private final IOWorker a;
|
||||
private final IOWorker worker;
|
||||
@@ -27,10 +35,49 @@
|
||||
this.a = new IOWorker(file, flag, "chunk");
|
||||
this.worker = new IOWorker(file, flag, "chunk");
|
||||
}
|
||||
|
||||
- public NBTTagCompound getChunkData(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound) {
|
||||
@@ -64,5 +64,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i < 1493) {
|
||||
nbttagcompound = GameProfileSerializer.a(this.b, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
|
||||
nbttagcompound = GameProfileSerializer.a(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
|
||||
@@ -5,77 +5,77 @@
|
||||
package net.minecraft.world.level.chunk.storage;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -51,8 +52,8 @@
|
||||
@@ -60,8 +61,8 @@
|
||||
} else {
|
||||
this.e = path1;
|
||||
this.h = this.g.asIntBuffer();
|
||||
- this.h.limit(1024);
|
||||
- this.g.position(4096);
|
||||
+ ((java.nio.Buffer) this.h).limit(1024); // CraftBukkit - decompile error
|
||||
+ ((java.nio.Buffer) this.g).position(4096); // CraftBukkit - decompile error
|
||||
this.i = this.g.asIntBuffer();
|
||||
this.externalFileDir = path1;
|
||||
this.offsets = this.header.asIntBuffer();
|
||||
- this.offsets.limit(1024);
|
||||
- this.header.position(4096);
|
||||
+ ((java.nio.Buffer) this.offsets).limit(1024); // CraftBukkit - decompile error
|
||||
+ ((java.nio.Buffer) this.header).position(4096); // CraftBukkit - decompile error
|
||||
this.timestamps = this.header.asIntBuffer();
|
||||
if (flag) {
|
||||
this.dataFile = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.DSYNC);
|
||||
@@ -61,7 +62,7 @@
|
||||
this.file = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.DSYNC);
|
||||
@@ -70,7 +71,7 @@
|
||||
}
|
||||
|
||||
this.freeSectors.a(0, 2);
|
||||
- this.g.position(0);
|
||||
+ ((java.nio.Buffer) this.g).position(0); // CraftBukkit - decompile error
|
||||
int i = this.dataFile.read(this.g, 0L);
|
||||
this.usedSectors.a(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) {
|
||||
@@ -116,7 +117,7 @@
|
||||
@@ -125,7 +126,7 @@
|
||||
ByteBuffer bytebuffer = ByteBuffer.allocate(l);
|
||||
|
||||
this.dataFile.read(bytebuffer, (long) (j * 4096));
|
||||
this.file.read(bytebuffer, (long) (j * 4096));
|
||||
- bytebuffer.flip();
|
||||
+ ((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error
|
||||
if (bytebuffer.remaining() < 5) {
|
||||
RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", chunkcoordintpair, l, bytebuffer.remaining());
|
||||
return null;
|
||||
@@ -214,7 +215,7 @@
|
||||
@@ -227,7 +228,7 @@
|
||||
|
||||
try {
|
||||
this.dataFile.read(bytebuffer, (long) (j * 4096));
|
||||
this.file.read(bytebuffer, (long) (j * 4096));
|
||||
- bytebuffer.flip();
|
||||
+ ((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error
|
||||
if (bytebuffer.remaining() != 5) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -306,7 +307,7 @@
|
||||
@@ -330,7 +331,7 @@
|
||||
|
||||
bytebuffer.putInt(1);
|
||||
bytebuffer.put((byte) (this.f.a() | 128));
|
||||
bytebuffer.put((byte) (this.version.a() | 128));
|
||||
- bytebuffer.flip();
|
||||
+ ((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error
|
||||
return bytebuffer;
|
||||
}
|
||||
|
||||
@@ -316,7 +317,7 @@
|
||||
Throwable throwable = null;
|
||||
@@ -339,7 +340,7 @@
|
||||
FileChannel filechannel = FileChannel.open(path1, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
|
||||
|
||||
try {
|
||||
- bytebuffer.position(5);
|
||||
+ ((java.nio.Buffer) bytebuffer).position(5); // CraftBukkit - decompile error
|
||||
filechannel.write(bytebuffer);
|
||||
} catch (Throwable throwable1) {
|
||||
throwable = throwable1;
|
||||
@@ -342,7 +343,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
if (filechannel != null) {
|
||||
@@ -363,7 +364,7 @@
|
||||
}
|
||||
|
||||
private void c() throws IOException {
|
||||
- this.g.position(0);
|
||||
+ ((java.nio.Buffer) this.g).position(0); // CraftBukkit - decompile error
|
||||
this.dataFile.write(this.g, 0L);
|
||||
private void d() throws IOException {
|
||||
- this.header.position(0);
|
||||
+ ((java.nio.Buffer) this.header).position(0); // CraftBukkit - decompile error
|
||||
this.file.write(this.header, 0L);
|
||||
}
|
||||
|
||||
@@ -378,7 +379,7 @@
|
||||
@@ -399,7 +400,7 @@
|
||||
if (i != j) {
|
||||
ByteBuffer bytebuffer = RegionFile.c.duplicate();
|
||||
ByteBuffer bytebuffer = RegionFile.PADDING_BUFFER.duplicate();
|
||||
|
||||
- bytebuffer.position(0);
|
||||
+ ((java.nio.Buffer) bytebuffer).position(0); // CraftBukkit - decompile error
|
||||
this.dataFile.write(bytebuffer, (long) (j - 1));
|
||||
this.file.write(bytebuffer, (long) (j - 1));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
@@ -25,7 +25,7 @@
|
||||
this.c = flag;
|
||||
@@ -27,7 +27,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());
|
||||
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
|
||||
RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
}
|
||||
@@ -45,6 +45,7 @@
|
||||
File file = 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);
|
||||
|
||||
File file = new File(this.b, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||
+ if (existingOnly && !file.exists()) return null; // CraftBukkit
|
||||
RegionFile regionfile1 = new RegionFile(file, this.b, this.c);
|
||||
|
||||
this.cache.putAndMoveToFirst(i, regionfile1);
|
||||
@@ -50,7 +51,12 @@
|
||||
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
||||
@@ -54,7 +55,12 @@
|
||||
|
||||
@Nullable
|
||||
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
@@ -29,14 +29,14 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
|
||||
Throwable throwable = null;
|
||||
|
||||
@@ -85,7 +91,7 @@
|
||||
NBTTagCompound nbttagcompound;
|
||||
@@ -94,7 +100,7 @@
|
||||
}
|
||||
|
||||
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
||||
protected void write(ChunkCoordIntPair chunkcoordintpair, @Nullable NBTTagCompound nbttagcompound) throws IOException {
|
||||
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
||||
+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
|
||||
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
||||
Throwable throwable = null;
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
regionfile.d(chunkcoordintpair);
|
||||
|
||||
Reference in New Issue
Block a user