Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Default to Y=1 when a Y=0 BlockPosition is found to be used in the BiomeDecorator. This prevents the "n must be positive" Crash due to the fact that sometimes the heightMap can be wrong calculated. Fixes SPIGOT-91
Dieser Commit ist enthalten in:
Ursprung
45be36a7b8
Commit
9d43c91ceb
139
nms-patches/BiomeDecorator.patch
Normale Datei
139
nms-patches/BiomeDecorator.patch
Normale Datei
@ -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;
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren