@Override public void postInit() { ICharcoalManager manager = TreeManager.charcoalManager; if (manager != null) { manager.registerWall(Blocks.CLAY, 3); manager.registerWall(getBlocks().loam, 4); manager.registerWall(Blocks.END_STONE, 6); manager.registerWall(Blocks.END_BRICKS, 6); manager.registerWall(Blocks.DIRT, 2); manager.registerWall(Blocks.GRAVEL, 1); manager.registerWall(Blocks.NETHERRACK, 3); manager.registerWall(ModuleCore.getBlocks().ashBrick, 5); } }
@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); }
@Override public void apply() { if (manager == null) { CraftTweakerAPI.logError("Charcoal manager is null, probably the charcoal module is not enabled"); return; } boolean success = false; if (block != null) { success = manager.removeWall(block); } else if (state != null) { success = manager.removeWall(state); } else { CraftTweakerAPI.logError("Both block and blockstate were null, no wall removed"); } if (!success) { CraftTweakerAPI.logError("Removing wall was not successful"); } } }
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; }
@Override public void apply() { if (manager == null) { CraftTweakerAPI.logError("Charcoal manager is null, probably the charcoal module is not enabled"); return; } if (block != null) { manager.registerWall(block, amount); } else if (state != null) { manager.registerWall(state, amount); } else { CraftTweakerAPI.logError("Both block and blockstate were null, no wall registered"); } } }