This commit is contained in:
paulevsGitch 2020-10-03 08:47:48 +03:00
parent 0d0373a540
commit a0aa8c929e
3 changed files with 17 additions and 12 deletions

View file

@ -21,6 +21,10 @@ public abstract class DefaultFeature extends Feature<DefaultFeatureConfig> {
return world.getTopPosition(Type.WORLD_SURFACE, pos);
}
protected BlockPos getPosOnSurfaceWG(StructureWorldAccess world, BlockPos pos) {
return world.getTopPosition(Type.WORLD_SURFACE_WG, pos);
}
protected BlockPos getPosOnSurfaceRaycast(StructureWorldAccess world, BlockPos pos) {
int h = BlocksHelper.downRay(world, pos, 256);
return pos.down(h);

View file

@ -28,7 +28,7 @@ public class EndLakeFeature extends DefaultFeature {
int dist = MHelper.floor(radius);
int dist2 = MHelper.floor(radius * 1.5);
int bott = MHelper.floor(depth);
blockPos = getPosOnSurface(world, blockPos);
blockPos = getPosOnSurfaceWG(world, blockPos);
if (blockPos.getY() < 10) return false;
int waterLevel = blockPos.getY();
@ -65,7 +65,7 @@ public class EndLakeFeature extends DefaultFeature {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, POS) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
if (state.isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, POS) || state.getMaterial().equals(Material.PLANT)/* || state.getBlock() == BlockRegistry.ENDSTONE_DUST*/) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.down();
@ -79,13 +79,11 @@ public class EndLakeFeature extends DefaultFeature {
else
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.ENDSTONE_DUST.getDefaultState());
}
pos = POS.up();
if (world.getBlockState(pos).isIn(BlockTagRegistry.END_GROUND)) {
while (world.getBlockState(pos).isIn(BlockTagRegistry.END_GROUND)) {
/*pos = POS.up();
while (world.getBlockState(pos).isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, pos) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
BlocksHelper.setWithoutUpdate(world, pos, AIR);
pos = pos.up();
}
}
}*/
}
}
}
@ -110,7 +108,7 @@ public class EndLakeFeature extends DefaultFeature {
rb *= rb;
if (y2 + x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.isIn(BlockTagRegistry.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
if (state.isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, POS) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
BlocksHelper.setWithoutUpdate(world, POS, y < waterLevel ? WATER : AIR);
}
pos = POS.down();

View file

@ -26,13 +26,16 @@ public abstract class ScatterFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center, DefaultFeatureConfig featureConfig) {
center = getPosOnSurface(world, center);
center = getPosOnSurfaceWG(world, center);
if (center.getY() < 5) {
return false;
}
if (!world.getBlockState(center.down()).isIn(BlockTagRegistry.END_GROUND)) {
//center = getPosOnSurfaceRaycast(world, new BlockPos(center.getX(), 72, center.getZ()), 72);
//if (center.getY() < 5 || !world.getBlockState(center.down()).isIn(BlockTagRegistry.END_GROUND)) {
return false;
//}
}
float r = MHelper.randRange(radius * 0.5F, radius, random);