Private
Public Access
1
0

Fixed bonemealing for bush block.

This commit is contained in:
2026-05-25 22:04:59 +01:00
parent db57036375
commit 5c4ff6fd4c

View File

@ -5,6 +5,7 @@ import dev.micle.firefly_bush_backport.particle.ModParticles;
import dev.micle.firefly_bush_backport.sound.ModSounds; import dev.micle.firefly_bush_backport.sound.ModSounds;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.BushBlock; import net.minecraft.block.BushBlock;
import net.minecraft.block.IGrowable; import net.minecraft.block.IGrowable;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -80,13 +81,13 @@ public class FireflyBushBlock extends BushBlock implements IGrowable {
} }
private static Optional<BlockPos> findSpreadableNeighbourPos(World level, BlockPos blockPos, BlockState blockState) { private static Optional<BlockPos> findSpreadableNeighbourPos(World level, BlockPos blockPos, BlockState blockState) {
return getSpreadableNeighbourPos(shuffledCopy((Direction[])Direction.Plane.HORIZONTAL.stream().toArray(), level.random), level, blockPos, blockState); return getSpreadableNeighbourPos(shuffledCopy(Direction.Plane.HORIZONTAL.stream().toArray(Direction[]::new), level.random), level, blockPos, blockState);
} }
private static Optional<BlockPos> getSpreadableNeighbourPos(List<Direction> directions, IBlockReader levelReader, BlockPos blockPos, BlockState blockState) { private static Optional<BlockPos> getSpreadableNeighbourPos(List<Direction> directions, IBlockReader levelReader, BlockPos blockPos, BlockState blockState) {
for (Direction direction : directions) { for (Direction direction : directions) {
BlockPos blockPosDirection = blockPos.relative(direction); BlockPos blockPosDirection = blockPos.relative(direction);
if (levelReader.getBlockState(blockPosDirection).isAir() && blockState.canSurvive((IWorldReader) levelReader, blockPosDirection)) { if (levelReader.getBlockState(blockPosDirection).is(Blocks.AIR) && blockState.canSurvive((IWorldReader) levelReader, blockPosDirection)) {
return Optional.of(blockPosDirection); return Optional.of(blockPosDirection);
} }
} }