Search in sources :

Example 1 with ExtraTreePlanks

use of binnie.extratrees.wood.planks.ExtraTreePlanks in project Binnie by ForestryMC.

the class ModuleWood method registerItemsAndBlocks.

@Override
public void registerItemsAndBlocks() {
    MinecraftForge.EVENT_BUS.register(this);
    WoodAccess woodAccess = WoodAccess.getInstance();
    registerPlanks();
    logs = BlockETLog.create(false);
    logsFireproof = BlockETLog.create(true);
    for (BlockETLog block : logs) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.LOG_WOOD, block);
    }
    logsFireproof = BlockETLog.create(true);
    for (BlockETLog block : logsFireproof) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.LOG_WOOD, block);
    }
    woodAccess.registerLogs(logs);
    woodAccess.registerLogs(logsFireproof);
    planks = BlockETPlank.create(false);
    for (BlockETPlank block : planks) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.PLANK_WOOD, block);
    }
    planksFireproof = BlockETPlank.create(true);
    for (BlockETPlank block : planksFireproof) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.PLANK_WOOD, block);
    }
    woodAccess.registerPlanks(planks);
    woodAccess.registerPlanks(planksFireproof);
    slabs = BlockETSlab.create(false, false);
    slabsDouble = BlockETSlab.create(false, true);
    for (int i = 0; i < slabs.size(); i++) {
        BlockETSlab slab = slabs.get(i);
        BlockETSlab slabDouble = slabsDouble.get(i);
        ExtraTrees.proxy.registerBlock(slab, new ItemETSlab(slab, slab, slabDouble));
        ExtraTrees.proxy.registerBlock(slabDouble, new ItemETSlab(slabDouble, slab, slabDouble));
        registerOreDictWildcard(OreDictUtil.SLAB_WOOD, slab);
    }
    slabsFireproof = BlockETSlab.create(true, false);
    slabsDoubleFireproof = BlockETSlab.create(true, true);
    for (int i = 0; i < slabsFireproof.size(); i++) {
        BlockETSlab slab = slabsFireproof.get(i);
        BlockETSlab slabDouble = slabsDoubleFireproof.get(i);
        ExtraTrees.proxy.registerBlock(slab, new ItemETSlab(slab, slab, slabDouble));
        ExtraTrees.proxy.registerBlock(slabDouble, new ItemETSlab(slabDouble, slab, slabDouble));
        registerOreDictWildcard(OreDictUtil.SLAB_WOOD, slab);
    }
    woodAccess.registerSlabs(slabs);
    woodAccess.registerSlabs(slabsFireproof);
    stairs = new ArrayList<>();
    for (BlockETPlank plank : planks) {
        for (IBlockState blockState : plank.getBlockState().getValidStates()) {
            int meta = plank.getMetaFromState(blockState);
            EnumETLog woodType = plank.getWoodType(meta);
            BlockForestryStairs<EnumETLog> stair = new BlockForestryStairs<>(false, blockState, woodType);
            String name = "stairs." + woodType;
            stair.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
            stair.setUnlocalizedName(name);
            ExtraTrees.proxy.registerBlock(stair, new ItemBlockETWood<>(stair));
            stairs.add(stair);
            registerOreDictWildcard(OreDictUtil.STAIR_WOOD, stair);
        }
    }
    stairsFireproof = new ArrayList<>();
    for (BlockETPlank plank : planksFireproof) {
        for (IBlockState blockState : plank.getBlockState().getValidStates()) {
            int meta = plank.getMetaFromState(blockState);
            EnumETLog woodType = plank.getWoodType(meta);
            BlockForestryStairs<EnumETLog> stair = new BlockForestryStairs<>(true, blockState, woodType);
            String name = "stairs.fireproof." + woodType;
            stair.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
            stair.setUnlocalizedName(name);
            ExtraTrees.proxy.registerBlock(stair, new ItemBlockETWood<>(stair));
            stairsFireproof.add(stair);
            registerOreDictWildcard(OreDictUtil.STAIR_WOOD, stair);
        }
    }
    woodAccess.registerStairs(stairs);
    woodAccess.registerStairs(stairsFireproof);
    fences = BlockETFence.create(false);
    for (BlockETFence block : fences) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.FENCE_WOOD, block);
        FMLInterModComms.sendMessage("forestry", "add-fence-block", block.getRegistryName().toString());
    }
    fencesFireproof = BlockETFence.create(true);
    for (BlockETFence block : fencesFireproof) {
        ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
        registerOreDictWildcard(OreDictUtil.FENCE_WOOD, block);
        FMLInterModComms.sendMessage("forestry", "add-fence-block", block.getRegistryName().toString());
    }
    woodAccess.registerFences(fences);
    woodAccess.registerFences(fencesFireproof);
    fenceGates = new ArrayList<>();
    fenceGatesFireproof = new ArrayList<>();
    for (ExtraTreePlanks plankType : ExtraTreePlanks.VALUES) {
        EnumETLog woodType = plankType.getWoodType();
        BlockForestryFenceGate<EnumETLog> fenceGate = new BlockForestryFenceGate<>(false, woodType);
        String name = "fence.gates." + woodType;
        fenceGate.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
        fenceGate.setUnlocalizedName(name);
        ExtraTrees.proxy.registerBlock(fenceGate, new ItemBlockETWood<>(fenceGate));
        registerOreDictWildcard(OreDictUtil.FENCE_GATE_WOOD, fenceGate);
        fenceGates.add(fenceGate);
        FMLInterModComms.sendMessage("forestry", "add-fence-block", fenceGate.getRegistryName().toString());
        BlockForestryFenceGate<EnumETLog> fenceGateFireproof = new BlockForestryFenceGate<>(true, woodType);
        String nameFireproof = "fence.gates.fireproof." + woodType;
        fenceGateFireproof.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, nameFireproof));
        fenceGateFireproof.setUnlocalizedName(nameFireproof);
        ExtraTrees.proxy.registerBlock(fenceGateFireproof, new ItemBlockETWood<>(fenceGateFireproof));
        registerOreDictWildcard(OreDictUtil.FENCE_GATE_WOOD, fenceGateFireproof);
        fenceGatesFireproof.add(fenceGateFireproof);
        FMLInterModComms.sendMessage("forestry", "add-fence-block", fenceGateFireproof.getRegistryName().toString());
    }
    // Forestry's API doesn't allow typed lists to be registered, but making a new one allows us to get away with it
    woodAccess.registerFenceGates(new ArrayList<>(fenceGates));
    woodAccess.registerFenceGates(new ArrayList<>(fenceGatesFireproof));
    doors = new ArrayList<>();
    for (EnumETLog woodType : EnumETLog.VALUES) {
        if (woodType.hasProducts()) {
            BlockETDoor door = new BlockETDoor(woodType);
            ExtraTrees.proxy.registerBlock(door, new ItemBlockETWoodDoor(door));
            registerOreDictWildcard(OreDictUtil.DOOR_WOOD, door);
            doors.add(door);
        }
    }
    registerDoors(woodAccess, doors);
    blockMultiFence = new BlockMultiFence();
    ExtraTrees.proxy.registerBlock(blockMultiFence, new ItemMetadata(blockMultiFence));
    leavesDefault = BlockETDefaultLeaves.create();
    Map speciesToLeavesDefault = ModuleArboriculture.getBlocks().speciesToLeavesDefault;
    for (BlockETDefaultLeaves leaves : leavesDefault) {
        ExtraTrees.proxy.registerBlock(leaves, new ItemBlockLeaves(leaves));
        registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
        PropertyETType treeType = leaves.getVariant();
        for (ETTreeDefinition treeDefinition : treeType.getAllowedValues()) {
            Preconditions.checkNotNull(treeDefinition);
            String speciesUid = treeDefinition.getUID();
            IBlockState blockState = leaves.getDefaultState().withProperty(treeType, treeDefinition);
            speciesToLeavesDefault.put(speciesUid, blockState);
        }
    }
    leavesDecorative = BlockETDecorativeLeaves.create();
    speciesToLeavesDecorative = new HashMap<>();
    for (BlockETDecorativeLeaves leaves : leavesDecorative) {
        ExtraTrees.proxy.registerBlock(leaves, new ItemBlockETDecorativeLeaves(leaves));
        registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
        for (IBlockState state : leaves.getBlockState().getValidStates()) {
            ETTreeDefinition treeDefinition = state.getValue(leaves.getVariant());
            String speciesUid = treeDefinition.getUID();
            int meta = leaves.getMetaFromState(state);
            speciesToLeavesDecorative.put(speciesUid, new ItemStack(leaves, 1, meta));
        }
    }
    shrubLog = new BlockShrubLog();
    ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood<>(shrubLog));
    woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
    woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, true, shrubLog.getStateFromMeta(1), new ItemStack(shrubLog, 1, 1));
}
Also used : ExtraTreePlanks(binnie.extratrees.wood.planks.ExtraTreePlanks) BlockETDoor(binnie.extratrees.blocks.wood.BlockETDoor) BlockETSlab(binnie.extratrees.blocks.wood.BlockETSlab) BlockForestryStairs(forestry.arboriculture.blocks.BlockForestryStairs) BlockETDecorativeLeaves(binnie.extratrees.blocks.BlockETDecorativeLeaves) ItemBlockETDecorativeLeaves(binnie.extratrees.items.ItemBlockETDecorativeLeaves) BlockETLog(binnie.extratrees.blocks.wood.BlockETLog) BlockETDefaultLeaves(binnie.extratrees.blocks.BlockETDefaultLeaves) BlockETPlank(binnie.extratrees.blocks.wood.BlockETPlank) ItemBlockETWoodDoor(binnie.extratrees.blocks.wood.ItemBlockETWoodDoor) BlockETFence(binnie.extratrees.blocks.wood.BlockETFence) ItemBlockLeaves(forestry.arboriculture.items.ItemBlockLeaves) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) BlockForestryFenceGate(forestry.arboriculture.blocks.BlockForestryFenceGate) IBlockState(net.minecraft.block.state.IBlockState) ItemBlockETDecorativeLeaves(binnie.extratrees.items.ItemBlockETDecorativeLeaves) BlockMultiFence(binnie.extratrees.blocks.decor.BlockMultiFence) ItemETSlab(binnie.extratrees.blocks.wood.ItemETSlab) WoodAccess(forestry.arboriculture.WoodAccess) IWoodAccess(forestry.api.arboriculture.IWoodAccess) PropertyETType(binnie.extratrees.blocks.property.PropertyETType) ItemMetadata(binnie.core.block.ItemMetadata) BlockShrubLog(binnie.extratrees.blocks.wood.BlockShrubLog) EnumETLog(binnie.extratrees.wood.EnumETLog) ETTreeDefinition(binnie.extratrees.genetics.ETTreeDefinition) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map) HashMap(java.util.HashMap) TextureMap(net.minecraft.client.renderer.texture.TextureMap)

