diff --git a/CraftBukkit-Patches/0080-Fix-Biome-Decoration-Crashes.patch b/CraftBukkit-Patches/0080-Fix-Biome-Decoration-Crashes.patch new file mode 100644 index 0000000..5f9cdc7 --- /dev/null +++ b/CraftBukkit-Patches/0080-Fix-Biome-Decoration-Crashes.patch @@ -0,0 +1,163 @@ +From 42c0c04deee81b86249ccbfe8061e5c21595ef3f Mon Sep 17 00:00:00 2001 +From: Dan Mulloy +Date: Sun, 22 Dec 2013 18:40:53 -0500 +Subject: [PATCH] Fix Biome Decoration Crashes + + +diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java +index b048d6c..8cfafe6 100644 +--- a/src/main/java/net/minecraft/server/BiomeDecorator.java ++++ b/src/main/java/net/minecraft/server/BiomeDecorator.java +@@ -1,5 +1,10 @@ + package net.minecraft.server; + ++// Spigot Start ++import java.util.ArrayList; ++import java.util.Iterator; ++import java.util.List; ++// Spigot End + import java.util.Random; + + public class BiomeDecorator { +@@ -39,6 +44,7 @@ public class BiomeDecorator { + protected int G; + protected int H; + public boolean I; ++ private final List chunksToUnload = new ArrayList(); // Spigot + + public BiomeDecorator() { + this.f = new WorldGenSand(Blocks.SAND, 7); +@@ -147,7 +153,7 @@ public class BiomeDecorator { + for (j = 0; j < this.z; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot + WorldGenerator worldgenerator = biomebase.b(this.b); + + worldgenerator.a(this.a, this.b, k, i1, l); +@@ -156,15 +162,15 @@ public class BiomeDecorator { + for (j = 0; j < this.A; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); +- (new WorldGenDeadBush(Blocks.DEAD_BUSH)).a(this.a, this.b, k, i1, l); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); ++ (new WorldGenDeadBush(Blocks.DEAD_BUSH)).a(this.a, this.b, k, i1, l); // Spigot + } + + for (j = 0; j < this.w; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; + +- for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { ++ for (i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { // Spigot + ; + } + +@@ -175,14 +181,14 @@ public class BiomeDecorator { + if (this.b.nextInt(4) == 0) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.a.getHighestBlockYAt(k, l); ++ i1 = this.getHighestBlockYAt(k, l); // Spigot + this.q.a(this.a, this.b, k, i1, l); + } + + if (this.b.nextInt(8) == 0) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot + this.r.a(this.a, this.b, k, i1, l); + } + } +@@ -190,42 +196,42 @@ public class BiomeDecorator { + if (this.b.nextInt(4) == 0) { + j = this.c + this.b.nextInt(16) + 8; + k = this.d + this.b.nextInt(16) + 8; +- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); ++ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot + this.q.a(this.a, this.b, j, l, k); + } + + if (this.b.nextInt(8) == 0) { + j = this.c + this.b.nextInt(16) + 8; + k = this.d + this.b.nextInt(16) + 8; +- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); ++ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot + this.r.a(this.a, this.b, j, l, k); + } + + for (j = 0; j < this.C; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot + this.t.a(this.a, this.b, k, i1, l); + } + + for (j = 0; j < 10; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot + this.t.a(this.a, this.b, k, i1, l); + } + + if (this.b.nextInt(32) == 0) { + j = this.c + this.b.nextInt(16) + 8; + k = this.d + this.b.nextInt(16) + 8; +- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); ++ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot + (new WorldGenPumpkin()).a(this.a, this.b, j, l, k); + } + + for (j = 0; j < this.D; ++j) { + k = this.c + this.b.nextInt(16) + 8; + l = this.d + this.b.nextInt(16) + 8; +- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); ++ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot + this.u.a(this.a, this.b, k, i1, l); + } + +@@ -244,6 +250,7 @@ public class BiomeDecorator { + (new WorldGenLiquids(Blocks.LAVA)).a(this.a, this.b, k, l, i1); + } + } ++ this.unloadChunks(); // Spigot - unload chunks we force loaded + } + + protected void a(int i, WorldGenerator worldgenerator, int j, int k) { +@@ -276,4 +283,28 @@ public class BiomeDecorator { + this.a(1, this.n, 0, 16); + this.b(1, this.o, 16, 16); + } ++ ++ // Spigot start - force load chunks ++ private int getHighestBlockYAt(int i, int j) ++ { ++ // Make sure the chunk is loaded ++ if ( !this.a.isChunkLoaded( i >> 4, j >> 4 ) ) ++ { ++ // If not, load it, then add it to our unload list ++ this.chunksToUnload.add( this.a.getChunkAt( i, j ) ); ++ } ++ ++ return this.a.getHighestBlockYAt( i, j ); ++ } ++ ++ private void unloadChunks() ++ { ++ Iterator iter = this.chunksToUnload.iterator(); ++ while ( iter.hasNext() ) ++ { ++ this.a.getWorld().unloadChunk( iter.next().bukkitChunk ); ++ iter.remove(); ++ } ++ } ++ // Spigot end + } +-- +1.8.3.2 + diff --git a/CraftBukkit-Patches/0080-Force-Load-Chunks-for-Biome-Decoration.patch b/CraftBukkit-Patches/0080-Force-Load-Chunks-for-Biome-Decoration.patch deleted file mode 100644 index 85fd95a..0000000 --- a/CraftBukkit-Patches/0080-Force-Load-Chunks-for-Biome-Decoration.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 06442e81b39007aff69a813571ec4fbf60f1ac6d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 21 Dec 2013 20:08:26 +1100 -Subject: [PATCH] Force Load Chunks for Biome Decoration - - -diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java -index b048d6c..a8bbe06 100644 ---- a/src/main/java/net/minecraft/server/BiomeDecorator.java -+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java -@@ -147,10 +147,23 @@ public class BiomeDecorator { - for (j = 0; j < this.z; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -+ // Spigot Start -+ boolean chunkWasLoaded = this.a.isChunkLoaded( i >> 4, j >> 4 ); -+ if ( !chunkWasLoaded ) -+ { -+ this.a.getChunkAt( i, j ); -+ } -+ // Spigot End - i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); - WorldGenerator worldgenerator = biomebase.b(this.b); - - worldgenerator.a(this.a, this.b, k, i1, l); -+ // Spigot Start -+ if ( !chunkWasLoaded ) -+ { -+ this.a.getWorld().unloadChunk( i >> 4, j >> 4 ); -+ } -+ // Spigot End - } - - for (j = 0; j < this.A; ++j) { --- -1.8.3.2 -