This commit is contained in:
paulevsGitch 2020-10-20 22:02:24 +03:00
parent cac7be60b1
commit bf2249335e
10 changed files with 57 additions and 186 deletions

View file

@ -17,7 +17,7 @@ public class BlockEndLotusFlower extends BlockPlant {
private static final VoxelShape SHAPE_COLLISION = Block.createCuboidShape(0, 0, 0, 16, 2, 16);
public BlockEndLotusFlower() {
super(FabricBlockSettings.of(Material.PLANT).lightLevel(15));
super(FabricBlockSettings.of(Material.PLANT).nonOpaque().lightLevel(15));
}
@Override

View file

@ -25,7 +25,7 @@ public class BlockEndLotusLeaf extends BlockBaseNotFull {
private static final VoxelShape VSHAPE = Block.createCuboidShape(0, 0, 0, 16, 1, 16);
public BlockEndLotusLeaf() {
super(FabricBlockSettings.of(Material.PLANT).sounds(BlockSoundGroup.WET_GRASS));
super(FabricBlockSettings.of(Material.PLANT).nonOpaque().sounds(BlockSoundGroup.WET_GRASS));
}
@Override

View file

@ -45,7 +45,6 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
bpos.setY(bpos.getY() + 1);
for (int i = 1; i <= height; i++) {
if (!world.isAir(bpos)) {
System.out.println("Set incorrect flower!");
bpos.setY(bpos.getY() - 1);
BlocksHelper.setWithoutUpdate(world, bpos, flower);
bpos.setY(bpos.getY() - 1);
@ -61,7 +60,6 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
bpos.setY(bpos.getY() - 1);
}
System.out.println("Set flower!");
BlocksHelper.setWithoutUpdate(world, bpos, flower);
bpos.setY(bpos.getY() - 1);
stem = world.getBlockState(bpos);
@ -100,7 +98,7 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
p.setX(pos.getX() + x);
for (int z = -1; z < 2; z ++) {
p.setZ(pos.getZ() + z);
if (world.isAir(p))
if (world.isAir(p) && !world.getFluidState(p.down()).isEmpty())
count ++;
}
}

View file

@ -41,8 +41,8 @@ public class FeatureRegistry {
public static final EndFeature BUBBLE_CORAL_RARE = new EndFeature("bubble_coral_rare", new UnderwaterPlantFeature(BlockRegistry.BUBBLE_CORAL, 3), 2);
public static final EndFeature END_LILY = new EndFeature("end_lily", new EndLilyFeature(10), 10);
public static final EndFeature END_LILY_RARE = new EndFeature("end_lily_rare", new EndLilyFeature(3), 1);
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(5), 5);
public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(5), 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);
// Features //
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);

View file

@ -47,7 +47,6 @@ public class EndFeature {
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
this.feature = Registry.register(Registry.FEATURE, id, feature);
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(density));
//return new EndFeature(name, feature, GenerationStep.Feature.VEGETAL_DECORATION, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(4));
}
public static EndFeature makeRawGenFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {

View file

@ -20,7 +20,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
if (hasLeaf(world, blockPos)) {
if (canGenerate(world, blockPos)) {
generateLeaf(world, blockPos);
}
}
@ -49,7 +49,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
}
}
private boolean hasLeaf(StructureWorldAccess world, BlockPos pos) {
private boolean canGenerate(StructureWorldAccess world, BlockPos pos) {
Mutable p = new Mutable();
p.setY(pos.getY());
int count = 0;
@ -57,7 +57,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
p.setX(pos.getX() + x);
for (int z = -1; z < 2; z ++) {
p.setZ(pos.getZ() + z);
if (world.isAir(p))
if (world.isAir(p) && world.getBlockState(p.down()).isOf(Blocks.WATER))
count ++;
}
}