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) { 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; WeightedList<Block> list = null;
if (map != null) { if (map != null) {
list = map.get(terrain); list = map.get(terrain);
if (list == null) { if (list == null) {
list = LAND_GRASS_TYPES.get(terrain); list = WATER_GRASS_TYPES.get(terrain);
} }
} }
else { else {
list = LAND_GRASS_TYPES.get(terrain); list = WATER_GRASS_TYPES.get(terrain);
} }
return list == null ? null : list.get(random); return list == null ? null : list.get(random);
} }

View file

@ -44,13 +44,13 @@ public class BoneMealItemMixin {
} }
} }
else { else {
BlockState state = world.getBlockState(offseted); BlockState stateAbove = world.getBlockState(blockPos.above());
if (!state.getFluidState().isEmpty()) { if (!stateAbove.getFluidState().isEmpty()) {
if (state.is(Blocks.WATER)) { if (stateAbove.is(Blocks.WATER)) {
consume = bclib_growWaterGrass(world, blockPos); consume = bclib_growWaterGrass(world, blockPos);
} }
} }
else if (state.isAir()) { else if (stateAbove.isAir()) {
consume = bclib_growLandGrass(world, blockPos); consume = bclib_growLandGrass(world, blockPos);
} }
} }
@ -126,7 +126,7 @@ public class BoneMealItemMixin {
private BlockState bclib_getWaterGrassState(Level world, BlockPos pos) { private BlockState bclib_getWaterGrassState(Level world, BlockPos pos) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
Block block = state.getBlock(); 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(); return block == null ? null : block.defaultBlockState();
} }