Underwater plants fix

This commit is contained in:
paulevsGitch 2021-07-16 15:35:01 +03:00
parent 1609b28595
commit 036a94e171
2 changed files with 8 additions and 8 deletions

View file

@ -127,16 +127,16 @@ public class BonemealAPI {
}
public static Block getWaterGrass(ResourceLocation biomeID, Block terrain, Random random) {
Map<Block, WeightedList<Block>> map = LAND_GRASS_BIOMES.get(biomeID);
Map<Block, WeightedList<Block>> map = WATER_GRASS_BIOMES.get(biomeID);
WeightedList<Block> list = null;
if (map != null) {
list = map.get(terrain);
if (list == null) {
list = LAND_GRASS_TYPES.get(terrain);
list = WATER_GRASS_TYPES.get(terrain);
}
}
else {
list = LAND_GRASS_TYPES.get(terrain);
list = WATER_GRASS_TYPES.get(terrain);
}
return list == null ? null : list.get(random);
}

View file

@ -44,13 +44,13 @@ public class BoneMealItemMixin {
}
}
else {
BlockState state = world.getBlockState(offseted);
if (!state.getFluidState().isEmpty()) {
if (state.is(Blocks.WATER)) {
BlockState stateAbove = world.getBlockState(blockPos.above());
if (!stateAbove.getFluidState().isEmpty()) {
if (stateAbove.is(Blocks.WATER)) {
consume = bclib_growWaterGrass(world, blockPos);
}
}
else if (state.isAir()) {
else if (stateAbove.isAir()) {
consume = bclib_growLandGrass(world, blockPos);
}
}
@ -126,7 +126,7 @@ public class BoneMealItemMixin {
private BlockState bclib_getWaterGrassState(Level world, BlockPos pos) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();
block = BonemealAPI.getLandGrass(BiomeAPI.getBiomeID(world.getBiome(pos)), block, world.getRandom());
block = BonemealAPI.getWaterGrass(BiomeAPI.getBiomeID(world.getBiome(pos)), block, world.getRandom());
return block == null ? null : block.defaultBlockState();
}