112 lines
6.0 KiB
Diff
112 lines
6.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java
|
|
@@ -140,9 +140,7 @@
|
|
{
|
|
if (l1 >= 0 && l1 < 256)
|
|
{
|
|
- IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1);
|
|
-
|
|
- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j)
|
|
+ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_))
|
|
{
|
|
flag3 = true;
|
|
}
|
|
@@ -180,28 +178,12 @@
|
|
IBlockState iblockstate1 = p_180702_5_.func_177856_a(j3, j2, i2);
|
|
IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(j3, j2 + 1, i2), field_186127_b);
|
|
|
|
- if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh)
|
|
+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_))
|
|
{
|
|
flag1 = true;
|
|
}
|
|
|
|
- if (this.func_175793_a(iblockstate1, iblockstate2))
|
|
- {
|
|
- if (j2 - 1 < 10)
|
|
- {
|
|
- p_180702_5_.func_177855_a(j3, j2, i2, field_186126_a);
|
|
- }
|
|
- else
|
|
- {
|
|
- p_180702_5_.func_177855_a(j3, j2, i2, field_186127_b);
|
|
-
|
|
- if (flag1 && p_180702_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d)
|
|
- {
|
|
- blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16);
|
|
- p_180702_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A.func_177230_c().func_176223_P());
|
|
- }
|
|
- }
|
|
- }
|
|
+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2);
|
|
}
|
|
}
|
|
}
|
|
@@ -260,4 +242,66 @@
|
|
}
|
|
}
|
|
}
|
|
+
|
|
+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
|
|
+ {
|
|
+ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c();
|
|
+ return block== Blocks.field_150358_i || block == Blocks.field_150355_j;
|
|
+ }
|
|
+
|
|
+ //Exception biomes to make sure we generate like vanilla
|
|
+ private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome)
|
|
+ {
|
|
+ if (biome == net.minecraft.init.Biomes.field_76787_r) return true;
|
|
+ if (biome == net.minecraft.init.Biomes.field_76769_d) return true;
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ //Determine if the block at the specified location is the top block for the biome, we take into account
|
|
+ //Vanilla bugs to make sure that we generate the map the same way vanilla does.
|
|
+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
|
|
+ {
|
|
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
|
|
+ IBlockState state = data.func_177856_a(x, y, z);
|
|
+ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Digs out the current block, default implementation removes stone, filler, and top block
|
|
+ * Sets the block to lava if y is less then 10, and air other wise.
|
|
+ * If setting to air, it also checks to see if we've broken the surface and if so
|
|
+ * tries to make the floor the biome's top block
|
|
+ *
|
|
+ * @param data Block data array
|
|
+ * @param index Pre-calculated index into block data
|
|
+ * @param x local X position
|
|
+ * @param y local Y position
|
|
+ * @param z local Z position
|
|
+ * @param chunkX Chunk X position
|
|
+ * @param chunkZ Chunk Y position
|
|
+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
|
|
+ */
|
|
+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up)
|
|
+ {
|
|
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
|
|
+ IBlockState top = biome.field_76752_A;
|
|
+ IBlockState filler = biome.field_76753_B;
|
|
+
|
|
+ if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c())
|
|
+ {
|
|
+ if (y - 1 < 10)
|
|
+ {
|
|
+ data.func_177855_a(x, y, z, field_186126_a);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ data.func_177855_a(x, y, z, field_186127_b);
|
|
+
|
|
+ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c())
|
|
+ {
|
|
+ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
}
|