public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) {
super.tick(state, worldIn, pos, random);
Map<BlockPos, IBlockState> blockStates = new HashMap();
blockStates.put(pos.north(), worldIn.getBlockState(pos.north()));
blockStates.put(pos.south(), worldIn.getBlockState(pos.south()));
blockStates.put(pos.east(), worldIn.getBlockState(pos.east()));
blockStates.put(pos.west(), worldIn.getBlockState(pos.west()));
for(Map.Entry<BlockPos, IBlockState> blockState : blockStates.entrySet()) {
Block block = blockState.getValue().getBlock();
if(block instanceof BlockCrops && block != BlockList.weeds && random.nextInt(4) == 0) {
worldIn.setBlockState(blockState.getKey(), BlockList.weeds.getDefaultState());
}
}
}
what is that
do it like so
public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) {
super.tick(state, worldIn, pos, random);
for (EnumFacing facing : EnumFacing.HORIZONTALS){
BlockPos offSet = pos.offset(facing);
IBlockState blockState = worldIn.getBlockState(offSet);
Block block = blockState.getBlock();
if(block instanceof BlockCrops && block != BlockList.weeds && random.nextInt(4) == 0) {
worldIn.setBlockState(blockState.getKey(), BlockList.weeds.getDefaultState());
}
}
}