Flower pot fixes

This commit is contained in:
paulevsGitch 2021-07-29 14:20:53 +03:00
parent b6cf041fc4
commit aee9a88003

View file

@ -210,6 +210,19 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
for (int i = 0; i < soils.length; i++) { for (int i = 0; i < soils.length; i++) {
if (block == soils[i]) { if (block == soils[i]) {
BlocksHelper.setWithUpdate(level, pos, state.setValue(SOIL_ID, i + 1)); BlocksHelper.setWithUpdate(level, pos, state.setValue(SOIL_ID, i + 1));
if (!player.isCreative()) {
itemStack.shrink(1);
}
level.playSound(
player,
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
SoundEvents.SOUL_SOIL_PLACE,
SoundSource.BLOCKS,
1,
1
);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
} }
@ -240,16 +253,19 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
} }
int light = plants[i].defaultBlockState().getLightEmission() / 5; int light = plants[i].defaultBlockState().getLightEmission() / 5;
BlocksHelper.setWithUpdate(level, pos, state.setValue(PLANT_ID, i + 1).setValue(POT_LIGHT, light)); BlocksHelper.setWithUpdate(level, pos, state.setValue(PLANT_ID, i + 1).setValue(POT_LIGHT, light));
level.playLocalSound( level.playSound(
player,
pos.getX() + 0.5, pos.getX() + 0.5,
pos.getY() + 0.5, pos.getY() + 0.5,
pos.getZ() + 0.5, pos.getZ() + 0.5,
SoundEvents.HOE_TILL, SoundEvents.HOE_TILL,
SoundSource.BLOCKS, SoundSource.BLOCKS,
1, 1,
1, 1
false
); );
if (!player.isCreative()) {
itemStack.shrink(1);
}
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
} }