aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch b/patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch
new file mode 100644
index 0000000000..ef98585d46
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/level/chunk/IChunkAccess.patch
@@ -0,0 +1,67 @@
+--- a/net/minecraft/world/level/chunk/IChunkAccess.java
++++ b/net/minecraft/world/level/chunk/IChunkAccess.java
+@@ -82,6 +82,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.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(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;
+@@ -100,7 +105,11 @@
+ }
+
+ replaceMissingSections(iregistry, this.sections);
++ // CraftBukkit start
++ this.biomeRegistry = iregistry;
+ }
++ public final IRegistry<BiomeBase> biomeRegistry;
++ // CraftBukkit end
+
+ private static void replaceMissingSections(IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
+ for (int i = 0; i < achunksection.length; ++i) {
+@@ -263,10 +272,11 @@
+
+ public void setUnsaved(boolean flag) {
+ this.unsaved = flag;
++ if (!flag) this.persistentDataContainer.dirty(false); // CraftBukkit - SPIGOT-6814: chunk was saved, pdc is no longer dirty
+ }
+
+ public boolean isUnsaved() {
+- return this.unsaved;
++ return this.unsaved || this.persistentDataContainer.dirty(); // CraftBukkit - SPIGOT-6814: chunk is unsaved if pdc was mutated
+ }
+
+ public abstract ChunkStatus getStatus();
+@@ -442,6 +452,27 @@
+ }
+ }
+
++ // CraftBukkit start
++ public void setBiome(int i, int j, int k, Holder<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());