@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -75,7 +75,7 @@
|
||||
@@ -77,7 +77,7 @@
|
||||
};
|
||||
private final Map<BlockPosition, Chunk.d> tickersInLevel;
|
||||
public boolean loaded;
|
||||
@@ -9,7 +9,7 @@
|
||||
@Nullable
|
||||
private Supplier<FullChunkStatus> fullStatus;
|
||||
@Nullable
|
||||
@@ -91,7 +91,7 @@
|
||||
@@ -93,7 +93,7 @@
|
||||
public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, LevelChunkTicks<Block> levelchunkticks, LevelChunkTicks<FluidType> levelchunkticks1, long i, @Nullable ChunkSection[] achunksection, @Nullable Chunk.c chunk_c, @Nullable BlendingData blendingdata) {
|
||||
super(chunkcoordintpair, chunkconverter, world, world.registryAccess().registryOrThrow(Registries.BIOME), i, achunksection, blendingdata);
|
||||
this.tickersInLevel = Maps.newHashMap();
|
||||
@@ -18,7 +18,7 @@
|
||||
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
int j = aheightmap_type.length;
|
||||
@@ -109,6 +109,11 @@
|
||||
@@ -111,6 +111,11 @@
|
||||
this.fluidTicks = levelchunkticks1;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,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();
|
||||
@@ -140,6 +145,10 @@
|
||||
@@ -142,6 +147,10 @@
|
||||
this.skyLightSources = protochunk.skyLightSources;
|
||||
this.setLightCorrect(protochunk.isLightCorrect());
|
||||
this.unsaved = true;
|
||||
@@ -167,7 +167,7 @@
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
@@ -697,7 +783,7 @@
|
||||
@@ -695,7 +781,7 @@
|
||||
|
||||
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
|
||||
IBlockData iblockdata = t0.getBlockState();
|
||||
@@ -176,10 +176,10 @@
|
||||
|
||||
if (blockentityticker == null) {
|
||||
this.removeBlockEntityTicker(t0.getBlockPos());
|
||||
@@ -782,7 +868,7 @@
|
||||
@@ -780,7 +866,7 @@
|
||||
private boolean loggedInvalidBlockState;
|
||||
|
||||
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {
|
||||
a(final TileEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||
- this.blockEntity = tileentity;
|
||||
+ this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
||||
this.ticker = blockentityticker;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -306,7 +306,7 @@
|
||||
@@ -312,7 +312,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
|
||||
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
|
||||
@@ -328,7 +328,7 @@
|
||||
@@ -334,7 +334,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ChunkSection chunksection = achunksection[k];
|
||||
@@ -18,16 +18,7 @@
|
||||
|
||||
Objects.requireNonNull(set);
|
||||
palettedcontainerro.getAll(set::add);
|
||||
@@ -354,7 +354,7 @@
|
||||
Structure structure = (Structure) iterator.next();
|
||||
|
||||
seededrandom.setFeatureSeed(i, i1, l);
|
||||
- Supplier supplier = () -> {
|
||||
+ Supplier<String> supplier = () -> { // CraftBukkit - decompile error
|
||||
Optional optional = iregistry.getResourceKey(structure).map(Object::toString);
|
||||
|
||||
Objects.requireNonNull(structure);
|
||||
@@ -439,6 +439,33 @@
|
||||
@@ -445,6 +445,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +52,7 @@
|
||||
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
int i = chunkcoordintpair.getMinBlockX();
|
||||
@@ -576,6 +603,14 @@
|
||||
@@ -582,6 +609,14 @@
|
||||
StructureStart structurestart = structure.generate(iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
|
||||
|
||||
if (structurestart.isValid()) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
@@ -39,7 +39,7 @@
|
||||
public static final ChunkStatus EMPTY = registerSimple("empty", (ChunkStatus) null, -1, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, worldserver, chunkgenerator, list, ichunkaccess) -> {
|
||||
});
|
||||
public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, false, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, structuretemplatemanager, lightenginethreaded, function, list, ichunkaccess) -> {
|
||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
chunkgenerator.createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, structuretemplatemanager);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
+++ b/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
@@ -82,6 +82,11 @@
|
||||
@@ -85,6 +85,11 @@
|
||||
protected final LevelHeightAccessor levelHeightAccessor;
|
||||
protected final ChunkSection[] sections;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public IChunkAccess(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, LevelHeightAccessor levelheightaccessor, IRegistry<BiomeBase> iregistry, long i, @Nullable ChunkSection[] achunksection, @Nullable BlendingData blendingdata) {
|
||||
this.chunkPos = chunkcoordintpair;
|
||||
this.upgradeData = chunkconverter;
|
||||
@@ -100,7 +105,11 @@
|
||||
@@ -103,7 +108,11 @@
|
||||
}
|
||||
|
||||
replaceMissingSections(iregistry, this.sections);
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
private static void replaceMissingSections(IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
|
||||
for (int i = 0; i < achunksection.length; ++i) {
|
||||
@@ -263,10 +272,11 @@
|
||||
@@ -266,10 +275,11 @@
|
||||
|
||||
public void setUnsaved(boolean flag) {
|
||||
this.unsaved = flag;
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
public abstract ChunkStatus getStatus();
|
||||
@@ -442,6 +452,27 @@
|
||||
@@ -445,6 +455,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
@@ -33,7 +33,7 @@
|
||||
static CompletableFuture<IChunkAccess> generateStructureStarts(WorldGenContext worldgencontext, ChunkStatus chunkstatus, Executor executor, ToFullChunk tofullchunk, List<IChunkAccess> list, IChunkAccess ichunkaccess) {
|
||||
WorldServer worldserver = worldgencontext.level();
|
||||
|
||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
@@ -102,7 +102,7 @@
|
||||
@@ -104,7 +104,7 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
LevelLightEngine levellightengine = chunkproviderserver.getLightEngine();
|
||||
IRegistry<BiomeBase> iregistry = worldserver.registryAccess().registryOrThrow(Registries.BIOME);
|
||||
@@ -8,14 +8,8 @@
|
||||
+ Codec<DataPaletteBlock<Holder<BiomeBase>>> codec = makeBiomeCodecRW(iregistry); // CraftBukkit - read/write
|
||||
boolean flag2 = false;
|
||||
|
||||
DataResult dataresult;
|
||||
@@ -122,12 +122,12 @@
|
||||
});
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- datapaletteblock = (DataPaletteBlock) dataresult.getOrThrow(false, logger::error);
|
||||
+ datapaletteblock = (DataPaletteBlock) ((DataResult<DataPaletteBlock<IBlockData>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
|
||||
} else {
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
@@ -123,17 +123,17 @@
|
||||
datapaletteblock = new DataPaletteBlock<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), DataPaletteBlock.d.SECTION_STATES);
|
||||
}
|
||||
|
||||
@@ -23,13 +17,10 @@
|
||||
+ DataPaletteBlock object; // CraftBukkit - read/write
|
||||
|
||||
if (nbttagcompound1.contains("biomes", 10)) {
|
||||
dataresult = codec.parse(DynamicOpsNBT.INSTANCE, nbttagcompound1.getCompound("biomes")).promotePartial((s) -> {
|
||||
@@ -135,12 +135,12 @@
|
||||
});
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- object = (PalettedContainerRO) dataresult.getOrThrow(false, logger::error);
|
||||
+ object = ((DataResult<DataPaletteBlock<Holder<BiomeBase>>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
|
||||
- object = (PalettedContainerRO) codec.parse(DynamicOpsNBT.INSTANCE, nbttagcompound1.getCompound("biomes")).promotePartial((s) -> {
|
||||
+ object = codec.parse(DynamicOpsNBT.INSTANCE, nbttagcompound1.getCompound("biomes")).promotePartial((s) -> { // CraftBukkit - decompile error
|
||||
logErrors(chunkcoordintpair, b0, s);
|
||||
}).getOrThrow(ChunkRegionLoader.a::new);
|
||||
} else {
|
||||
object = new DataPaletteBlock<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), DataPaletteBlock.d.SECTION_BIOMES);
|
||||
}
|
||||
@@ -39,25 +30,25 @@
|
||||
|
||||
achunksection[k] = chunksection;
|
||||
SectionPosition sectionposition = SectionPosition.of(chunkcoordintpair, b0);
|
||||
@@ -176,7 +176,7 @@
|
||||
@@ -170,7 +170,7 @@
|
||||
dataresult = BlendingData.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("blending_data")));
|
||||
logger1 = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger1);
|
||||
- blendingdata = (BlendingData) dataresult.resultOrPartial(logger1::error).orElse((Object) null);
|
||||
+ blendingdata = (BlendingData) ((DataResult<BlendingData>) dataresult).resultOrPartial(logger1::error).orElse(null); // CraftBukkit - decompile error
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- blendingdata = (BlendingData) dataresult.resultOrPartial(logger::error).orElse((Object) null);
|
||||
+ blendingdata = (BlendingData) ((DataResult<BlendingData>) dataresult).resultOrPartial(logger::error).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
blendingdata = null;
|
||||
}
|
||||
@@ -207,7 +207,7 @@
|
||||
@@ -201,7 +201,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<BelowZeroRetrogen>) dataresult).resultOrPartial(logger1::error); // CraftBukkit - decompile error
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- Optional optional = dataresult.resultOrPartial(logger::error);
|
||||
+ Optional<BelowZeroRetrogen> optional = ((DataResult<BelowZeroRetrogen>) dataresult).resultOrPartial(logger::error); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(protochunk);
|
||||
optional.ifPresent(protochunk::setBelowZeroRetrogen);
|
||||
@@ -221,6 +221,13 @@
|
||||
@@ -215,6 +215,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +62,7 @@
|
||||
((IChunkAccess) object1).setLightCorrect(flag);
|
||||
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("Heightmaps");
|
||||
EnumSet<HeightMap.Type> enumset = EnumSet.noneOf(HeightMap.Type.class);
|
||||
@@ -300,6 +307,12 @@
|
||||
@@ -294,6 +301,12 @@
|
||||
return DataPaletteBlock.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
|
||||
}
|
||||
|
||||
@@ -84,7 +75,7 @@
|
||||
public static NBTTagCompound write(WorldServer worldserver, IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
NBTTagCompound nbttagcompound = GameProfileSerializer.addCurrentDataVersion(new NBTTagCompound());
|
||||
@@ -311,7 +324,7 @@
|
||||
@@ -305,7 +318,7 @@
|
||||
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
|
||||
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(ichunkaccess.getStatus()).toString());
|
||||
BlendingData blendingdata = ichunkaccess.getBlendingData();
|
||||
@@ -93,16 +84,7 @@
|
||||
Logger logger;
|
||||
|
||||
if (blendingdata != null) {
|
||||
@@ -358,7 +371,7 @@
|
||||
|
||||
if (flag1) {
|
||||
ChunkSection chunksection = achunksection[j];
|
||||
- DataResult dataresult1 = ChunkRegionLoader.BLOCK_STATE_CODEC.encodeStart(DynamicOpsNBT.INSTANCE, chunksection.getStates());
|
||||
+ DataResult<NBTBase> dataresult1 = ChunkRegionLoader.BLOCK_STATE_CODEC.encodeStart(DynamicOpsNBT.INSTANCE, chunksection.getStates()); // CraftBukkit - decompile error
|
||||
Logger logger1 = ChunkRegionLoader.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -441,6 +454,11 @@
|
||||
@@ -429,6 +442,11 @@
|
||||
|
||||
nbttagcompound.put("Heightmaps", nbttagcompound3);
|
||||
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));
|
||||
@@ -114,7 +96,7 @@
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -545,6 +563,12 @@
|
||||
@@ -533,6 +551,12 @@
|
||||
StructureStart structurestart = StructureStart.loadStaticStart(structurepieceserializationcontext, nbttagcompound1.getCompound(s), i);
|
||||
|
||||
if (structurestart != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
||||
@@ -19,6 +19,15 @@
|
||||
@@ -22,6 +22,15 @@
|
||||
import net.minecraft.world.level.levelgen.structure.PersistentStructureLegacy;
|
||||
import net.minecraft.world.level.storage.WorldPersistentData;
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
+import net.minecraft.server.level.ChunkProviderServer;
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
+import net.minecraft.world.level.GeneratorAccess;
|
||||
+import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
+import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class IChunkLoader implements AutoCloseable {
|
||||
|
||||
public static final int LAST_MONOLYTH_STRUCTURE_DATA_VERSION = 1493;
|
||||
@@ -36,9 +45,53 @@
|
||||
@@ -39,10 +48,54 @@
|
||||
return this.worker.isOldChunkAround(chunkcoordintpair, i);
|
||||
}
|
||||
|
||||
- public NBTTagCompound upgradeChunkTag(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
|
||||
- public NBTTagCompound upgradeChunkTag(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional) {
|
||||
+ // CraftBukkit start
|
||||
+ private boolean check(ChunkProviderServer cps, int x, int z) {
|
||||
+ ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
|
||||
@@ -52,27 +52,28 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public NBTTagCompound upgradeChunkTag(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) {
|
||||
+ public NBTTagCompound upgradeChunkTag(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) {
|
||||
+ // CraftBukkit end
|
||||
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).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.putBoolean("LightPopulated", true);
|
||||
try {
|
||||
+ // CraftBukkit start
|
||||
+ if (i < 1466) {
|
||||
+ NBTTagCompound level = nbttagcompound.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
+ 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.putBoolean("LightPopulated", true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i < 1493) {
|
||||
nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
@@ -58,7 +111,7 @@
|
||||
return nbttagcompound;
|
||||
if (i < 1493) {
|
||||
nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
@@ -69,7 +122,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier) {
|
||||
@@ -80,12 +81,12 @@
|
||||
PersistentStructureLegacy persistentstructurelegacy = this.legacyStructureHandler;
|
||||
|
||||
if (persistentstructurelegacy == null) {
|
||||
@@ -73,7 +126,7 @@
|
||||
@@ -84,7 +137,7 @@
|
||||
return persistentstructurelegacy;
|
||||
}
|
||||
|
||||
- public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<World> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
|
||||
+ public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<WorldDimension> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) { // CraftBukkit
|
||||
- public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<World> resourcekey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional) {
|
||||
+ public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<WorldDimension> resourcekey, Optional<ResourceKey<MapCodec<? 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;
|
||||
@@ -57,8 +58,8 @@
|
||||
@@ -63,8 +64,8 @@
|
||||
} else {
|
||||
this.externalFileDir = path1;
|
||||
this.offsets = this.header.asIntBuffer();
|
||||
@@ -16,7 +16,7 @@
|
||||
this.timestamps = this.header.asIntBuffer();
|
||||
if (flag) {
|
||||
this.file = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.DSYNC);
|
||||
@@ -67,7 +68,7 @@
|
||||
@@ -73,7 +74,7 @@
|
||||
}
|
||||
|
||||
this.usedSectors.force(0, 2);
|
||||
@@ -25,7 +25,7 @@
|
||||
int i = this.file.read(this.header, 0L);
|
||||
|
||||
if (i != -1) {
|
||||
@@ -122,7 +123,7 @@
|
||||
@@ -132,7 +133,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 {}", new Object[]{chunkcoordintpair, l, bytebuffer.remaining()});
|
||||
return null;
|
||||
@@ -224,7 +225,7 @@
|
||||
@@ -246,7 +247,7 @@
|
||||
|
||||
try {
|
||||
this.file.read(bytebuffer, (long) (j * 4096));
|
||||
@@ -43,7 +43,7 @@
|
||||
if (bytebuffer.remaining() != 5) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -327,7 +328,7 @@
|
||||
@@ -349,7 +350,7 @@
|
||||
|
||||
bytebuffer.putInt(1);
|
||||
bytebuffer.put((byte) (this.version.getId() | 128));
|
||||
@@ -52,7 +52,7 @@
|
||||
return bytebuffer;
|
||||
}
|
||||
|
||||
@@ -336,7 +337,7 @@
|
||||
@@ -358,7 +359,7 @@
|
||||
FileChannel filechannel = FileChannel.open(path1, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
|
||||
|
||||
try {
|
||||
@@ -61,7 +61,7 @@
|
||||
filechannel.write(bytebuffer);
|
||||
} catch (Throwable throwable) {
|
||||
if (filechannel != null) {
|
||||
@@ -360,7 +361,7 @@
|
||||
@@ -382,7 +383,7 @@
|
||||
}
|
||||
|
||||
private void writeHeader() throws IOException {
|
||||
@@ -70,7 +70,7 @@
|
||||
this.file.write(this.header, 0L);
|
||||
}
|
||||
|
||||
@@ -396,7 +397,7 @@
|
||||
@@ -418,7 +419,7 @@
|
||||
if (i != j) {
|
||||
ByteBuffer bytebuffer = RegionFile.PADDING_BUFFER.duplicate();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileCache.java
|
||||
@@ -30,7 +30,7 @@
|
||||
this.sync = flag;
|
||||
@@ -32,7 +32,7 @@
|
||||
this.info = regionstorageinfo;
|
||||
}
|
||||
|
||||
- private RegionFile getRegionFile(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
@@ -9,15 +9,15 @@
|
||||
long i = ChunkCoordIntPair.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
|
||||
RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
@@ -47,6 +47,7 @@
|
||||
Path path = this.folder;
|
||||
int j = chunkcoordintpair.getRegionX();
|
||||
Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||
+ if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
|
||||
RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
|
||||
RegionFile regionfile1 = new RegionFile(this.info, path1, this.folder, this.sync);
|
||||
|
||||
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
||||
@@ -54,7 +55,12 @@
|
||||
@@ -56,7 +57,12 @@
|
||||
|
||||
@Nullable
|
||||
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
@@ -31,7 +31,7 @@
|
||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkcoordintpair);
|
||||
|
||||
NBTTagCompound nbttagcompound;
|
||||
@@ -94,7 +100,12 @@
|
||||
@@ -96,7 +102,12 @@
|
||||
}
|
||||
|
||||
public void scanChunk(ChunkCoordIntPair chunkcoordintpair, StreamTagVisitor streamtagvisitor) throws IOException {
|
||||
@@ -45,7 +45,7 @@
|
||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkcoordintpair);
|
||||
|
||||
try {
|
||||
@@ -120,7 +131,7 @@
|
||||
@@ -122,7 +133,7 @@
|
||||
}
|
||||
|
||||
protected void write(ChunkCoordIntPair chunkcoordintpair, @Nullable NBTTagCompound nbttagcompound) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user