mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 05:59:53 +03:00
125 lines
6.4 KiB
Diff
125 lines
6.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java
|
|
@@ -128,9 +128,7 @@
|
|
{
|
|
if (l1 >= 0 && l1 < 256)
|
|
{
|
|
- IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1);
|
|
-
|
|
- if (iblockstate.getBlock() == Blocks.FLOWING_WATER || iblockstate.getBlock() == Blocks.WATER)
|
|
+ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_))
|
|
{
|
|
flag2 = true;
|
|
}
|
|
@@ -146,8 +144,6 @@
|
|
|
|
if (!flag2)
|
|
{
|
|
- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
|
-
|
|
for (int j3 = k2; j3 < k; ++j3)
|
|
{
|
|
double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9;
|
|
@@ -165,30 +161,12 @@
|
|
|
|
if ((d10 * d10 + d7 * d7) * (double)this.rs[j2 - 1] + d8 * d8 / 6.0D < 1.0D)
|
|
{
|
|
- IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2);
|
|
-
|
|
- if (iblockstate1.getBlock() == Blocks.GRASS)
|
|
+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_))
|
|
{
|
|
flag = true;
|
|
}
|
|
|
|
- if (iblockstate1.getBlock() == Blocks.STONE || iblockstate1.getBlock() == Blocks.DIRT || iblockstate1.getBlock() == Blocks.GRASS)
|
|
- {
|
|
- if (j2 - 1 < 10)
|
|
- {
|
|
- p_180707_5_.setBlockState(j3, j2, i2, FLOWING_LAVA);
|
|
- }
|
|
- else
|
|
- {
|
|
- p_180707_5_.setBlockState(j3, j2, i2, AIR);
|
|
-
|
|
- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.DIRT)
|
|
- {
|
|
- blockpos$mutableblockpos.setPos(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16);
|
|
- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.world.getBiome(blockpos$mutableblockpos).topBlock);
|
|
- }
|
|
- }
|
|
- }
|
|
+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag);
|
|
}
|
|
}
|
|
}
|
|
@@ -223,4 +201,68 @@
|
|
}
|
|
}
|
|
}
|
|
+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
|
|
+ {
|
|
+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock();
|
|
+ return block== Blocks.FLOWING_WATER || block == Blocks.WATER;
|
|
+ }
|
|
+
|
|
+ //Exception biomes to make sure we generate like vanilla
|
|
+ private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome)
|
|
+ {
|
|
+ if (biome == net.minecraft.init.Biomes.BEACH) return true;
|
|
+ if (biome == net.minecraft.init.Biomes.DESERT) return true;
|
|
+ if (biome == net.minecraft.init.Biomes.MUSHROOM_ISLAND) return true;
|
|
+ if (biome == net.minecraft.init.Biomes.MUSHROOM_ISLAND_SHORE) 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 = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
|
|
+ IBlockState state = data.getBlockState(x, y, z);
|
|
+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.GRASS : state.getBlock() == biome.topBlock);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * 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)
|
|
+ {
|
|
+ net.minecraft.world.biome.Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
|
|
+ IBlockState state = data.getBlockState(x, y, z);
|
|
+ IBlockState top = isExceptionBiome(biome) ? Blocks.GRASS.getDefaultState() : biome.topBlock;
|
|
+ IBlockState filler = isExceptionBiome(biome) ? Blocks.DIRT.getDefaultState() : biome.fillerBlock;
|
|
+
|
|
+ if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock())
|
|
+ {
|
|
+ if (y - 1 < 10)
|
|
+ {
|
|
+ data.setBlockState(x, y, z, FLOWING_LAVA);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ data.setBlockState(x, y, z, AIR);
|
|
+
|
|
+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
|
|
+ {
|
|
+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
}
|