Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random){
- if (TreeUtils.doDecay(worldIn, pos, this, 7)){
- spawnDrops(state, worldIn, pos);
- worldIn.removeBlock(pos, false);
- }
- }
- public static boolean doDecay(ServerWorld worldIn, BlockPos pos, Block block, int distance){
- BlockState[] blockStates = new BlockState[] {
- worldIn.getBlockState(pos.down().north()),
- worldIn.getBlockState(pos.down().east()),
- worldIn.getBlockState(pos.down().south()),
- worldIn.getBlockState(pos.down().west()),
- worldIn.getBlockState(pos.up().north()),
- worldIn.getBlockState(pos.up().east()),
- worldIn.getBlockState(pos.up().south()),
- worldIn.getBlockState(pos.up().west()),
- worldIn.getBlockState(pos.down().north().east()),
- worldIn.getBlockState(pos.down().north().west()),
- worldIn.getBlockState(pos.down().south().east()),
- worldIn.getBlockState(pos.down().south().west()),
- worldIn.getBlockState(pos.up().north().east()),
- worldIn.getBlockState(pos.up().north().west()),
- worldIn.getBlockState(pos.up().south().east()),
- worldIn.getBlockState(pos.up().south().west()),
- worldIn.getBlockState(pos.north().east()),
- worldIn.getBlockState(pos.north().west()),
- worldIn.getBlockState(pos.south().east()),
- worldIn.getBlockState(pos.south().west())
- };
- for (BlockState blockState : blockStates){
- if (blockState.getBlock() == block && !blockState.get(BlockStateProperties.PERSISTENT) && blockState.get(BlockStateProperties.DISTANCE_1_7) == distance - 1)
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement