13
0
geforkt von Mirrors/Paper

[Bukkit Bug] Fix packed ice generation crashing the server.

Dieser Commit ist enthalten in:
md_5 2013-12-01 17:52:29 +11:00
Ursprung 3395b38dfd
Commit b5a469f97a
2 geänderte Dateien mit 146 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From f820823194d6cde4ea5396e0caa36e160f5f2c3e Mon Sep 17 00:00:00 2001
From 0439b094fea65440e752f067b26a77ff7acff240 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
@ -935,6 +935,113 @@ index 0000000..1eb87ae
+
+ protected abstract StructureStart b(int i, int j);
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
new file mode 100644
index 0000000..c0db754
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -0,0 +1,101 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class WorldGenPackedIce2 extends WorldGenerator {
+
+ public WorldGenPackedIce2() {}
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ while (world.isEmpty(i, j, k) && j > 2) {
+ --j;
+ }
+
+ if (world.getType(i, j, k) != Blocks.SNOW_BLOCK) {
+ return false;
+ } else {
+ j += random.nextInt(4);
+ int l = random.nextInt(4) + 7;
+ int i1 = l / 4 + random.nextInt(2);
+
+ if (i1 > 1 && random.nextInt(60) == 0) {
+ j += 10 + random.nextInt(30);
+ }
+
+ int j1;
+ int k1;
+ int l1;
+
+ for (j1 = 0; j1 < l; ++j1) {
+ float f = (1.0F - (float) j1 / (float) l) * (float) i1;
+
+ k1 = MathHelper.f(f);
+
+ for (l1 = -k1; l1 <= k1; ++l1) {
+ float f1 = (float) MathHelper.a(l1) - 0.25F;
+
+ for (int i2 = -k1; i2 <= k1; ++i2) {
+ float f2 = (float) MathHelper.a(i2) - 0.25F;
+
+ if ((l1 == 0 && i2 == 0 || f1 * f1 + f2 * f2 <= f * f) && (l1 != -k1 && l1 != k1 && i2 != -k1 && i2 != k1 || random.nextFloat() <= 0.75F)) {
+ Block block = world.getType(i + l1, j + j1, k + i2);
+
+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
+ this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE);
+ }
+
+ if (j1 != 0 && k1 > 1) {
+ block = world.getType(i + l1, j - j1, k + i2);
+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
+ this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ j1 = i1 - 1;
+ if (j1 < 0) {
+ j1 = 0;
+ } else if (j1 > 1) {
+ j1 = 1;
+ }
+
+ for (int j2 = -j1; j2 <= j1; ++j2) {
+ k1 = -j1;
+
+ while (k1 <= j1) {
+ l1 = j - 1;
+ int k2 = 50;
+
+ if (Math.abs(j2) == 1 && Math.abs(k1) == 1) {
+ k2 = random.nextInt(5);
+ }
+
+ while (true) {
+ if (l1 > 50) {
+ Block block1 = world.getType(i + j2, l1, k + k1);
+
+ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
+ this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE);
+ --l1;
+ --k2;
+ if (k2 <= 0) {
+ l1 -= random.nextInt(5) + 1;
+ k2 = random.nextInt(5);
+ }
+ continue;
+ }
+ }
+
+ ++k1;
+ break;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+}
--
1.8.3.2

Datei anzeigen

@ -0,0 +1,38 @@
From 4c2dc9108ad595a23ec68fe637ff95ab7647a704 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 17:52:14 +1100
Subject: [PATCH] Fix packed ice generation
diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
index c0db754..a830758 100644
--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java
@@ -41,13 +41,13 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block = world.getType(i + l1, j + j1, k + i2);
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
- this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + l1, j + j1, k + i2, Blocks.PACKED_ICE); // Spigot
}
if (j1 != 0 && k1 > 1) {
block = world.getType(i + l1, j - j1, k + i2);
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) {
- this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + l1, j - j1, k + i2, Blocks.PACKED_ICE); // Spigot
}
}
}
@@ -78,7 +78,7 @@ public class WorldGenPackedIce2 extends WorldGenerator {
Block block1 = world.getType(i + j2, l1, k + k1);
if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
- this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE);
+ world.setTypeUpdate(i + j2, l1, k + k1, Blocks.PACKED_ICE); // Spigot
--l1;
--k2;
if (k2 <= 0) {
--
1.8.3.2