@Override public void register(IModRegistry registry) { ICharcoalManager charcoalManager = TreeManager.charcoalManager; if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.CHARCOAL)) || charcoalManager == null) { return; } registry.handleRecipes(CharcoalPileWall.class, CharcoalPileWallWrapper::new, RECIPE_UID); registry.addRecipes(charcoalManager.getWalls(), RECIPE_UID); registry.addRecipeCatalyst(new ItemStack(ModuleCharcoal.getBlocks().woodPile), RECIPE_UID); }
private int getCharcoalFaceAmount(World world, BlockPos pos, EnumFacing facing) { ICharcoalManager charcoalManager = Preconditions.checkNotNull(TreeManager.charcoalManager); Collection<ICharcoalPileWall> walls = charcoalManager.getWalls(); BlockPos.MutableBlockPos testPos = new BlockPos.MutableBlockPos(pos); testPos.move(facing); int i = 0; while (i < Config.charcoalWallCheckRange && world.isBlockLoaded(testPos) && !world.isAirBlock(testPos)) { IBlockState state = world.getBlockState(testPos); for (ICharcoalPileWall wall : walls) { if (wall.matches(state)) { return wall.getCharcoalAmount(); } } testPos.move(facing); i++; } return 0; }