Example 2 with ExtraTreePlanks

use of binnie.extratrees.wood.planks.ExtraTreePlanks in project Binnie by ForestryMC.

the class ModuleWood method doInit.

@Override
public void doInit() {
    AlleleETFruitDefinition.init();
    ETTreeDefinition.initTrees();
    ExtraTreeMutation.init();
    if (BinnieCore.isLepidopteryActive()) {
        ButterflySpecies.initButterflies();
    }
    RecipeUtil recipeUtil = new RecipeUtil(Constants.EXTRA_TREES_MOD_ID);
    for (BlockETLog log : logs) {
        ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE);
        ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1);
        GameRegistry.addSmelting(logInput, coalOutput, 0.15F);
    }
    IWoodAccess woodAccess = TreeManager.woodAccess;
    for (EnumETLog log : EnumETLog.VALUES) {
        ItemStack logs = woodAccess.getStack(log, WoodBlockKind.LOG, false);
        ItemStack planks = log.getPlank().getStack(false);
        ItemStack fireproofLogs = woodAccess.getStack(log, WoodBlockKind.LOG, true);
        ItemStack fireproofPlanks = log.getPlank().getStack(true);
        planks.setCount(4);
        recipeUtil.addShapelessRecipe(log.getUid() + "_planks", planks.copy(), logs.copy());
        fireproofPlanks.setCount(4);
        recipeUtil.addShapelessRecipe(log.getUid() + "_fireproof_planks", fireproofPlanks.copy(), fireproofLogs);
        if (ModuleUtils.isModuleActive(ForestryModuleUids.FACTORY, ForestryModuleUids.APICULTURE)) {
            logs.setCount(1);
            fireproofLogs.setCount(1);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofLogs.copy(), new Object[] { " # ", "#X#", " # ", '#', Mods.Forestry.item("refractory_wax"), 'X', logs.copy() });
        }
    }
    for (ExtraTreePlanks plankType : ExtraTreePlanks.VALUES) {
        for (boolean fireproof : new boolean[] { false, true }) {
            ItemStack planks = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.PLANKS, fireproof);
            ItemStack slabs = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.SLAB, fireproof);
            ItemStack fences = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.FENCE, fireproof);
            ItemStack fenceGates = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.FENCE_GATE, fireproof);
            ItemStack stairs = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.STAIRS, fireproof);
            String plankUid = plankType.getWoodType().getUid();
            if (fireproof) {
                plankUid += "_fireproof";
            }
            stairs.setCount(4);
            recipeUtil.addRecipe(plankUid + "_stairs", stairs.copy(), "#  ", "## ", "###", '#', planks.copy());
            slabs.setCount(6);
            recipeUtil.addRecipe(plankUid + "_slabs", slabs.copy(), "###", '#', planks.copy());
            fences.setCount(3);
            planks.setCount(1);
            recipeUtil.addRecipe(plankUid + "_fences", fences.copy(), "#X#", "#X#", '#', planks.copy(), 'X', "stickWood");
            fenceGates.setCount(1);
            planks.setCount(1);
            recipeUtil.addRecipe(plankUid + "_fence_gates", fenceGates.copy(), "X#X", "X#X", '#', planks.copy(), 'X', "stickWood");
            if (!fireproof) {
                ItemStack doors = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.DOOR, false);
                doors.setCount(3);
                planks.setCount(1);
                recipeUtil.addRecipe(plankUid + "_doors", doors.copy(), "## ", "## ", "## ", '#', planks.copy());
            }
        }
        // Fabricator recipes
        if (ModuleUtils.isModuleActive(ForestryModuleUids.FACTORY, ForestryModuleUids.APICULTURE)) {
            ItemStack planks = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.PLANKS, false);
            ItemStack fireproofPlanks = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.PLANKS, true);
            planks.setCount(1);
            fireproofPlanks.setCount(5);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofPlanks.copy(), new Object[] { "X#X", "#X#", "X#X", '#', Mods.Forestry.item("refractory_wax"), 'X', planks.copy() });
        }
    }
    ForgeRegistries.RECIPES.register(new MultiFenceRecipeSize());
    ForgeRegistries.RECIPES.register(new MultiFenceRecipeEmbedded());
    ForgeRegistries.RECIPES.register(new MultiFenceRecipeSolid());
    this.addSqueezer(EnumVanillaWoodType.SPRUCE, ExtraTreeLiquid.Resin, 50);
}
Also used : ExtraTreePlanks(binnie.extratrees.wood.planks.ExtraTreePlanks) EnumETLog(binnie.extratrees.wood.EnumETLog) MultiFenceRecipeEmbedded(binnie.extratrees.blocks.decor.MultiFenceRecipeEmbedded) BlockETLog(binnie.extratrees.blocks.wood.BlockETLog) MultiFenceRecipeSize(binnie.extratrees.blocks.decor.MultiFenceRecipeSize) ItemStack(net.minecraft.item.ItemStack) IWoodAccess(forestry.api.arboriculture.IWoodAccess) MultiFenceRecipeSolid(binnie.extratrees.blocks.decor.MultiFenceRecipeSolid) RecipeUtil(binnie.core.util.RecipeUtil)

