More var name fixes
This commit is contained in:
@@ -64,27 +64,23 @@
|
||||
}
|
||||
|
||||
public abstract ChunkStatus getPersistedStatus();
|
||||
@@ -446,6 +_,26 @@
|
||||
@@ -446,6 +_,22 @@
|
||||
throw new ReportedException(crashReport);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ public void setBiome(int i, int j, int k, Holder<Biome> biome) {
|
||||
+ public void setBiome(int x, int y, int z, Holder<Biome> biome) {
|
||||
+ try {
|
||||
+ int l = QuartPos.fromBlock(this.getMinY());
|
||||
+ int i1 = l + QuartPos.fromBlock(this.getHeight()) - 1;
|
||||
+ int j1 = Mth.clamp(j, l, i1);
|
||||
+ int k1 = this.getSectionIndex(QuartPos.toBlock(j1));
|
||||
+
|
||||
+ this.sections[k1].setBiome(i & 3, j1 & 3, k & 3, biome);
|
||||
+ int minY = QuartPos.fromBlock(this.getMinY());
|
||||
+ int maxY = minY + QuartPos.fromBlock(this.getHeight()) - 1;
|
||||
+ int clampedY = Mth.clamp(y, minY, maxY);
|
||||
+ int sectionIndex = this.getSectionIndex(QuartPos.toBlock(clampedY));
|
||||
+ this.sections[sectionIndex].setBiome(x & 3, clampedY & 3, z & 3, biome);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ CrashReport crashreport = CrashReport.forThrowable(throwable, "Setting biome");
|
||||
+ CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Biome being set");
|
||||
+
|
||||
+ crashreportsystemdetails.setDetail("Location", () -> {
|
||||
+ return CrashReportCategory.formatLocation(this, i, j, k);
|
||||
+ });
|
||||
+ throw new ReportedException(crashreport);
|
||||
+ CrashReport report = CrashReport.forThrowable(throwable, "Setting biome");
|
||||
+ CrashReportCategory reportCategory = report.addCategory("Biome being set");
|
||||
+ reportCategory.setDetail("Location", () -> CrashReportCategory.formatLocation(this, x, y, z));
|
||||
+ throw new ReportedException(report);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -94,24 +94,24 @@
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ public void applyBiomeDecoration(WorldGenLevel world, ChunkAccess chunk, StructureManager structureAccessor) {
|
||||
+ this.applyBiomeDecoration(world, chunk, structureAccessor, true);
|
||||
+ public void applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structureManager) {
|
||||
+ this.applyBiomeDecoration(level, chunk, structureManager, true);
|
||||
+ }
|
||||
+
|
||||
+ public void applyBiomeDecoration(WorldGenLevel generatoraccessseed, ChunkAccess ichunkaccess, StructureManager structuremanager, boolean vanilla) {
|
||||
+ if (vanilla) {
|
||||
+ this.addVanillaDecorations(generatoraccessseed, ichunkaccess, structuremanager);
|
||||
+ public void applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structureManager, boolean addVanillaDecorations) {
|
||||
+ if (addVanillaDecorations) {
|
||||
+ this.addVanillaDecorations(level, chunk, structureManager);
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.World world = generatoraccessseed.getMinecraftWorld().getWorld();
|
||||
+ org.bukkit.World world = level.getMinecraftWorld().getWorld();
|
||||
+ // only call when a populator is present (prevents unnecessary entity conversion)
|
||||
+ 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;
|
||||
+ org.bukkit.craftbukkit.generator.CraftLimitedRegion limitedRegion = new org.bukkit.craftbukkit.generator.CraftLimitedRegion(level, chunk.getPos());
|
||||
+ int x = chunk.getPos().x;
|
||||
+ int z = chunk.getPos().z;
|
||||
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
+ WorldgenRandom seededrandom = new WorldgenRandom(new net.minecraft.world.level.levelgen.LegacyRandomSource(generatoraccessseed.getSeed()));
|
||||
+ seededrandom.setDecorationSeed(generatoraccessseed.getSeed(), x, z);
|
||||
+ WorldgenRandom seededrandom = new WorldgenRandom(new net.minecraft.world.level.levelgen.LegacyRandomSource(level.getSeed()));
|
||||
+ seededrandom.setDecorationSeed(level.getSeed(), x, z);
|
||||
+ populator.populate(world, new org.bukkit.craftbukkit.util.RandomSourceWrapper.RandomWrapper(seededrandom), x, z, limitedRegion);
|
||||
+ }
|
||||
+ limitedRegion.saveEntities();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
) {
|
||||
super(pos, data, level, level.registryAccess().lookupOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData);
|
||||
- this.level = level;
|
||||
+ this.level = (net.minecraft.server.level.ServerLevel) level; // CraftBukkit - type
|
||||
+ this.level = (ServerLevel) level; // CraftBukkit - type
|
||||
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
for (Heightmap.Types types : Heightmap.Types.values()) {
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
return this.biomes.get(x, y, z);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ public void setBiome(int i, int j, int k, Holder<Biome> biome) {
|
||||
+ this.biomes.set(i, j, k, biome);
|
||||
+ public void setBiome(int x, int y, int z, Holder<Biome> biome) {
|
||||
+ this.biomes.set(x, y, z, biome);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
|
||||
@@ -1,41 +1,10 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -38,17 +_,63 @@
|
||||
@@ -38,17 +_,30 @@
|
||||
return this.worker.isOldChunkAround(pos, radius);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private boolean check(net.minecraft.server.level.ServerChunkCache cps, int x, int z) {
|
||||
+ if (true) return true; // Paper - Perf: this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
|
||||
+ ChunkPos pos = new ChunkPos(x, z);
|
||||
+ if (cps != null) {
|
||||
+ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread");
|
||||
+ if (cps.hasChunk(x, z)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CompoundTag nbt;
|
||||
+ try {
|
||||
+ nbt = this.read(pos).get().orElse(null);
|
||||
+ } catch (InterruptedException | java.util.concurrent.ExecutionException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ if (nbt != null) {
|
||||
+ CompoundTag level = nbt.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated")) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus status = net.minecraft.world.level.chunk.status.ChunkStatus.byName(level.getString("Status"));
|
||||
+ if (status != null && status.isOrAfter(net.minecraft.world.level.chunk.status.ChunkStatus.FEATURES)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public CompoundTag upgradeChunkTag(
|
||||
- ResourceKey<Level> levelKey,
|
||||
+ ResourceKey<net.minecraft.world.level.dimension.LevelStem> levelKey,
|
||||
@@ -44,7 +13,7 @@
|
||||
- Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey
|
||||
+ Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey,
|
||||
+ ChunkPos pos,
|
||||
+ @Nullable net.minecraft.world.level.LevelAccessor generatoraccess
|
||||
+ @Nullable net.minecraft.world.level.LevelAccessor levelAccessor
|
||||
+ // CraftBukkit end
|
||||
) {
|
||||
int version = getVersion(chunkData);
|
||||
@@ -56,10 +25,8 @@
|
||||
+ if (version < 1466) {
|
||||
+ CompoundTag level = chunkData.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
+ net.minecraft.server.level.ServerChunkCache cps = (generatoraccess == null) ? null : ((net.minecraft.server.level.ServerLevel) generatoraccess).getChunkSource();
|
||||
+ if (this.check(cps, pos.x - 1, pos.z) && this.check(cps, pos.x - 1, pos.z - 1) && this.check(cps, pos.x, pos.z - 1)) {
|
||||
+ level.putBoolean("LightPopulated", true);
|
||||
+ }
|
||||
+ // Light is purged updating to 1.14+. We need to set light populated to true so the converter recognizes the chunk as being "full"
|
||||
+ level.putBoolean("LightPopulated", true);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -72,7 +39,7 @@
|
||||
|
||||
+ // Spigot start - SPIGOT-6806: Quick and dirty way to prevent below zero generation in old chunks, by setting the status to heightmap instead of empty
|
||||
+ boolean stopBelowZero = false;
|
||||
+ boolean belowZeroGenerationInExistingChunks = (generatoraccess != null) ? ((net.minecraft.server.level.ServerLevel) generatoraccess).spigotConfig.belowZeroGenerationInExistingChunks : org.spigotmc.SpigotConfig.belowZeroGenerationInExistingChunks;
|
||||
+ boolean belowZeroGenerationInExistingChunks = (levelAccessor != null) ? ((net.minecraft.server.level.ServerLevel) levelAccessor).spigotConfig.belowZeroGenerationInExistingChunks : org.spigotmc.SpigotConfig.belowZeroGenerationInExistingChunks;
|
||||
+
|
||||
+ if (version <= 2730 && !belowZeroGenerationInExistingChunks) {
|
||||
+ stopBelowZero = "full".equals(chunkData.getCompound("Level").getString("Status"));
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -331,13 +_,18 @@
|
||||
@@ -331,6 +_,11 @@
|
||||
try (FileChannel fileChannel = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) {
|
||||
chunkData.position(5);
|
||||
fileChannel.write(chunkData);
|
||||
@@ -58,11 +58,3 @@
|
||||
}
|
||||
|
||||
return () -> Files.move(path, externalChunkFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - load chunk persistent data from nbt - SPIGOT-6814: Already load PDC here to account for 1.17 to 1.18 chunk upgrading.
|
||||
+ if (this.persistentDataContainer instanceof CompoundTag) {
|
||||
+ chunkAccess.persistentDataContainer.putAll((CompoundTag) this.persistentDataContainer);
|
||||
+ if (this.persistentDataContainer instanceof CompoundTag compoundTag) {
|
||||
+ chunkAccess.persistentDataContainer.putAll(compoundTag);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@@ -107,8 +107,8 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - read/write
|
||||
+ private static Codec<PalettedContainer<Holder<Biome>>> makeBiomeCodecRW(Registry<Biome> iregistry) {
|
||||
+ return PalettedContainer.codecRW(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS));
|
||||
+ private static Codec<PalettedContainer<Holder<Biome>>> makeBiomeCodecRW(Registry<Biome> biomeRegistry) {
|
||||
+ return PalettedContainer.codecRW(biomeRegistry.asHolderIdMap(), biomeRegistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomeRegistry.getOrThrow(Biomes.PLAINS));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@@ -168,8 +168,8 @@
|
||||
if (structureStart != null) {
|
||||
+ // CraftBukkit start - load persistent data for structure start
|
||||
+ net.minecraft.nbt.Tag persistentBase = compound.getCompound(string).get("StructureBukkitValues");
|
||||
+ if (persistentBase instanceof CompoundTag) {
|
||||
+ structureStart.persistentDataContainer.putAll((CompoundTag) persistentBase);
|
||||
+ if (persistentBase instanceof CompoundTag compoundTag) {
|
||||
+ structureStart.persistentDataContainer.putAll(compoundTag);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
map.put(structure, structureStart);
|
||||
|
||||
Reference in New Issue
Block a user