Search in sources :

Example 1 with MultiItemRandom

use of gregapi.item.multiitem.MultiItemRandom in project gregtech6 by GregTech6.

the class MultiTileEntitySandwich method onEaten.

@Override
public ItemStack onEaten(MultiTileEntityItemInternal aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
    if (MD.APC.mLoaded) {
        aPlayer.getFoodStats().func_151686_a((ItemFood) UT.Reflection.callConstructor("squeek.applecore.api.food.ItemFoodProxy", 0, null, T, aStack.getItem()), aStack);
    } else {
        aPlayer.getFoodStats().addStats(getTotalFood(), getTotalSaturation());
    }
    if (!aWorld.isRemote && MD.ENVM.mLoaded) {
        try {
            Object tTracker = EM_StatusManager.lookupTracker(aPlayer);
            if (tTracker != null && ((EnviroDataTracker) tTracker).bodyTemp >= 0) {
                float tHydration = getTotalHydration();
                if (tHydration > 0)
                    ((EnviroDataTracker) tTracker).hydrate(tHydration);
                else if (tHydration < 0)
                    ((EnviroDataTracker) tTracker).dehydrate(-tHydration);
            }
        } catch (Throwable e) {
            e.printStackTrace(ERR);
        }
    }
    boolean temp = T;
    for (ItemStack tStack : mStacks) if (ST.valid(tStack) && ST.item_(tStack) instanceof MultiItemRandom) {
        IFoodStat tStat = ((MultiItemRandom) ST.item_(tStack)).mFoodStats.get(ST.meta_(tStack));
        if (tStat != null) {
            tStat.onEaten(aItem, tStack, aPlayer, F, temp);
            temp = F;
        }
    }
    ST.use(aPlayer, aStack, 1);
    return aStack;
}
Also used : EnviroDataTracker(enviromine.trackers.EnviroDataTracker) MultiItemRandom(gregapi.item.multiitem.MultiItemRandom) IFoodStat(gregapi.item.multiitem.food.IFoodStat) ItemStack(net.minecraft.item.ItemStack)

Example 2 with MultiItemRandom

use of gregapi.item.multiitem.MultiItemRandom in project gregtech6 by GregTech6.

the class GT_API_Proxy method getBurnTime.

@Override
public int getBurnTime(ItemStack aFuel) {
    if (ST.invalid(aFuel) || FL.getFluid(aFuel, T) != null)
        return 0;
    Block aBlock = ST.block(aFuel);
    // Needed so Railcrafts Tunnel Bore works properly and doesn't try to burn its Rails while laying them.
    if (aBlock instanceof BlockRailBase)
        return 0;
    if (aBlock instanceof BlockHugeMushroom)
        return (3 * TICKS_PER_SMELT) / 2;
    if (aBlock == BlocksGT.BalesGrass)
        return (9 * TICKS_PER_SMELT) / ((ST.meta_(aFuel) & 3) == 1 ? 2 : 4);
    if (aBlock instanceof BlockBaseBale)
        return (9 * TICKS_PER_SMELT) / 4;
    if (aBlock instanceof BlockBasePlanks)
        return (3 * TICKS_PER_SMELT) / 2;
    if (aBlock instanceof BlockBaseSapling)
        return TICKS_PER_SMELT / 2;
    if (aBlock instanceof BlockBaseBeam || aBlock instanceof BlockBaseLog)
        return TICKS_PER_SMELT * 6;
    long rFuelValue = 0;
    if (aFuel.getItem() instanceof MultiItemRandom) {
        Short tFuelValue = ((MultiItemRandom) aFuel.getItem()).mBurnValues.get(ST.meta_(aFuel));
        if (tFuelValue != null)
            rFuelValue = Math.max(rFuelValue, tFuelValue);
    } else {
        if (OD.logWood.is_(aFuel))
            return TICKS_PER_SMELT * 6;
        if (OD.itemResin.is_(aFuel))
            return TICKS_PER_SMELT / 2;
    }
    NBTTagCompound tNBT = aFuel.getTagCompound();
    if (tNBT != null) {
        rFuelValue = Math.max(rFuelValue, tNBT.getLong(NBT_FUEL_VALUE));
    }
    OreDictItemData tData = OM.anydata_(aFuel);
    if (tData != null) {
        long tBurnTime = 0;
        if (tData.mPrefix == OP.oreRaw) {
            tBurnTime = tData.mMaterial.mMaterial.mFurnaceBurnTime;
        } else if (tData.mPrefix == OP.blockRaw) {
            tBurnTime = tData.mMaterial.mMaterial.mFurnaceBurnTime * 10;
        } else if (tData.mPrefix == null || tData.mPrefix.contains(TD.Prefix.BURNABLE)) {
            for (OreDictMaterialStack tMaterial : tData.getAllMaterialStacks()) tBurnTime += (tData.mPrefix == OP.oreRaw ? tMaterial.mMaterial.mFurnaceBurnTime : tData.mPrefix == OP.blockRaw ? tMaterial.mMaterial.mFurnaceBurnTime * 10 : UT.Code.units(tMaterial.mMaterial.mFurnaceBurnTime, U, tMaterial.mAmount, F));
            if (tData.mPrefix == OP.stick && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
                return (int) UT.Code.bind(0, 32000, Math.max(TICKS_PER_SMELT / 2, tBurnTime));
            if (tData.mPrefix == OP.stickLong && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
                return (int) UT.Code.bind(0, 32000, Math.max(TICKS_PER_SMELT, tBurnTime));
            if (tData.mPrefix == OP.blockPlate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
                return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 27) / 2, tBurnTime));
            if (tData.mPrefix == OP.crateGtPlate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
                return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 51) / 2, tBurnTime));
            if (tData.mPrefix == OP.crateGt64Plate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
                return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 195) / 2, tBurnTime));
        }
        rFuelValue = Math.max(rFuelValue, tBurnTime);
    }
    // return at most 160 Smelts, without any fraction smelts.
    return (int) UT.Code.bind(0, 32000, rFuelValue);
}
Also used : OreDictItemData(gregapi.oredict.OreDictItemData) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) OreDictMaterialStack(gregapi.oredict.OreDictMaterialStack) BlockBaseBale(gregapi.block.misc.BlockBaseBale) BlockRailBase(net.minecraft.block.BlockRailBase) BlockBaseSapling(gregapi.block.tree.BlockBaseSapling) BlockBasePlanks(gregapi.block.metatype.BlockBasePlanks) BlockBaseBeam(gregapi.block.tree.BlockBaseBeam) MultiItemRandom(gregapi.item.multiitem.MultiItemRandom) Block(net.minecraft.block.Block) BlockHugeMushroom(net.minecraft.block.BlockHugeMushroom) BlockBaseLog(gregapi.block.tree.BlockBaseLog) IItemNoGTOverride(gregapi.item.IItemNoGTOverride)

