Tube worm generation

This commit is contained in:
paulevsGitch 2020-12-06 05:48:50 +03:00
parent e3769bb20b
commit 9025194a80
5 changed files with 27 additions and 6 deletions

View file

@ -89,7 +89,6 @@ public class EndFeatures {
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5); public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5);
public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(20), 25); public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(20), 25);
public static final EndFeature HYDRALUX = new EndFeature("hydralux", new HydraluxFeature(5), 5); public static final EndFeature HYDRALUX = new EndFeature("hydralux", new HydraluxFeature(5), 5);
public static final EndFeature TUBE_WORM = new EndFeature("tube_worm", new WallPlantFeature(EndBlocks.TUBE_WORM, 6), 15);
// Terrain // // Terrain //
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4); public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);

View file

@ -19,7 +19,6 @@ public class BiomeSulfurSprings extends EndBiome {
.addFeature(EndFeatures.SULPHURIC_LAKE) .addFeature(EndFeatures.SULPHURIC_LAKE)
.addFeature(EndFeatures.SULPHURIC_CAVE) .addFeature(EndFeatures.SULPHURIC_CAVE)
.addFeature(EndFeatures.HYDRALUX) .addFeature(EndFeatures.HYDRALUX)
.addFeature(EndFeatures.TUBE_WORM)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4)); .addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
} }
} }

View file

@ -6,6 +6,7 @@ import java.util.function.Function;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.BubbleColumnBlock; import net.minecraft.block.BubbleColumnBlock;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -41,6 +42,7 @@ public class GeyserFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE1; protected static final Function<BlockState, Boolean> REPLACE1;
protected static final Function<BlockState, Boolean> REPLACE2; protected static final Function<BlockState, Boolean> REPLACE2;
private static final Function<BlockState, Boolean> IGNORE; private static final Function<BlockState, Boolean> IGNORE;
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) { public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
@ -155,13 +157,20 @@ public class GeyserFeature extends DefaultFeature {
int dist = MHelper.floor(6 - distRaw) + random.nextInt(2); int dist = MHelper.floor(6 - distRaw) + random.nextInt(2);
if (dist >= 0) { if (dist >= 0) {
BlockState state = world.getBlockState(mut); BlockState state = world.getBlockState(mut);
while (state.isOf(Blocks.WATER)) { while (!state.getFluidState().isEmpty() || state.getMaterial().equals(Material.UNDERWATER_PLANT)) {
mut.setY(mut.getY() - 1); mut.setY(mut.getY() - 1);
state = world.getBlockState(mut); state = world.getBlockState(mut);
} }
if (state.isIn(EndTags.GEN_TERRAIN)) { if (state.isIn(EndTags.GEN_TERRAIN) && !world.getBlockState(mut.up()).isOf(EndBlocks.HYDROTHERMAL_VENT)) {
for (int j = 0; j <= dist; j++) { for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
MHelper.shuffle(HORIZONTAL, random);
for (Direction dir: HORIZONTAL) {
BlockPos p = mut.offset(dir);
if (random.nextBoolean() && world.getBlockState(p).isOf(Blocks.WATER)) {
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.TUBE_WORM.getDefaultState().with(HorizontalFacingBlock.FACING, dir));
}
}
mut.setY(mut.getY() + 1); mut.setY(mut.getY() + 1);
} }
state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2); state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2);

View file

@ -8,6 +8,7 @@ import com.google.common.collect.Sets;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.BubbleColumnBlock; import net.minecraft.block.BubbleColumnBlock;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable; import net.minecraft.util.math.BlockPos.Mutable;
@ -28,6 +29,7 @@ import ru.betterend.world.features.DefaultFeature;
public class SulphuricCaveFeature extends DefaultFeature { public class SulphuricCaveFeature extends DefaultFeature {
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.getDefaultState(); private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.getDefaultState();
private static final BlockState WATER = Blocks.WATER.getDefaultState(); private static final BlockState WATER = Blocks.WATER.getDefaultState();
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) { public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
@ -106,13 +108,20 @@ public class SulphuricCaveFeature extends DefaultFeature {
int dist = MHelper.floor(3 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2); int dist = MHelper.floor(3 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
if (dist > 0) { if (dist > 0) {
state = world.getBlockState(mut); state = world.getBlockState(mut);
while (state.isOf(Blocks.WATER)) { while (!state.getFluidState().isEmpty() || state.getMaterial().equals(Material.UNDERWATER_PLANT)) {
mut.setY(mut.getY() - 1); mut.setY(mut.getY() - 1);
state = world.getBlockState(mut); state = world.getBlockState(mut);
} }
if (state.isIn(EndTags.GEN_TERRAIN)) { if (state.isIn(EndTags.GEN_TERRAIN) && !world.getBlockState(mut.up()).isOf(EndBlocks.HYDROTHERMAL_VENT)) {
for (int j = 0; j <= dist; j++) { for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone); BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
MHelper.shuffle(HORIZONTAL, random);
for (Direction dir: HORIZONTAL) {
BlockPos p = mut.offset(dir);
if (random.nextBoolean() && world.getBlockState(p).isOf(Blocks.WATER)) {
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.TUBE_WORM.getDefaultState().with(HorizontalFacingBlock.FACING, dir));
}
}
mut.setY(mut.getY() + 1); mut.setY(mut.getY() + 1);
} }
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT); BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT);
@ -141,6 +150,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|| state.isOf(EndBlocks.SULPHUR_CRYSTAL) || state.isOf(EndBlocks.SULPHUR_CRYSTAL)
|| state.getMaterial().isReplaceable() || state.getMaterial().isReplaceable()
|| state.getMaterial().equals(Material.PLANT) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.UNDERWATER_PLANT)
|| state.getMaterial().equals(Material.LEAVES); || state.getMaterial().equals(Material.LEAVES);
} }

View file

@ -36,6 +36,10 @@
{ {
"sprite": "betterend:block/hydralux_vine_bottom", "sprite": "betterend:block/hydralux_vine_bottom",
"material": "betterend:waving_floor" "material": "betterend:waving_floor"
},
{
"sprite": "betterend:block/hydralux_flower_bud_petal_bottom",
"material": "betterend:waving_glow_inc"
} }
] ]
} }