Paper/CraftBukkit-Patches/0073-Fix-Biome-Decoration-Crashes.patch
2014-04-12 14:18:37 +10:00

112 lines
4.8 KiB
Diff

From 588665caa81c35531fe1d8d487f883dd796c4965 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 b048d6c..962d719 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.a(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)).a(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.a(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.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);
}
@@ -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.8.3.2