Paper/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch
Zach Brown 5b4bc3081a Update from upstream SpigotMC
Upstream merge (we must go deeper) SpigotMC/Spigot@1e7bc383c3
2014-08-18 10:43:17 -05:00

112 lines
4.8 KiB
Diff

From 99e4136c831158d35954f6dfd3c7df956d3166b8 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 5 Jan 2014 09:35:01 +1100
Subject: [PATCH] Fix Biome Decoration Crashes
We don't really know what affect this will have on the terrain generation, but its better than crashing and not having terrain generate at all!
diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java
index c5701f6..064a125 100644
--- a/src/main/java/net/minecraft/server/BiomeDecorator.java
+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java
@@ -147,7 +147,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.generate(this.a, this.b, k, i1, l);
@@ -156,7 +156,7 @@ 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);
+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot
(new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l);
}
@@ -164,7 +164,7 @@ public class BiomeDecorator {
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
;
}
@@ -182,7 +182,7 @@ public class BiomeDecorator {
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.generate(this.a, this.b, k, i1, l);
}
}
@@ -190,42 +190,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.generate(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.generate(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.generate(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.generate(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()).generate(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.generate(this.a, this.b, k, i1, l);
}
@@ -276,4 +276,11 @@ public class BiomeDecorator {
this.a(1, this.n, 0, 16);
this.b(1, this.o, 16, 16);
}
+
+ // Spigot Start
+ private int getHighestBlockYAt(int x, int z)
+ {
+ return Math.max( 1, this.a.getHighestBlockYAt( x, z ) );
+ }
+ // Spigot End
}
--
1.9.1