Fix sap side

This commit is contained in:
drcrazy 2019-04-09 17:04:51 +03:00
parent 2a180cb5c2
commit f906aaa3cd
2 changed files with 22 additions and 18 deletions

View file

@ -106,13 +106,17 @@ public class BlockRubberLog extends BlockLog {
@Override
public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) {
super.tick(state, worldIn, pos, random);
if (!state.get(HAS_SAP)) {
if (random.nextInt(50) == 0) {
EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4));
if (worldIn.getBlockState(pos.down()).getBlock() == this
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing));
}
if (state.get(AXIS) != EnumFacing.Axis.Y) {
return;
}
if (state.get(HAS_SAP)) {
return;
}
if (random.nextInt(50) == 0) {
EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4));
if (worldIn.getBlockState(pos.down()).getBlock() == this
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing));
}
}
}