Example 3 with MultiItemRandom

use of gregapi.item.multiitem.MultiItemRandom in project gregtech6 by GregTech6.

the class GT6_Main method onModPostInit2.

@Override
public void onModPostInit2(FMLPostInitializationEvent aEvent) {
    ItemStack tLignite = ST.make(MD.UB, "ligniteCoal", 1, 0);
    if (ST.valid(tLignite))
        CR.remove(tLignite, tLignite, tLignite, tLignite, tLignite, tLignite, tLignite, tLignite, tLignite);
    Block tBlock = ST.block(MD.FR, "beehives", NB);
    if (tBlock != NB) {
        tBlock.setHarvestLevel("scoop", 0);
        GT_Tool_Scoop.sBeeHiveMaterial = tBlock.getMaterial();
    }
    for (IItemContainer tBee : new IItemContainer[] { IL.FR_Bee_Drone, IL.FR_Bee_Princess, IL.FR_Bee_Queen }) if (tBee.exists()) {
        for (String tFluid : FluidsGT.HONEY) if (FL.exists(tFluid))
            RM.Bumblelyzer.addFakeRecipe(F, ST.array(tBee.wild(1)), ST.array(tBee.getWithName(1, "Scanned Bee")), null, null, FL.array(FL.make(tFluid, 50)), null, 64, 16, 0);
        RM.Bumblelyzer.addFakeRecipe(F, ST.array(tBee.wild(1)), ST.array(tBee.getWithName(1, "Scanned Bee")), null, null, FL.array(FL.Honeydew.make(50)), null, 64, 16, 0);
    }
    for (IItemContainer tPlant : new IItemContainer[] { IL.FR_Tree_Sapling, IL.IC2_Crop_Seeds }) if (tPlant.exists()) {
        RM.Plantalyzer.addFakeRecipe(F, ST.array(tPlant.wild(1)), ST.array(tPlant.getWithName(1, "Scanned Plant")), null, null, null, null, 64, 16, 0);
    }
    for (ItemStack tStack : OreDictManager.getOres("bookWritten", F)) RM.ScannerVisuals.addFakeRecipe(F, ST.array(tStack, IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Book"), tStack), null, null, ZL_FS, ZL_FS, 512, 16, 0);
    RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.Paper_Printed_Pages.get(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Book"), IL.Paper_Printed_Pages.get(1)), null, null, ZL_FS, ZL_FS, 512, 16, 0);
    RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.Paper_Printed_Pages_Many.get(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing large scanned Book"), IL.Paper_Printed_Pages_Many.get(1)), null, null, ZL_FS, ZL_FS, 512, 16, 0);
    for (ItemStack tStack : OreDictManager.getOres("gt:canvas", F)) RM.ScannerVisuals.addFakeRecipe(F, ST.array(tStack, IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Block"), tStack), null, null, ZL_FS, ZL_FS, 64, 16, 0);
    RM.ScannerVisuals.addFakeRecipe(F, ST.array(ST.make(Blocks.crafting_table, 1, 0, "ANY BLOCK"), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Block"), ST.make(Blocks.crafting_table, 1, 0, "ANY BLOCK")), null, null, ZL_FS, ZL_FS, 512, 16, 0);
    RM.ScannerVisuals.addFakeRecipe(F, ST.array(ST.make(Items.filled_map, 1, W), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Map"), ST.make(Items.filled_map, 1, W)), null, null, ZL_FS, ZL_FS, 64, 16, 0);
    RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.Paper_Blueprint_Used.get(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Blueprint"), IL.Paper_Blueprint_Used.get(1)), null, null, ZL_FS, ZL_FS, 64, 16, 0);
    if (IL.GC_Schematic_1.exists())
        RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.GC_Schematic_1.wild(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Schematics"), IL.GC_Schematic_1.wild(1)), null, null, ZL_FS, ZL_FS, 1024, 16, 0);
    if (IL.GC_Schematic_2.exists())
        RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.GC_Schematic_2.wild(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Schematics"), IL.GC_Schematic_2.wild(1)), null, null, ZL_FS, ZL_FS, 1024, 16, 0);
    if (IL.GC_Schematic_3.exists())
        RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.GC_Schematic_3.wild(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Schematics"), IL.GC_Schematic_3.wild(1)), null, null, ZL_FS, ZL_FS, 1024, 16, 0);
    if (IL.IE_Blueprint_Projectiles_Common.exists())
        RM.ScannerVisuals.addFakeRecipe(F, ST.array(IL.IE_Blueprint_Projectiles_Common.wild(1), IL.USB_Stick_1.get(1)), ST.array(IL.USB_Stick_1.getWithName(1, "Containing scanned Engineer's Blueprint"), IL.IE_Blueprint_Projectiles_Common.wild(1)), null, null, ZL_FS, ZL_FS, 1024, 16, 0);
    RM.Printer.addRecipe1(T, 16, 256, ST.make(Items.book, 1, W), DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], NF, ST.book("Manual_Printer", ST.make(Items.written_book, 1, 0)));
    for (ItemStack tStack : OreDictManager.getOres("gt:canvas", F)) RM.Printer.addFakeRecipe(F, ST.array(tStack, IL.USB_Stick_1.getWithName(0, "Containing scanned Block")), ST.array(tStack), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Yellow], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Magenta], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Cyan], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 1, 9, T)), ZL_FS, 64, 16, 0);
    // RM.Printer.addFakeRecipe(F, ST.array(IL.Paper_Punch_Card_Empty.get(1)   , IL.USB_Stick_1.getWithName(0, "Containing scanned Punchcard"           )), ST.array(IL.Paper_Punch_Card_Encoded.get(1)        ), null, null, FL.array(                                                                                                                                                                       FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 1, 9, T)), ZL_FS,   32, 16, 0);
    RM.Printer.addFakeRecipe(F, ST.array(IL.Paper_Blueprint_Empty.get(1), IL.USB_Stick_1.getWithName(0, "Containing scanned Blueprint")), ST.array(IL.Paper_Blueprint_Used.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_White], 1, 9, T)), ZL_FS, 32, 16, 0);
    RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 1, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Blueprint")), ST.array(IL.Paper_Blueprint_Used.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Blue], 1, 1, T)), ZL_FS, 128, 16, 0);
    RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 3, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Book")), ST.array(IL.Paper_Printed_Pages.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 1, 2, T)), ZL_FS, 512, 16, 0);
    RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 6, W), IL.USB_Stick_1.getWithName(0, "Containing large scanned Book")), ST.array(IL.Paper_Printed_Pages_Many.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 1, 1, T)), ZL_FS, 1024, 16, 0);
    RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.map, 1, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Map")), ST.array(ST.make(Items.filled_map, 1, 0)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Yellow], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Magenta], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Cyan], 1, 9, T), FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 1, 9, T)), ZL_FS, 64, 16, 0);
    if (IL.GC_Schematic_1.exists())
        RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 8, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Schematics")), ST.array(IL.GC_Schematic_1.wild(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 4, 1, T)), ZL_FS, 2048, 16, 0);
    if (IL.GC_Schematic_2.exists())
        RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 8, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Schematics")), ST.array(IL.GC_Schematic_2.wild(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 4, 1, T)), ZL_FS, 2048, 16, 0);
    if (IL.GC_Schematic_3.exists())
        RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 8, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Schematics")), ST.array(IL.GC_Schematic_3.wild(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Black], 4, 1, T)), ZL_FS, 2048, 16, 0);
    if (IL.IE_Blueprint_Projectiles_Common.exists())
        RM.Printer.addFakeRecipe(F, ST.array(ST.make(Items.paper, 3, W), IL.USB_Stick_1.getWithName(0, "Containing scanned Engineer's Blueprint")), ST.array(IL.IE_Blueprint_Projectiles_Common.wild(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_CHEMICAL[DYE_INDEX_Blue], 3, 1, T)), ZL_FS, 2048, 16, 0);
    if (IL.IE_Treated_Stairs.exists())
        RM.Bath.addFakeRecipe(F, ST.array(ST.make(Blocks.oak_stairs, 1, W)), ST.array(IL.IE_Treated_Stairs.get(1)), null, null, FL.array(FL.Oil_Creosote.make(75)), ZL_FS, 102, 0, 0);
    RM.Bath.addFakeRecipe(F, ST.array(ST.make(Blocks.wooden_slab, 1, W)), ST.array(IL.IE_Treated_Slab.get(1, IL.Treated_Planks_Slab.get(1))), null, null, FL.array(FL.Oil_Creosote.make(50)), ZL_FS, 72, 0, 0);
    RM.Bath.addFakeRecipe(F, ST.array(IL.Plank_Slab.get(1)), ST.array(IL.IE_Treated_Slab.get(1, IL.Treated_Planks_Slab.get(1))), null, null, FL.array(FL.Oil_Creosote.make(50)), ZL_FS, 72, 0, 0);
    if (IL.ERE_White_Planks.exists())
        RM.Bath.addFakeRecipe(F, ST.array(IL.Plank.get(1)), ST.array(IL.ERE_White_Planks.get(1)), null, null, FL.array(DYE_FLUIDS_WATER[DYE_INDEX_White]), ZL_FS, 144, 0, 0);
    if (IL.ERE_White_Slab.exists())
        RM.Bath.addFakeRecipe(F, ST.array(IL.Plank_Slab.get(1)), ST.array(IL.ERE_White_Slab.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_WATER[DYE_INDEX_White], 1, 2, T)), ZL_FS, 72, 0, 0);
    if (IL.ERE_White_Planks.exists())
        RM.Bath.addFakeRecipe(F, ST.array(ST.make(Blocks.planks, 1, W)), ST.array(IL.ERE_White_Planks.get(1)), null, null, FL.array(DYE_FLUIDS_WATER[DYE_INDEX_White]), ZL_FS, 144, 0, 0);
    if (IL.ERE_White_Stairs.exists())
        RM.Bath.addFakeRecipe(F, ST.array(ST.make(Blocks.oak_stairs, 1, W)), ST.array(IL.ERE_White_Stairs.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_WATER[DYE_INDEX_White], 3, 4, T)), ZL_FS, 102, 0, 0);
    if (IL.ERE_White_Slab.exists())
        RM.Bath.addFakeRecipe(F, ST.array(ST.make(Blocks.wooden_slab, 1, W)), ST.array(IL.ERE_White_Slab.get(1)), null, null, FL.array(FL.mul(DYE_FLUIDS_WATER[DYE_INDEX_White], 1, 2, T)), ZL_FS, 72, 0, 0);
    if (IL.LOOTBAGS_Bag_0.exists())
        RM.Unboxinator.addFakeRecipe(F, ST.array(IL.LOOTBAGS_Bag_0.get(1)), ST.array(IL.LOOTBAGS_Bag_0.getWithName(1, "Random Drops depending on Config")), null, ZL_LONG, ZL_FS, ZL_FS, 16, 16, 0);
    if (IL.LOOTBAGS_Bag_1.exists())
        RM.Unboxinator.addFakeRecipe(F, ST.array(IL.LOOTBAGS_Bag_1.get(1)), ST.array(IL.LOOTBAGS_Bag_1.getWithName(1, "Random Drops depending on Config")), null, ZL_LONG, ZL_FS, ZL_FS, 16, 16, 0);
    if (IL.LOOTBAGS_Bag_2.exists())
        RM.Unboxinator.addFakeRecipe(F, ST.array(IL.LOOTBAGS_Bag_2.get(1)), ST.array(IL.LOOTBAGS_Bag_2.getWithName(1, "Random Drops depending on Config")), null, ZL_LONG, ZL_FS, ZL_FS, 16, 16, 0);
    if (IL.LOOTBAGS_Bag_3.exists())
        RM.Unboxinator.addFakeRecipe(F, ST.array(IL.LOOTBAGS_Bag_3.get(1)), ST.array(IL.LOOTBAGS_Bag_3.getWithName(1, "Random Drops depending on Config")), null, ZL_LONG, ZL_FS, ZL_FS, 16, 16, 0);
    if (IL.LOOTBAGS_Bag_4.exists())
        RM.Unboxinator.addFakeRecipe(F, ST.array(IL.LOOTBAGS_Bag_4.get(1)), ST.array(IL.LOOTBAGS_Bag_4.getWithName(1, "Random Drops depending on Config")), null, ZL_LONG, ZL_FS, ZL_FS, 16, 16, 0);
    RM.BedrockOreList.addFakeRecipe(F, ST.array(ST.make(Blocks.bedrock, 1, W)), ST.array(ST.make(Blocks.cobblestone, 1, 0, "Various Cobblestone Types"), OP.dust.mat(MT.Bedrock, 1)), null, new long[] { 9990, 10 }, FL.array(FL.lube(100)), null, 0, 0, 0);
    if (IL.BTL_Bedrock.exists())
        RM.BedrockOreList.addFakeRecipe(F, ST.array(IL.BTL_Bedrock.get(1)), ST.array(ST.make(Blocks.cobblestone, 1, 0, "Various Cobblestone Types"), OP.dust.mat(MT.Bedrock, 1)), null, new long[] { 9990, 10 }, FL.array(FL.lube(100)), null, 0, 0, 0);
    RM.ByProductList.mRecipeMachineList.add(ST.make(Items.cauldron, 1, 0));
    RM.ByProductList.mRecipeMachineList.add(ST.make(Blocks.cauldron, 1, 0));
    MultiTileEntityRegistry aRegistry = MultiTileEntityRegistry.getRegistry("gt.multitileentity");
    RM.Other.addFakeRecipe(F, ST.array(ST.make(OP.dust.mat(MT.OREMATS.Cinnabar, 3), "Throw three Units of Cinnabar into Crucible"), IL.Ceramic_Crucible.getWithName(1, "Wait until it melts into Mercury"), IL.Bottle_Empty.getWithName(1, "Rightclick the Crucible with an Empty Bottle"), IL.TC_Shimmerleaf.getWithName(1, "Or just throw a Shimmerleaf into it"), ST.make(aRegistry.getItem(1199), "Heat up the Crucible using a Burning Box"), NI), ST.array(IL.Bottle_Mercury.get(1), ST.make(OP.ingot.mat(MT.Hg, 1), "Pouring this into Molds only works with additional Cooling!"), ST.make(OP.nugget.mat(MT.Hg, 1), "Pouring this into Molds only works with additional Cooling!")), null, ZL_LONG, FL.array(MT.Hg.liquid(1, T)), FL.array(MT.Hg.liquid(1, T)), 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(IL.Ceramic_Mold.getWithName(1, "Don't forget to shape the Mold to pour it"), IL.Ceramic_Crucible.getWithName(1, "Wait until it all turns into Steel"), ST.make(aRegistry.getItem(1302), "Point a running Engine into the Crucible to blow Air"), ST.make(OP.ingot.mat(MT.Fe, 1), "Throw some Iron into Crucible. Do not forget to leave space for Air!"), ST.make(aRegistry.getItem(1199), "Heat up the Crucible using a Burning Box"), ST.make(OP.ingot.mat(MT.WroughtIron, 1), "Or throw Wrought Iron into the Crucible, either works")), ST.array(OP.dust.mat(MT.Steel, 1), OP.ingot.mat(MT.Steel, 1), OP.plate.mat(MT.Steel, 1), OP.scrapGt.mat(MT.Steel, 1), OP.stick.mat(MT.Steel, 1), OP.gearGt.mat(MT.Steel, 1)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(OP.ingot.mat(MT.Zn, 1), "Dump some Zinc into the Crucible"), IL.Ceramic_Faucet.getWithName(1, "Pour Zinc using a Faucet attached to the Crucible"), IL.Ceramic_Crucible.getWithName(1, "Wait until the Zinc is molten"), ST.make(OP.plate.mat(MT.Steel, 1), "Put your Steel Object into the Bathing Pot"), ST.make(aRegistry.getItem(32707), "Place the Bathing Pot (Table) below the Faucet"), ST.make(aRegistry.getItem(1199), "Heat up the Crucible using a Burning Box")), ST.array(OP.plate.mat(MT.SteelGalvanized, 1), OP.plateCurved.mat(MT.SteelGalvanized, 1), OP.stick.mat(MT.SteelGalvanized, 1), OP.casingSmall.mat(MT.SteelGalvanized, 1), OP.gearGt.mat(MT.SteelGalvanized, 1), OP.screw.mat(MT.SteelGalvanized, 1)), null, ZL_LONG, FL.array(MT.Zn.liquid(1, T)), FL.array(MT.Zn.liquid(1, T)), 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 0, "Find a Rubber Tree in a Taiga Biome or similar"), ST.make(BlocksGT.Leaves_AB, 1, 0, "Make sure its natural Leaves stay intact!"), ST.make(BlocksGT.LogA, 1, 0, "Look for a possible Resin Hole at the Tree"), NI, NI, IL.Bag_Sap_Resin.getWithName(1, "Place Resin Bag at the Hole")), ST.array(IL.Resin.get(1), IL.IC2_Resin.get(1)), null, ZL_LONG, ZL_FS, FL.array(FL.Resin_Rubber.make(250)), 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 1, "Find a Maple Tree in a Forest"), ST.make(BlocksGT.Leaves_AB, 1, 1, "Make sure its natural Leaves stay intact!"), ST.make(BlocksGT.LogA, 1, 1, "Choose one of the Log Segments at the Base of the Tree"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.HAND_DRILL, "Drill only one Hole into the Tree"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.DRILL_LV, "Drill only one Hole into the Tree"), IL.Bag_Sap_Resin.getWithName(1, "Place Sap Bag at the drilled Hole")), ZL_IS, null, ZL_LONG, ZL_FS, FL.array(FL.Sap_Maple.make(250)), 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 2, "Find a Willow Tree in the Swamp"), ST.make(BlocksGT.Leaves_AB, 1, 2, "Harvest its Leaves for Sticks"), ST.make(BlocksGT.LogA, 1, 2, "Use its Logs in a Coke Oven for double the Charcoal"), NI, NI, NI), ST.array(OP.stick.mat(MT.WOODS.Willow, 1), OP.gem.mat(MT.Charcoal, 2), OP.ingot.mat(MT.Charcoal, 2)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 3, "Find a Blue Mahoe Tree in the Jungle"), ST.make(BlocksGT.Leaves_AB, 1, 3, "Harvest its Leaves for Sticks"), ST.make(BlocksGT.LogA, 1, 3, "Nothing special about its Logs"), NI, NI, NI), ST.array(OP.stick.mat(MT.WOODS.BlueMahoe, 1)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 4, "Find a Hazel Tree in the Plains"), ST.make(BlocksGT.Leaves_AB, 1, 4, "Harvest its Leaves for Hazelnuts and Sticks"), ST.make(BlocksGT.LogB, 1, 0, "Nothing special about its Logs"), NI, NI, NI), ST.array(IL.Food_Hazelnut.get(1), OP.stick.mat(MT.WOODS.Hazel, 1)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 5, "Find a Cinnamon Tree in the Jungle"), ST.make(BlocksGT.Leaves_AB, 1, 5, "Nothing special about its Leaves"), ST.make(BlocksGT.LogB, 1, 1, "The Bark does not regrow! Plant a new Tree for more"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.KNIFE, "Remove its edible Bark"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.AXE, "Remove its edible Bark"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.SAW, "Remove its edible Bark")), ST.array(OM.dust(MT.Cinnamon), IL.Food_Cinnamon.get(1), IL.HaC_Cinnamon.get(1)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 6, "Find a Coconut Tree near the Ocean"), ST.make(BlocksGT.Leaves_AB, 1, 6, "Harvest its Leaves for Coconuts"), ST.make(BlocksGT.LogB, 1, 2, "Nothing special about its Logs"), NI, NI, NI), ST.array(IL.Food_Coconut.get(1)), null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_AB, 1, 7, "Find a super rare Rainbow Tree"), ST.make(BlocksGT.Leaves_AB, 1, 7, "Make sure its natural Leaves stay intact!"), ST.make(BlocksGT.LogB, 1, 3, "Choose one of the Log Segments at the Base of the Tree"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.HAND_DRILL, "Drill only one Hole into the Tree"), ST.make(ToolsGT.sMetaTool, 1, ToolsGT.DRILL_LV, "Drill only one Hole into the Tree"), IL.Bag_Sap_Resin.getWithName(1, "Place Sap Bag at the drilled Hole")), ZL_IS, null, ZL_LONG, ZL_FS, FL.array(FL.Sap_Rainbow.make(250)), 0, 0, 0);
    RM.Other.addFakeRecipe(F, ST.array(ST.make(BlocksGT.Saplings_CD, 1, 0, "Find a Blue Spruce Tree in the Mountains"), ST.make(BlocksGT.Leaves_CD, 1, 0, "Nothing special about its Leaves"), ST.make(BlocksGT.LogC, 1, 0, "Nothing special about its Logs"), NI, NI, NI), ZL_IS, null, ZL_LONG, ZL_FS, ZL_FS, 0, 0, 0);
    if (CODE_CLIENT) {
        for (OreDictMaterial aMaterial : OreDictMaterial.ALLOYS) {
            for (IOreDictConfigurationComponent tAlloy : aMaterial.mAlloyCreationRecipes) {
                boolean temp = T, tAddSpecial = F;
                ArrayListNoNulls<ItemStack> tDusts = new ArrayListNoNulls<>(), tIngots = new ArrayListNoNulls<>(), tSpecial = new ArrayListNoNulls<>();
                ArrayListNoNulls<Long> tMeltingPoints = new ArrayListNoNulls<>();
                for (OreDictMaterialStack tMaterial : tAlloy.getUndividedComponents()) {
                    boolean tAddedSpecial = F;
                    if (tMaterial.mMaterial.mHidden) {
                        temp = F;
                        break;
                    }
                    if (tMaterial.mMaterial == MT.Air) {
                        tDusts.add(FL.Air.display(UT.Code.units(tMaterial.mAmount, U, 1000, T)));
                        tIngots.add(FL.Air.display(UT.Code.units(tMaterial.mAmount, U, 1000, T)));
                        continue;
                    }
                    if (tMaterial.mMaterial == MT.OREMATS.Magnetite) {
                        tAddedSpecial = tSpecial.add(ST.make(BlocksGT.Sands, UT.Code.divup(tMaterial.mAmount, U * 9), 0, "You probably want to craft it into Dust"));
                    } else if (tMaterial.mMaterial == MT.OREMATS.BasalticMineralSand) {
                        tAddedSpecial = tSpecial.add(ST.make(BlocksGT.Sands, UT.Code.divup(tMaterial.mAmount, U * 9), 1, "You probably want to craft it into Dust"));
                    } else if (tMaterial.mMaterial == MT.OREMATS.GraniticMineralSand) {
                        tAddedSpecial = tSpecial.add(ST.make(BlocksGT.Sands, UT.Code.divup(tMaterial.mAmount, U * 9), 2, "You probably want to craft it into Dust"));
                    } else if (tMaterial.mMaterial == MT.C) {
                        tAddedSpecial = tSpecial.add(OM.dustOrIngot(MT.Coal, tMaterial.mAmount * 2));
                    }
                    if (tMaterial.mMaterial == MT.CaCO3) {
                        tAddedSpecial = tSpecial.add(OM.dustOrIngot(MT.STONES.Limestone, tMaterial.mAmount * 2));
                    }
                    tMeltingPoints.add(tMaterial.mMaterial.mMeltingPoint);
                    ItemStack tDust = OM.dustOrIngot(tMaterial.mMaterial, tMaterial.mAmount);
                    if (!tDusts.add(tDust)) {
                        temp = F;
                        break;
                    }
                    tIngots.add(OM.ingotOrDust(tMaterial.mMaterial, tMaterial.mAmount));
                    if (tAddedSpecial)
                        tAddSpecial = T;
                    else
                        tSpecial.add(tDust);
                }
                Collections.sort(tMeltingPoints);
                if (temp) {
                    RM.CrucibleAlloying.addFakeRecipe(F, tDusts.toArray(ZL_IS), ST.array(OM.ingotOrDust(aMaterial, tAlloy.getCommonDivider() * U)), null, null, null, null, 0, 0, tMeltingPoints.size() > 1 ? Math.max(tMeltingPoints.get(tMeltingPoints.size() - 2), aMaterial.mMeltingPoint) : aMaterial.mMeltingPoint);
                    RM.CrucibleAlloying.addFakeRecipe(F, tIngots.toArray(ZL_IS), ST.array(OM.ingotOrDust(aMaterial, tAlloy.getCommonDivider() * U)), null, null, null, null, 0, 0, tMeltingPoints.size() > 1 ? Math.max(tMeltingPoints.get(tMeltingPoints.size() - 2), aMaterial.mMeltingPoint) : aMaterial.mMeltingPoint);
                    if (tAddSpecial)
                        RM.CrucibleAlloying.addFakeRecipe(F, tSpecial.toArray(ZL_IS), ST.array(OM.ingotOrDust(aMaterial, tAlloy.getCommonDivider() * U)), null, null, null, null, 0, 0, tMeltingPoints.size() > 1 ? Math.max(tMeltingPoints.get(tMeltingPoints.size() - 2), aMaterial.mMeltingPoint) : aMaterial.mMeltingPoint);
                }
            }
        }
        for (OreDictMaterial aMaterial : OreDictMaterial.MATERIAL_ARRAY) if (aMaterial != null) {
            Recipe tRecipe = RecipeMapReplicator.getReplicatorRecipe(aMaterial, IL.USB_Stick_3.getWithName(0, "Mat Data: " + aMaterial.getLocal()));
            if (tRecipe != null)
                RM.Replicator.addFakeRecipe(F, tRecipe);
        }
    }
    for (MultiItemRandom tItem : ItemsGT.ALL_MULTI_ITEMS) for (Entry<Short, ArrayList<IBehavior<MultiItem>>> tEntry : tItem.mItemBehaviors.entrySet()) for (IBehavior<MultiItem> tBehavior : tEntry.getValue()) if (tBehavior instanceof Behavior_Turn_Into)
        if (((Behavior_Turn_Into) tBehavior).mTurnInto.exists())
            tItem.mVisibleItems.set(tEntry.getKey(), F);
}
Also used : OreDictMaterial(gregapi.oredict.OreDictMaterial) Behavior_Turn_Into(gregapi.item.multiitem.behaviors.Behavior_Turn_Into) MultiTileEntityRegistry(gregapi.block.multitileentity.MultiTileEntityRegistry) Recipe(gregapi.recipes.Recipe) IItemContainer(gregapi.code.IItemContainer) IOreDictConfigurationComponent(gregapi.oredict.configurations.IOreDictConfigurationComponent) OreDictMaterialStack(gregapi.oredict.OreDictMaterialStack) ArrayListNoNulls(gregapi.code.ArrayListNoNulls) MultiItem(gregapi.item.multiitem.MultiItem) Entry(java.util.Map.Entry) MultiItemRandom(gregapi.item.multiitem.MultiItemRandom) IBehavior(gregapi.item.multiitem.behaviors.IBehavior) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Example 4 with MultiItemRandom

