summaryrefslogtreecommitdiffstats
path: root/nms-patches/BiomeDecorator.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/BiomeDecorator.patch')
-rw-r--r--nms-patches/BiomeDecorator.patch139
1 files changed, 139 insertions, 0 deletions
diff --git a/nms-patches/BiomeDecorator.patch b/nms-patches/BiomeDecorator.patch
new file mode 100644
index 00000000..91b04ca2
--- /dev/null
+++ b/nms-patches/BiomeDecorator.patch
@@ -0,0 +1,139 @@
+--- ../work/decompile-8eb82bde//net/minecraft/server/BiomeDecorator.java Tue Dec 2 23:22:43 2014
++++ src/main/java/net/minecraft/server/BiomeDecorator.java Tue Dec 2 23:22:34 2014
+@@ -132,7 +132,7 @@
+ WorldGenTreeAbstract worldgentreeabstract = biomebase.a(this.b);
+
+ worldgentreeabstract.e();
+- blockposition = this.a.getHighestBlockYAt(this.c.a(k, 0, l));
++ blockposition = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash
+ if (worldgentreeabstract.generate(this.a, this.b, blockposition)) {
+ worldgentreeabstract.a(this.a, this.b, blockposition);
+ }
+@@ -141,7 +141,7 @@
+ for (j = 0; j < this.K; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- this.v.generate(this.a, this.b, this.a.getHighestBlockYAt(this.c.a(k, 0, l)));
++ this.v.generate(this.a, this.b, this.getHighestBlockYAt(this.c.a(k, 0, l ))); // CraftBukkit - Prevent crash
+ }
+
+ int i1;
+@@ -149,7 +149,7 @@
+ for (j = 0; j < this.B; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); // CraftBukkit - Prevent crash
+ blockposition = this.c.a(k, i1, l);
+ EnumFlowerVarient enumflowervarient = biomebase.a(this.b, blockposition);
+ BlockFlowers blockflowers = enumflowervarient.a().a();
+@@ -163,14 +163,14 @@
+ for (j = 0; j < this.C; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ biomebase.b(this.b).generate(this.a, this.b, this.c.a(k, i1, l));
+ }
+
+ for (j = 0; j < this.D; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ (new WorldGenDeadBush()).generate(this.a, this.b, this.c.a(k, i1, l));
+ }
+
+@@ -179,7 +179,7 @@
+ while (j < this.z) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ blockposition = this.c.a(k, i1, l);
+
+ while (true) {
+@@ -202,7 +202,7 @@
+ if (this.b.nextInt(4) == 0) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- BlockPosition blockposition2 = this.a.getHighestBlockYAt(this.c.a(k, 0, l));
++ BlockPosition blockposition2 = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash
+
+ this.t.generate(this.a, this.b, blockposition2);
+ }
+@@ -210,7 +210,7 @@
+ if (this.b.nextInt(8) == 0) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ blockposition = this.c.a(k, i1, l);
+ this.u.generate(this.a, this.b, blockposition);
+ }
+@@ -219,42 +219,42 @@
+ if (this.b.nextInt(4) == 0) {
+ j = this.b.nextInt(16) + 8;
+ k = this.b.nextInt(16) + 8;
+- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
++ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
+ this.t.generate(this.a, this.b, this.c.a(j, l, k));
+ }
+
+ if (this.b.nextInt(8) == 0) {
+ j = this.b.nextInt(16) + 8;
+ k = this.b.nextInt(16) + 8;
+- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
++ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
+ this.u.generate(this.a, this.b, this.c.a(j, l, k));
+ }
+
+ for (j = 0; j < this.F; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ this.w.generate(this.a, this.b, this.c.a(k, i1, l));
+ }
+
+ for (j = 0; j < 10; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ this.w.generate(this.a, this.b, this.c.a(k, i1, l));
+ }
+
+ if (this.b.nextInt(32) == 0) {
+ j = this.b.nextInt(16) + 8;
+ k = this.b.nextInt(16) + 8;
+- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
++ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
+ (new WorldGenPumpkin()).generate(this.a, this.b, this.c.a(j, l, k));
+ }
+
+ for (j = 0; j < this.G; ++j) {
+ k = this.b.nextInt(16) + 8;
+ l = this.b.nextInt(16) + 8;
+- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
++ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
+ this.x.generate(this.a, this.b, this.c.a(k, i1, l));
+ }
+
+@@ -273,6 +273,16 @@
+ }
+
+ }
++
++ // CraftBukkit start - The heightMap can be wrong calculated and return Y = 0 which will crash the Server
++ private BlockPosition getHighestBlockYAt( BlockPosition blockPosition ) {
++ BlockPosition returnBlockPosition = this.a.getHighestBlockYAt( blockPosition );
++ if ( returnBlockPosition.getY() == 0 ) {
++ returnBlockPosition = returnBlockPosition.up( 1 );
++ }
++ return returnBlockPosition;
++ }
++ // CraftBukkit end
+
+ protected void a(int i, WorldGenerator worldgenerator, int j, int k) {
+ int l;