Lake fix
This commit is contained in:
parent
e588237fd8
commit
4dd1c55924
2 changed files with 34 additions and 20 deletions
|
@ -137,8 +137,13 @@ public class BlocksHelper {
|
|||
for (int y = start.getY(); y <= end.getY(); y++) {
|
||||
POS.setY(y);
|
||||
state = world.getBlockState(POS);
|
||||
|
||||
// Liquids
|
||||
if (!state.getFluidState().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// Falling blocks
|
||||
if (state.getBlock() instanceof FallingBlock) {
|
||||
else if (state.getBlock() instanceof FallingBlock) {
|
||||
BlockState falling = state;
|
||||
|
||||
POS.setY(POS.getY() - 1);
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
|
@ -158,15 +159,14 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
rb *= rb;
|
||||
if (y2 + x2 + z2 <= r) {
|
||||
state = world.getBlockState(POS);
|
||||
if (state.isIn(BlockTagRegistry.GEN_TERRAIN) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
|
||||
if (canReplace(state)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, y < waterLevel ? WATER : AIR);
|
||||
if (y == waterLevel - 1) {
|
||||
world.getFluidTickScheduler().schedule(POS, WATER.getFluidState().getFluid(), 0);
|
||||
}
|
||||
}
|
||||
pos = POS.down();
|
||||
if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.GEN_TERRAIN))
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.GEN_TERRAIN)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS.down(), BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
if (random.nextInt(3) == 0 && pos.getY() < waterLevel - 1) {
|
||||
EndBiome biome = BiomeRegistry.getFromBiome(world.getBiome(POS));
|
||||
|
@ -176,8 +176,8 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
pos = POS.up();
|
||||
if (world.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
|
||||
while (world.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
|
||||
if (canReplace(world.getBlockState(pos))) {
|
||||
while (canReplace(state = world.getBlockState(pos)) && !state.isAir() && state.getFluidState().isEmpty()) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, pos.getY() < waterLevel ? WATER : AIR);
|
||||
if (y == waterLevel - 1) {
|
||||
world.getFluidTickScheduler().schedule(POS, WATER.getFluidState().getFluid(), 0);
|
||||
|
@ -185,20 +185,20 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
pos = pos.up();
|
||||
}
|
||||
}
|
||||
} else if (y < waterLevel && y2 + x2 + z2 <= rb) {
|
||||
if (world.getBlockState(POS).getMaterial().isReplaceable()) {
|
||||
}
|
||||
// Make border
|
||||
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
|
||||
//if (world.getBlockState(POS).getMaterial().isReplaceable()) {
|
||||
if (world.isAir(POS.up())) {
|
||||
state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig()
|
||||
.getTopMaterial();
|
||||
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state
|
||||
: BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
|
||||
} else {
|
||||
BlocksHelper.setWithoutUpdate(world, POS,
|
||||
BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,4 +224,13 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canReplace(BlockState state) {
|
||||
return state.getMaterial().isReplaceable()
|
||||
|| state.isIn(BlockTagRegistry.GEN_TERRAIN)
|
||||
|| state.isOf(BlockRegistry.ENDSTONE_DUST)
|
||||
|| state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().equals(Material.UNDERWATER_PLANT)
|
||||
|| state.getMaterial().equals(Material.UNUSED_PLANT);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue