Search in sources :

Example 1 with PulleyStructureManager

use of betterwithmods.common.registry.PulleyStructureManager in project BetterWithAddons by DaedalusGame.

the class InteractionBWA method init.

@Override
public void init() {
    if (PatientiaHandler.shouldRegister())
        MinecraftForge.EVENT_BUS.register(new PatientiaHandler());
    // ModItems.bowls.setContainer(new ItemStack(Items.BOWL));
    ModBlocks.luretreeSapling.setLeaves(ModBlocks.luretreeLeaves.getDefaultState()).setLog(ModBlocks.luretreeLog.getDefaultState()).setBig(true);
    ModBlocks.luretreeLeaves.setSapling(new ItemStack(ModBlocks.luretreeSapling));
    // OreDictionary.registerOre("foodSalt", ModItems.bowls.getMaterial("salt"));
    ItemStack greatarrowhead = ModItems.material.getMaterial("arrowhead");
    ItemStack haft = ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.HAFT);
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "greatbow"), new ItemStack(ModItems.greatbow), "si ", "s i", "s i", "si ", 'i', haft, 's', new ItemStack(BWMBlocks.ROPE));
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "greatarrow_head"), greatarrowhead, " n ", "nnn", "nnn", "n n", 'n', "nuggetSoulforgedSteel");
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "greatarrow_lightning"), new ItemStack(ModItems.greatarrowLightning), "nxn", "nxn", " i ", " f ", 'n', ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.REDSTONE_LATCH), 'x', greatarrowhead, 'i', haft, 'f', new ItemStack(Items.FEATHER));
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "greatarrow_destruction"), new ItemStack(ModItems.greatarrowDestruction), "n n", "nxn", " i ", " f ", 'n', "nuggetSoulforgedSteel", 'x', greatarrowhead, 'i', haft, 'f', new ItemStack(Items.FEATHER));
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_spade"), new ItemStack(ModItems.steelSpade), "x", "x", "i", "i", 'x', "ingotSoulforgedSteel", 'i', haft);
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_matchpick"), new ItemStack(ModItems.steelMatchPick), "xxx", "nic", " i ", " i ", 'x', "ingotSoulforgedSteel", 'i', haft, 'n', ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.NETHERCOAL), 'c', "ingotConcentratedHellfire");
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_machete"), new ItemStack(ModItems.steelMachete), "   x", "  x ", " x  ", "i   ", 'x', "ingotSoulforgedSteel", 'i', haft);
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_kukri"), new ItemStack(ModItems.steelKukri), "xx", "x ", "xx", " i", 'x', "ingotSoulforgedSteel", 'i', haft);
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_carpentersaw"), new ItemStack(ModItems.steelCarpenterSaw), "xxxi", "x x ", 'x', "ingotSoulforgedSteel", 'i', haft);
    AnvilRecipes.addSteelShapedRecipe(new ResourceLocation(Reference.MOD_ID, "steel_masonpick"), new ItemStack(ModItems.steelMasonPick), "xxxx", " i  ", " i  ", " i  ", 'x', "ingotSoulforgedSteel", 'i', haft);
    int axeAmt = HCTools.changeAxeRecipe ? 2 : 3;
    if (ModuleLoader.isFeatureEnabled(MetalReclaming.class) && MetalReclaming.reclaimCount > 0) {
        int reclaimCount = MetalReclaming.reclaimCount;
        ItemStack ingotIron = new ItemStack(Items.IRON_INGOT);
        ItemStack nuggetIron = new ItemStack(Items.IRON_NUGGET);
        ItemStack ingotGold = new ItemStack(Items.GOLD_INGOT);
        ItemStack nuggetGold = new ItemStack(Items.GOLD_NUGGET);
        ItemStack ingotSteel = ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.INGOT_STEEL);
        ItemStack nuggetSteel = ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.NUGGET_STEEL);
        addReclaimRecipe(new ItemStack(ModItems.ironSpade), ingotIron, nuggetIron, reclaimCount * 2);
        addReclaimRecipe(new ItemStack(ModItems.ironMatchPick), ingotIron, nuggetIron, reclaimCount * 3);
        addReclaimRecipe(new ItemStack(ModItems.ironMachete), ingotIron, nuggetIron, reclaimCount * 4);
        addReclaimRecipe(new ItemStack(ModItems.ironKukri), ingotIron, nuggetIron, reclaimCount * (axeAmt + 2));
        addReclaimRecipe(new ItemStack(ModItems.ironCarpenterSaw), ingotIron, nuggetIron, reclaimCount * (axeAmt + 2));
        addReclaimRecipe(new ItemStack(ModItems.ironMasonPick), ingotIron, nuggetIron, reclaimCount * 4);
        addReclaimRecipe(new ItemStack(ModItems.goldSpade), ingotGold, nuggetGold, reclaimCount * 2);
        addReclaimRecipe(new ItemStack(ModItems.goldMatchPick), ingotGold, nuggetGold, reclaimCount * 3);
        addReclaimRecipe(new ItemStack(ModItems.goldMachete), ingotGold, nuggetGold, reclaimCount * 4);
        addReclaimRecipe(new ItemStack(ModItems.goldKukri), ingotGold, nuggetGold, reclaimCount * (axeAmt + 2));
        addReclaimRecipe(new ItemStack(ModItems.goldCarpenterSaw), ingotGold, nuggetGold, reclaimCount * (axeAmt + 2));
        addReclaimRecipe(new ItemStack(ModItems.goldMasonPick), ingotGold, nuggetGold, reclaimCount * 4);
        addReclaimRecipe(new ItemStack(ModItems.steelSpade), ingotSteel, nuggetSteel, 9 * 2);
        addReclaimRecipe(new ItemStack(ModItems.steelMatchPick), ingotSteel, nuggetSteel, 9 * 3);
        addReclaimRecipe(new ItemStack(ModItems.steelMachete), ingotSteel, nuggetSteel, 9 * 3);
        addReclaimRecipe(new ItemStack(ModItems.steelKukri), ingotSteel, nuggetSteel, 9 * 5);
        addReclaimRecipe(new ItemStack(ModItems.steelCarpenterSaw), ingotSteel, nuggetSteel, 9 * 5);
        addReclaimRecipe(new ItemStack(ModItems.steelMasonPick), ingotSteel, nuggetSteel, 9 * 4);
        if (ModuleLoader.isFeatureEnabled(HCDiamond.class)) {
            ItemStack ingotDiamond = ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.DIAMOND_INGOT);
            ItemStack nuggetDiamond = ItemMaterial.getMaterial(ItemMaterial.EnumMaterial.DIAMOND_NUGGET);
            addReclaimRecipe(new ItemStack(ModItems.diamondSpade), ingotDiamond, nuggetDiamond, 9 * 2);
            addReclaimRecipe(new ItemStack(ModItems.diamondMatchPick), ingotDiamond, nuggetDiamond, 9 * 3);
            addReclaimRecipe(new ItemStack(ModItems.diamondMachete), ingotDiamond, nuggetDiamond, 9 * 4);
            addReclaimRecipe(new ItemStack(ModItems.diamondKukri), ingotDiamond, nuggetDiamond, 9 * (axeAmt + 2));
            addReclaimRecipe(new ItemStack(ModItems.diamondCarpenterSaw), ingotDiamond, nuggetDiamond, 9 * (axeAmt + 2));
            addReclaimRecipe(new ItemStack(ModItems.diamondMasonPick), ingotDiamond, nuggetDiamond, 9 * 4);
        }
    }
    TileEntityLureTree.addTreeFood(new ItemStack(Items.GLOWSTONE_DUST), 450);
    // TODO: Make this more sensible holy shit
    TileEntityAqueductWater.reloadBiomeList();
    ISpecialMeasuringBehavior platformBehavior = new ISpecialMeasuringBehavior() {

        @Override
        public boolean isFull(World world, BlockPos pos, IBlockState state) {
            HashSet<BlockPos> platformBlocks = new HashSet<>();
            boolean success = PulleyUtil.findPlatformPart(world, pos, platformBlocks);
            if (success) {
                return measurePlatform(world, platformBlocks) >= countPlatforms(world, platformBlocks);
            }
            return false;
        }

        @Override
        public boolean isEmpty(World world, BlockPos pos, IBlockState state) {
            HashSet<BlockPos> platformBlocks = new HashSet<>();
            boolean success = PulleyUtil.findPlatformPart(world, pos, platformBlocks);
            if (success) {
                return measurePlatform(world, platformBlocks) == 0 && countPlatforms(world, platformBlocks) > 0;
            }
            return true;
        }

        @Override
        public int getDelay(World world, BlockPos pos, IBlockState state) {
            return 4;
        }
    };
    BlockWeight.addSpecialMeasuringBehavior(Blocks.CAULDRON, new ISpecialMeasuringBehavior() {

        @Override
        public boolean isFull(World world, BlockPos pos, IBlockState state) {
            return state.getValue(BlockCauldron.LEVEL) == 3;
        }

        @Override
        public boolean isEmpty(World world, BlockPos pos, IBlockState state) {
            return state.getValue(BlockCauldron.LEVEL) == 0;
        }

        @Override
        public int getDelay(World world, BlockPos pos, IBlockState state) {
            return 1;
        }
    });
    BlockWeight.addSpecialMeasuringBehavior(BWMBlocks.ANCHOR, new ISpecialMeasuringBehavior() {

        @Override
        public boolean isFull(World world, BlockPos pos, IBlockState state) {
            return false;
        }

        @Override
        public boolean isEmpty(World world, BlockPos pos, IBlockState state) {
            return state.getValue(DirUtils.FACING) != EnumFacing.UP;
        }

        @Override
        public int getDelay(World world, BlockPos pos, IBlockState state) {
            return 1;
        }
    });
    BlockWeight.addSpecialMeasuringBehavior(BWMBlocks.PLATFORM, platformBehavior);
    BlockWeight.addSpecialMeasuringBehavior(BWMBlocks.IRON_WALL, platformBehavior);
    // meme? idk
    ModBlocks.redstoneEmitter.getBlockState().getValidStates().forEach(PulleyStructureManager::registerPulleyBlock);
    GameRegistry.addSmelting(Items.CARROT, new ItemStack(ModItems.bakedCarrot), 0.35f);
    GameRegistry.addSmelting(Items.BEETROOT, new ItemStack(ModItems.bakedBeetroot), 0.35f);
    GameRegistry.addSmelting(Blocks.BROWN_MUSHROOM, new ItemStack(ModItems.bakedMushroom), 0.35f);
    GameRegistry.addSmelting(Blocks.RED_MUSHROOM, new ItemStack(ModItems.bakedAmanita), 0.35f);
    boolean hchunger = ModuleLoader.isFeatureEnabled(HCHunger.class);
    KilnManager.INSTANCE.addRecipe(ModBlocks.unbaked, BlockModUnbaked.EnumType.MELON.getMetadata(), new ItemStack(ModItems.pieMelon, hchunger ? 1 : 2));
    KilnManager.INSTANCE.addRecipe(ModBlocks.unbaked, BlockModUnbaked.EnumType.MEAT.getMetadata(), new ItemStack(ModItems.pieMeat, hchunger ? 1 : 2));
    KilnManager.INSTANCE.addRecipe(ModBlocks.unbaked, BlockModUnbaked.EnumType.MUSHROOM.getMetadata(), new ItemStack(ModItems.pieMushroom, hchunger ? 1 : 2));
    KilnManager.INSTANCE.addRecipe(ModBlocks.unbaked, BlockModUnbaked.EnumType.AMANITA.getMetadata(), new ItemStack(ModItems.pieAmanita, hchunger ? 1 : 2));
    if (STONEBRICKS_NEED_SMELTING) {
        GameRegistry.addSmelting(Blocks.STONE, ModItems.material.getMaterial("stone_brick", 4), 0.1f);
    }
    CauldronManager.getInstance().addRecipe(new ItemStack(BWMItems.FERTILIZER), ItemStack.EMPTY, new Object[] { new ItemStack(ModItems.rottenFood) });
    BlockRopeSideways.addFastenableBlock(ModBlocks.scaffold);
    BlockRopeSideways.addFastenableBlock(ModBlocks.ropePost);
    CauldronManager.getInstance().addRecipe(new AdobeRecipe());
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) World(net.minecraft.world.World) ISpecialMeasuringBehavior(betterwithaddons.util.ISpecialMeasuringBehavior) PulleyStructureManager(betterwithmods.common.registry.PulleyStructureManager) ResourceLocation(net.minecraft.util.ResourceLocation) MetalReclaming(betterwithmods.module.gameplay.MetalReclaming) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) AdobeRecipe(betterwithaddons.crafting.recipes.AdobeRecipe) HashSet(java.util.HashSet)

Aggregations

AdobeRecipe (betterwithaddons.crafting.recipes.AdobeRecipe)1 ISpecialMeasuringBehavior (betterwithaddons.util.ISpecialMeasuringBehavior)1 PulleyStructureManager (betterwithmods.common.registry.PulleyStructureManager)1 MetalReclaming (betterwithmods.module.gameplay.MetalReclaming)1 HashSet (java.util.HashSet)1 IBlockState (net.minecraft.block.state.IBlockState)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1