use of gregapi.item.multiitem.MultiItemRandom in project gregtech6 by GregTech6.

the class OreDictPrefix method onOreRegistration.

@Override
public void onOreRegistration(OreDictRegistrationContainer aEvent) {
    if (aEvent.mMaterial == MT.NULL) {
        if (!contains(TD.Prefix.MATERIAL_BASED)) {
            if (COMPAT_TC != null && !(aEvent.mStack.getItem() instanceof IEssentiaContainerItem) && !(aEvent.mStack.getItem() instanceof MultiItemRandom) && !MD.MC.owns(aEvent.mRegName) && !MD.TC.owns(aEvent.mRegName)) {
                List<TC_AspectStack> tAspects = new ArrayListNoNulls<>();
                for (TC_AspectStack tAspect : mAspects) tAspect.addToAspectList(tAspects);
                COMPAT_TC.registerThaumcraftAspectsToItem(ST.amount(1, aEvent.mStack), tAspects, F);
            }
            for (IOreDictListenerEvent tListener : mListenersOre) {
                if (D2)
                    ORD.println("Processing '" + aEvent.mOreDictName + "' with the Prefix '" + mNameInternal + "' and without Material at " + UT.Reflection.getClassName(tListener));
                tListener.onOreRegistration(aEvent);
            }
            mRegistrations.add(aEvent);
            if (!mRegisteredItems.contains(new ItemStackContainer(aEvent.mStack, W)))
                mRegisteredItems.add(aEvent.mStack);
        }
    } else {
        if (!mIgnoredRegistrations.contains(aEvent.mMaterial)) {
            if (!aEvent.mMaterial.contains(TD.Properties.INVALID_MATERIAL)) {
                if (COMPAT_TC != null && !(aEvent.mStack.getItem() instanceof IEssentiaContainerItem) && !(aEvent.mStack.getItem() instanceof MultiItemRandom) && !MD.MC.owns(aEvent.mRegName) && !MD.TC.owns(aEvent.mRegName)) {
                    List<TC_AspectStack> tAspects = new ArrayListNoNulls<>();
                    for (TC_AspectStack tAspect : mAspects) {
                        if (tAspect.mAspect == TC.METALLUM && !aEvent.mMaterial.mHasMetallum) {
                            // replacing Metallum with Ordo for non-metallic Stuff.
                            TC.stack(TC.ORDO, tAspect.mAmount).addToAspectList(tAspects);
                        } else {
                            tAspect.addToAspectList(tAspects);
                        }
                    }
                    if (mAmount >= U || mAmount < 0)
                        for (TC_AspectStack tAspect : aEvent.mMaterial.mAspects) tAspect.addToAspectList(tAspects);
                    COMPAT_TC.registerThaumcraftAspectsToItem(ST.amount(1, aEvent.mStack), tAspects, F);
                }
                for (IOreDictListenerEvent tListener : mListenersOre) {
                    if (D2)
                        ORD.println("Processing '" + aEvent.mOreDictName + "' with the Prefix '" + mNameInternal + "' and the Material '" + aEvent.mMaterial.mNameInternal + "' at " + UT.Reflection.getClassName(tListener));
                    tListener.onOreRegistration(aEvent);
                }
                mRegistrations.add(aEvent);
            }
            aEvent.mMaterial.mRegisteredItems.add(new ItemStackContainer(aEvent.mStack));
            mRegisteredMaterials.add(aEvent.mMaterial);
            if (!mRegisteredItems.contains(new ItemStackContainer(aEvent.mStack, W)))
                mRegisteredItems.add(aEvent.mStack);
        }
    }
}
Also used : IEssentiaContainerItem(thaumcraft.api.aspects.IEssentiaContainerItem) ItemStackContainer(gregapi.code.ItemStackContainer) IOreDictListenerEvent(gregapi.oredict.event.IOreDictListenerEvent) TC_AspectStack(gregapi.data.TC.TC_AspectStack) MultiItemRandom(gregapi.item.multiitem.MultiItemRandom) ArrayListNoNulls(gregapi.code.ArrayListNoNulls)

