diff --git a/common/src/main/java/biomesoplenty/block/AlgalEndStoneBlock.java b/common/src/main/java/biomesoplenty/block/AlgalEndStoneBlock.java index dc18fe517..c9a92f590 100644 --- a/common/src/main/java/biomesoplenty/block/AlgalEndStoneBlock.java +++ b/common/src/main/java/biomesoplenty/block/AlgalEndStoneBlock.java @@ -108,6 +108,5 @@ public void performBonemeal(ServerLevel p_221270_, RandomSource p_221271_, Block holder.value().place(p_221270_, p_221270_.getChunkSource().getGenerator(), p_221271_, blockpos1); } } - } } diff --git a/common/src/main/java/biomesoplenty/block/NullPlantBlock.java b/common/src/main/java/biomesoplenty/block/NullPlantBlock.java index 0e01d6664..34e809706 100644 --- a/common/src/main/java/biomesoplenty/block/NullPlantBlock.java +++ b/common/src/main/java/biomesoplenty/block/NullPlantBlock.java @@ -5,19 +5,27 @@ package biomesoplenty.block; import biomesoplenty.init.ModTags; +import biomesoplenty.worldgen.feature.BOPTreeFeatures; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -public class NullPlantBlock extends Block +public class NullPlantBlock extends Block implements BonemealableBlock { protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); @@ -49,4 +57,40 @@ public boolean canBeReplaced(BlockState p_53910_, BlockPlaceContext p_53911_) { return true; } + + @Override + public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState) + { + return true; + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource randomSource, BlockPos blockPos, BlockState blockState) + { + return (double)randomSource.nextFloat() < 0.1D; + } + + @Override + public void performBonemeal(ServerLevel serverLevel, RandomSource randomSource, BlockPos blockPos, BlockState blockState) + { + this.growTree(serverLevel, randomSource, blockPos, blockState); + } + + public boolean growTree(ServerLevel serverLevel, RandomSource randomSource, BlockPos blockPos, BlockState blockState) + { + serverLevel.removeBlock(blockPos, false); + + Registry> configuredFeatureRegistry = serverLevel.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); + ConfiguredFeature feature = configuredFeatureRegistry.get(BOPTreeFeatures.NULL_TREE); + + if (feature.place(serverLevel, serverLevel.getChunkSource().getGenerator(), randomSource, blockPos)) + { + return true; + } + else + { + serverLevel.setBlock(blockPos, blockState, 3); + return false; + } + } } diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/MonolithFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/MonolithFeature.java index be19ce5c6..8c660e5d1 100644 --- a/common/src/main/java/biomesoplenty/worldgen/feature/misc/MonolithFeature.java +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/MonolithFeature.java @@ -23,7 +23,7 @@ public class MonolithFeature extends Feature { protected SimpleBlockPredicate placeOn = (world, pos) -> world.getBlockState(pos).getBlock() == BOPBlocks.UNMAPPED_END_STONE; - protected SimpleBlockPredicate replace = (world, pos) -> TreeFeature.isAirOrLeaves(world, pos) || world.getBlockState(pos).is(BlockTags.REPLACEABLE_BY_TREES) || world.getBlockState(pos).getBlock() instanceof BushBlock; + protected SimpleBlockPredicate replace = (world, pos) -> TreeFeature.isAirOrLeaves(world, pos) || world.getBlockState(pos).is(BlockTags.REPLACEABLE_BY_TREES) || world.getBlockState(pos).getBlock() instanceof BushBlock || world.getBlockState(pos).getBlock() == BOPBlocks.NULL_END_STONE; public MonolithFeature(Codec deserializer) { @@ -48,7 +48,7 @@ public boolean place(FeaturePlaceContext featurePlaceC int sizeX = 1 + rand.nextInt(3); int sizeZ = 1 + rand.nextInt(3); - int height = 4 + rand.nextInt(8); + int height = 5 + rand.nextInt(7); if (!this.checkSpace(world, startPos.above(), sizeX, sizeZ, height)) { @@ -60,11 +60,21 @@ public boolean place(FeaturePlaceContext featurePlaceC for (int x = 0; x <= sizeX; x++) { - for (int y = -4; y <= height; y++) + for (int y = -6; y <= height; y++) { for (int z = 0; z <= sizeZ; z++) { - this.setBlock(world, pos.offset(x,y,z), Blocks.OBSIDIAN.defaultBlockState()); + if (y == height - 1) + { + if ((x == 0 || x == sizeX) && (z == 0 || z == sizeZ)) + { + this.setBlock(world, pos.offset(x,y,z), Blocks.OBSIDIAN.defaultBlockState()); + } + } + else + { + this.setBlock(world, pos.offset(x,y,z), Blocks.OBSIDIAN.defaultBlockState()); + } } } } diff --git a/common/src/main/resources/assets/biomesoplenty/blockstates/null_plant.json b/common/src/main/resources/assets/biomesoplenty/blockstates/null_plant.json index 7c4ed11cd..a8810ca48 100644 --- a/common/src/main/resources/assets/biomesoplenty/blockstates/null_plant.json +++ b/common/src/main/resources/assets/biomesoplenty/blockstates/null_plant.json @@ -2,9 +2,7 @@ "variants": { "": [ { "model": "biomesoplenty:block/null_plant" }, - { "model": "biomesoplenty:block/null_plant_alt" }, - { "model": "biomesoplenty:block/null_plant_alt_2" }, - { "model": "biomesoplenty:block/null_plant_alt_3" } + { "model": "biomesoplenty:block/null_plant_alt" } ] } } \ No newline at end of file diff --git a/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_2.json b/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_2.json deleted file mode 100644 index 71a7d43f1..000000000 --- a/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_2.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/cross", - "textures": { - "cross": "biomesoplenty:block/null_plant_alt_2" - } -} diff --git a/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_3.json b/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_3.json deleted file mode 100644 index f6dccdb3f..000000000 --- a/common/src/main/resources/assets/biomesoplenty/models/block/null_plant_alt_3.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/cross", - "textures": { - "cross": "biomesoplenty:block/null_plant_alt_3" - } -} diff --git a/common/src/main/resources/assets/biomesoplenty/textures/block/liquid_null_still.png b/common/src/main/resources/assets/biomesoplenty/textures/block/liquid_null_still.png index fc6b7d4ed..6459911b1 100644 Binary files a/common/src/main/resources/assets/biomesoplenty/textures/block/liquid_null_still.png and b/common/src/main/resources/assets/biomesoplenty/textures/block/liquid_null_still.png differ diff --git a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt.png b/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt.png index af0410483..2891b49de 100644 Binary files a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt.png and b/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt.png differ diff --git a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_2.png b/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_2.png deleted file mode 100644 index a4ba61b48..000000000 Binary files a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_2.png and /dev/null differ diff --git a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_3.png b/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_3.png deleted file mode 100644 index 2891b49de..000000000 Binary files a/common/src/main/resources/assets/biomesoplenty/textures/block/null_plant_alt_3.png and /dev/null differ diff --git a/common/src/main/resources/data/biomesoplenty/tags/blocks/null_replaceable.json b/common/src/main/resources/data/biomesoplenty/tags/blocks/null_replaceable.json index 9101e62ea..bd1732290 100644 --- a/common/src/main/resources/data/biomesoplenty/tags/blocks/null_replaceable.json +++ b/common/src/main/resources/data/biomesoplenty/tags/blocks/null_replaceable.json @@ -8,6 +8,7 @@ "biomesoplenty:null_end_stone", "biomesoplenty:null_block", "biomesoplenty:null_plant", + "biomesoplenty:liquid_null", "biomesoplenty:white_sand", "biomesoplenty:white_sandstone" ]