mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 06:40:19 +08:00
140 lines
6.8 KiB
Diff
140 lines
6.8 KiB
Diff
--- ../work/decompile-8eb82bde/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:26:13.625913570 +0000
|
|
+++ src/main/java/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:15:22.000000000 +0000
|
|
@@ -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));
|
|
}
|
|
|
|
@@ -274,6 +274,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;
|
|
|