Aggregations

MultiItemRandom (gregapi.item.multiitem.MultiItemRandom)4 ArrayListNoNulls (gregapi.code.ArrayListNoNulls)2 OreDictMaterialStack (gregapi.oredict.OreDictMaterialStack)2 Block (net.minecraft.block.Block)2 ItemStack (net.minecraft.item.ItemStack)2 EnviroDataTracker (enviromine.trackers.EnviroDataTracker)1 BlockBasePlanks (gregapi.block.metatype.BlockBasePlanks)1 BlockBaseBale (gregapi.block.misc.BlockBaseBale)1 MultiTileEntityRegistry (gregapi.block.multitileentity.MultiTileEntityRegistry)1 BlockBaseBeam (gregapi.block.tree.BlockBaseBeam)1 BlockBaseLog (gregapi.block.tree.BlockBaseLog)1 BlockBaseSapling (gregapi.block.tree.BlockBaseSapling)1 IItemContainer (gregapi.code.IItemContainer)1 ItemStackContainer (gregapi.code.ItemStackContainer)1 TC_AspectStack (gregapi.data.TC.TC_AspectStack)1 IItemNoGTOverride (gregapi.item.IItemNoGTOverride)1 MultiItem (gregapi.item.multiitem.MultiItem)1 Behavior_Turn_Into (gregapi.item.multiitem.behaviors.Behavior_Turn_Into)1 IBehavior (gregapi.item.multiitem.behaviors.IBehavior)1 IFoodStat (gregapi.item.multiitem.food.IFoodStat)1