Aggregations

BlockETLog (binnie.extratrees.blocks.wood.BlockETLog)2 EnumETLog (binnie.extratrees.wood.EnumETLog)2 ExtraTreePlanks (binnie.extratrees.wood.planks.ExtraTreePlanks)2 IWoodAccess (forestry.api.arboriculture.IWoodAccess)2 ItemStack (net.minecraft.item.ItemStack)2 ItemMetadata (binnie.core.block.ItemMetadata)1 RecipeUtil (binnie.core.util.RecipeUtil)1 BlockETDecorativeLeaves (binnie.extratrees.blocks.BlockETDecorativeLeaves)1 BlockETDefaultLeaves (binnie.extratrees.blocks.BlockETDefaultLeaves)1 BlockMultiFence (binnie.extratrees.blocks.decor.BlockMultiFence)1 MultiFenceRecipeEmbedded (binnie.extratrees.blocks.decor.MultiFenceRecipeEmbedded)1 MultiFenceRecipeSize (binnie.extratrees.blocks.decor.MultiFenceRecipeSize)1 MultiFenceRecipeSolid (binnie.extratrees.blocks.decor.MultiFenceRecipeSolid)1 PropertyETType (binnie.extratrees.blocks.property.PropertyETType)1 BlockETDoor (binnie.extratrees.blocks.wood.BlockETDoor)1 BlockETFence (binnie.extratrees.blocks.wood.BlockETFence)1 BlockETPlank (binnie.extratrees.blocks.wood.BlockETPlank)1 BlockETSlab (binnie.extratrees.blocks.wood.BlockETSlab)1 BlockShrubLog (binnie.extratrees.blocks.wood.BlockShrubLog)1 ItemBlockETWoodDoor (binnie.extratrees.blocks.wood.ItemBlockETWoodDoor)1