mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 01:25:03 +01:00
6b0484122e
By: DerFrZocker <derrieple@gmail.com>
75 lines
3.5 KiB
Diff
75 lines
3.5 KiB
Diff
--- a/net/minecraft/world/level/chunk/IChunkAccess.java
|
|
+++ b/net/minecraft/world/level/chunk/IChunkAccess.java
|
|
@@ -77,6 +77,11 @@
|
|
protected final LevelHeightAccessor levelHeightAccessor;
|
|
protected final ChunkSection[] sections;
|
|
|
|
+ // CraftBukkit start - SPIGOT-6814: move to IChunkAccess to account for 1.17 to 1.18 chunk upgrading.
|
|
+ private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
|
+ public org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
|
+ // CraftBukkit end
|
|
+
|
|
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;
|
|
@@ -94,7 +99,12 @@
|
|
}
|
|
|
|
replaceMissingSections(levelheightaccessor, iregistry, this.sections);
|
|
+ // CraftBukkit start
|
|
+ this.biomeRegistry = iregistry;
|
|
+ this.persistentDataContainer.setCallback(() -> setUnsaved(true)); // CraftBukkit - SPIGOT-6814: Handle cases were only persistentData is saved
|
|
}
|
|
+ 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) {
|
|
@@ -394,6 +404,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());
|
|
@@ -425,8 +456,10 @@
|
|
return this;
|
|
}
|
|
|
|
- public static record a(SerializableTickContainer<Block> a, SerializableTickContainer<FluidType> b) {
|
|
+ // CraftBukkit start - decompile error
|
|
+ public static record a(SerializableTickContainer<Block> blocks, SerializableTickContainer<FluidType> fluids) {
|
|
|
|
+ /*
|
|
private final SerializableTickContainer<Block> blocks;
|
|
private final SerializableTickContainer<FluidType> fluids;
|
|
|
|
@@ -442,5 +475,7 @@
|
|
public SerializableTickContainer<FluidType> fluids() {
|
|
return this.fluids;
|
|
}
|
|
+ */
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|