diff --git a/src/main/java/ru/betterend/blocks/BlockEndLily.java b/src/main/java/ru/betterend/blocks/BlockEndLily.java index 5b896449..48a7bd5a 100644 --- a/src/main/java/ru/betterend/blocks/BlockEndLily.java +++ b/src/main/java/ru/betterend/blocks/BlockEndLily.java @@ -15,6 +15,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; +import net.minecraft.world.WorldView; import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.basis.BlockUnderwaterPlant; @@ -50,7 +51,17 @@ public class BlockEndLily extends BlockUnderwaterPlant { } @Override - protected boolean isTerrain(BlockState state) { - return super.isTerrain(state) || state.getBlock() == this; + public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + if (state.get(SHAPE) == TripleShape.TOP) { + return world.getBlockState(pos.down()).getBlock() == this; + } + else if (state.get(SHAPE) == TripleShape.BOTTOM) { + return isTerrain(world.getBlockState(pos.down())); + } + else { + BlockState up = world.getBlockState(pos.up()); + BlockState down = world.getBlockState(pos.down()); + return up.getBlock() == this && down.getBlock() == this; + } } } diff --git a/src/main/java/ru/betterend/world/features/EndLakeFeature.java b/src/main/java/ru/betterend/world/features/EndLakeFeature.java index 6fb9c14f..2f5c2307 100644 --- a/src/main/java/ru/betterend/world/features/EndLakeFeature.java +++ b/src/main/java/ru/betterend/world/features/EndLakeFeature.java @@ -10,6 +10,9 @@ import net.minecraft.util.math.BlockPos.Mutable; import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.feature.DefaultFeatureConfig; +import ru.betterend.blocks.BlockEndLily; +import ru.betterend.blocks.BlockEndLilySeed; +import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.registry.BlockRegistry; import ru.betterend.registry.BlockTagRegistry; @@ -65,7 +68,7 @@ public class EndLakeFeature extends DefaultFeature { POS.setZ(z); int mz = z - maskMinZ; if (!mask[mx][mz]) { - for (int y = waterLevel; y <= waterLevel + 20; y++) { + for (int y = waterLevel + 1; y <= waterLevel + 20; y++) { POS.setY(y); FluidState fluid = world.getFluidState(POS); if (!fluid.isEmpty()) { @@ -163,8 +166,19 @@ public class EndLakeFeature extends DefaultFeature { if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.END_GROUND)) { BlocksHelper.setWithoutUpdate(world, POS.down(), BlockRegistry.ENDSTONE_DUST.getDefaultState()); - if (y < waterLevel - 1 && random.nextInt(3) == 0 && NOISE.eval(x * 0.1, z * 0.1) > 0.3) { - BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.BUBBLE_CORAL.getDefaultState()); + if (y < waterLevel - 1 && random.nextInt(3) == 0 && ((x + z) & 1) == 0) { + if (NOISE.eval(x * 0.1, z * 0.1, 0) > 0) { + BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.BUBBLE_CORAL.getDefaultState()); + } + else if (NOISE.eval(x * 0.1, z * 0.1, 1) > 0) { + world.setBlockState(POS, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM), 0); + BlockPos up = POS.up(); + while (up.getY() < waterLevel) { + BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE)); + up = up.up(); + } + BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP)); + } } } pos = POS.up(); diff --git a/src/main/resources/assets/betterend/models/item/end_lily_seed.json b/src/main/resources/assets/betterend/models/item/end_lily_seed.json new file mode 100644 index 00000000..fd31f44e --- /dev/null +++ b/src/main/resources/assets/betterend/models/item/end_lily_seed.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "betterend:item/end_lily_seed" + } +}