private static void addPamCrops() { if (!Loader.isModLoaded("harvestcraft")) return; try { Class<?> pamRegistry = Class.forName("com.pam.harvestcraft.blocks.CropRegistry"); Field names = pamRegistry.getDeclaredField("cropNames"); Method getCrop = pamRegistry.getMethod("getCrop", String.class); for (String name : (String[]) names.get(null)) { BlockCrops crop = (BlockCrops) getCrop.invoke(null, name); HarvestRegistry.registerStandardCrop(crop, crop.getMaxAge()); } } catch (ClassNotFoundException e) { BMLog.DEFAULT.error("HarvestCraft integration cancelled; unable to find registry class"); } catch (NoSuchMethodException | NoSuchFieldException e) { BMLog.DEFAULT.error("HarvestCraft integration cancelled; unable to find crop name mapper"); } catch (IllegalAccessException | InvocationTargetException e) { BMLog.DEFAULT.error("HarvestCraft integration cancelled; crop name lookup broke"); } } }
resetState = mcblock.getDefaultState().withProperty(BlockBeetroot.BEETROOT_AGE, 0); } else if (mcblock instanceof BlockCrops) { meta = ((BlockCrops) mcblock).getMaxAge(); resetMeta = 0; grownState = mcblock.getDefaultState().withProperty(BlockCrops.AGE, ((BlockCrops) mcblock).getMaxAge()); resetState = mcblock.getDefaultState().withProperty(BlockCrops.AGE, 0); } else if (mcblock instanceof BlockNetherWart) {
addMaturityTooltip(currenttip, accessor.getMetadata() / (float) ((BlockCrops) block).getMaxAge()); else if (block == melonStem || block == pumpkinStem) addMaturityTooltip(currenttip, accessor.getMetadata() / 7F);
int j = ((BlockCrops) this.cropTypeA).getMaxAge(); int k = j / 3; this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getInt(randomIn, k, j)), 1, 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getInt(randomIn, k, j)), 2, 1, i, structureBoundingBoxIn); int l = ((BlockCrops) this.cropTypeB).getMaxAge(); int i1 = l / 3; this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getInt(randomIn, i1, l)), 4, 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getInt(randomIn, i1, l)), 5, 1, i, structureBoundingBoxIn); int j1 = ((BlockCrops) this.cropTypeC).getMaxAge(); int k1 = j1 / 3; this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getInt(randomIn, k1, j1)), 7, 1, i, structureBoundingBoxIn); this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getInt(randomIn, k1, j1)), 8, 1, i, structureBoundingBoxIn); int l1 = ((BlockCrops) this.cropTypeD).getMaxAge(); int i2 = l1 / 3; this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(MathHelper.getInt(randomIn, i2, l1)), 10, 1, i, structureBoundingBoxIn);