Search in sources :

Example 1 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class GT_API_Post method onModInit2.

@Override
public void onModInit2(FMLInitializationEvent aEvent) {
    new LoaderWoodDictionary().run();
    // Atum violates the "Items have to be created in preInit" Rule...
    if (MD.ATUM.mLoaded) {
        IL.ATUM_Scarab.set(ST.make(MD.ATUM, "item.scarab", 1, 0), new OreDictItemData(MT.Au, 4 * U, MT.Diamond, U));
        IL.ATUM_Limestone.set(ST.make(MD.ATUM, "tile.stone", 1, 0), OP.stone.dat(MT.STONES.Limestone));
        IL.ATUM_Limecobble.set(ST.make(MD.ATUM, "tile.cobble", 1, 0), OP.stone.dat(MT.STONES.Limestone));
        OM.reg("cropDate", ST.make(MD.ATUM, "item.date", 1, 0));
        OM.reg("cropFlax", ST.make(MD.ATUM, "item.flax", 1, 0));
        OM.reg("seedFlax", ST.make(MD.ATUM, "item.flaxSeeds", 1, 0));
        OM.reg("itemPelt", ST.make(MD.ATUM, "item.wolfPelt", 1, 0));
        OM.reg(OP.dust, MT.Ectoplasm, ST.make(MD.ATUM, "item.ectoplasm", 1, 0));
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Fe2O3, MD.ATUM, "tile.ironOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Au, MD.ATUM, "tile.goldOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Redstone, MD.ATUM, "tile.redstoneOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Lapis, MD.ATUM, "tile.lapisOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Coal, MD.ATUM, "tile.coalOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreLimestone, MT.Diamond, MD.ATUM, "tile.diamondOre", 0);
        OM.data(MD.ATUM, "item.stoneChunk", 1, 0, MT.STONES.Limestone, U);
        OM.data(MD.ATUM, "tile.sand", 1, W, MT.Sand, U * 9);
        OM.data(MD.ATUM, "tile.framedGlass", 1, W, MT.Glass, U * 9);
        OM.data(MD.ATUM, "tile.crystalGlass", 1, W, MT.Glass, U * 9);
        OM.data(MD.ATUM, "tile.framedStainedGlass", 1, W, MT.Glass, U * 9);
        OM.data(MD.ATUM, "tile.crystalStainedGlass", 1, W, MT.Glass, U * 9);
        OM.data(MD.ATUM, "tile.thinFramedGlass", 1, W, MT.Glass, U);
        OM.data(MD.ATUM, "tile.thinCrystalGlass", 1, W, MT.Glass, U);
        OM.data(MD.ATUM, "tile.thinFramedStainedGlass", 1, W, MT.Glass, U);
        OM.data(MD.ATUM, "tile.thinCrystalStainedGlass", 1, W, MT.Glass, U);
        OM.data(MD.ATUM, "item.loot", 1, 2, MT.Ag, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 3, MT.Ag, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 4, MT.Au, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 5, MT.Au, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 6, MT.Au, 2 * U, MT.BlueSapphire, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 7, MT.Au, 2 * U, MT.BlueSapphire, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 8, MT.Au, 2 * U, MT.Ruby, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 9, MT.Au, 2 * U, MT.Ruby, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 10, MT.Au, 2 * U, MT.Emerald, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 11, MT.Au, 2 * U, MT.Emerald, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 12, MT.Au, 2 * U, MT.Diamond, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 13, MT.Au, 2 * U, MT.Diamond, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 34, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 35, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 36, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 37, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 38, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 39, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 40, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 41, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 42, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 43, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 44, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 45, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 66, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 67, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 68, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 69, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 70, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 71, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 72, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 73, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 74, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 75, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 76, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 77, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 98, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 99, MT.Ag, U);
        OM.data(MD.ATUM, "item.loot", 1, 100, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 101, MT.Au, U);
        OM.data(MD.ATUM, "item.loot", 1, 102, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 103, MT.Au, U, MT.BlueSapphire, U);
        OM.data(MD.ATUM, "item.loot", 1, 104, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 105, MT.Au, U, MT.Ruby, U);
        OM.data(MD.ATUM, "item.loot", 1, 106, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 107, MT.Au, U, MT.Emerald, U);
        OM.data(MD.ATUM, "item.loot", 1, 108, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 109, MT.Au, U, MT.Diamond, U);
        OM.data(MD.ATUM, "item.loot", 1, 130, MT.Ag, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 131, MT.Ag, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 132, MT.Au, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 133, MT.Au, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 134, MT.Au, 2 * U, MT.BlueSapphire, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 135, MT.Au, 2 * U, MT.BlueSapphire, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 136, MT.Au, 2 * U, MT.Ruby, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 137, MT.Au, 2 * U, MT.Ruby, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 138, MT.Au, 2 * U, MT.Emerald, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 139, MT.Au, 2 * U, MT.Emerald, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 140, MT.Au, 2 * U, MT.Diamond, 2 * U);
        OM.data(MD.ATUM, "item.loot", 1, 141, MT.Au, 2 * U, MT.Diamond, 2 * U);
    }
    // Okay I should not have wondered about Blue Power doing the same garbage considering Project Red...
    if (MD.BP.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.RedAlloy, MD.BP, "red_alloy_ingot", 0);
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.BlueAlloy, MD.BP, "blue_alloy_ingot", 0);
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.PurpleAlloy, MD.BP, "purple_alloy_ingot", 0);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.Nikolite, MD.BP, "teslatite_dust", 0);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.UNUSED.InfusedTeslatite, MD.BP, "infused_teslatite_dust", 0);
        OreDictManager.INSTANCE.setTarget(OP.plate, MT.Stone, MD.BP, "stone_tile", 0);
        OM.reg(OD.craftingWorkBench, ST.make(MD.BP, "project_table", 1, 0));
        OM.reg("seedFlax", ST.make(MD.BP, "flax_seeds", 1, 0));
        OM.reg(DYE_OREDICTS_MIXABLE[DYE_INDEX_Purple], ST.make(MD.BP, "indigo_dye", 1, 0));
        OM.reg("cropIndigo", ST.make(MD.BP, "indigo_flower", 1, 0));
        OM.reg(OP.dustTiny.dat(MT.Zn), ST.make(MD.BP, "zinc_tiny_dust", 1, 0));
        OM.reg(OP.crushed.dat(MT.Zn), ST.make(MD.BP, "zinc_ore_crushed", 1, 0));
        OM.reg(OP.crushedPurified.dat(MT.Zn), ST.make(MD.BP, "zinc_ore_purified", 1, 0));
        OM.reg(OP.boule.dat(MT.Si), ST.make(MD.BP, "silicon_boule", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt_cobble", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt_brick", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "fancy_basalt", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt_brick_small", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basaltbrick_cracked", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt_paver", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.BP, "basalt_tile", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "marble", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "marble_brick", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "fancy_marble", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "marble_brick_small", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "marble_paver", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.BP, "marble_tile", 1, 0));
        OM.data(MD.BP, "zincplate", 1, 0, ANY.Fe, U2, MT.Zn, U4);
        OM.data(MD.BP, "paint_can", 1, W, ANY.Fe, 7 * U2, MT.Zn, 7 * U4);
        OM.data(MD.BP, "lumar", 1, W, ANY.Glowstone, U2, MT.Redstone, U2);
        OM.data(MD.BP, "tiles", 1, 0, MT.STONES.Marble, U2, MT.STONES.Basalt, U2);
        ItemsGT.SHOW_RESISTANCE.add(ST.make(MD.BP, "sapphire_glass", 1, 0));
        ItemsGT.SHOW_RESISTANCE.add(ST.make(MD.BP, "reinforced_sapphire_glass", 1, 0));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "ruby_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "sapphire_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "amethyst_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "silver_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "teslatite_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "tungsten_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "zinc_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.BP, "copper_ore", null));
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ruby, MD.BP, "ruby_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.BlueSapphire, MD.BP, "sapphire_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Amethyst, MD.BP, "amethyst_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ag, MD.BP, "silver_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Nikolite, MD.BP, "teslatite_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OREMATS.Tungstate, MD.BP, "tungsten_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Zn, MD.BP, "zinc_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Cu, MD.BP, "copper_ore", 0);
    }
    // And Project Red violates that Rule aswell...
    if (MD.PR.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.RedAlloy, MD.PR, "projectred.core.part", 10);
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.ElectrotineAlloy, MD.PR, "projectred.core.part", 55);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.Nikolite, MD.PR, "projectred.core.part", 56);
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.PR_EXPLORATION, "projectred.exploration.stone", 1, 0));
        OM.reg(OP.stone.dat(MT.STONES.Marble), ST.make(MD.PR_EXPLORATION, "projectred.exploration.stone", 1, 1));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.PR_EXPLORATION, "projectred.exploration.stone", 1, 2));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.PR_EXPLORATION, "projectred.exploration.stone", 1, 3));
        OM.reg(OP.stone.dat(MT.STONES.Basalt), ST.make(MD.PR_EXPLORATION, "projectred.exploration.stone", 1, 4));
        for (int i = 0; i < 16; i++) {
            OM.reg(DYE_OREDICTS_MIXABLE[i], ST.make(MD.PR_EXPLORATION, "projectred.exploration.lilyseed", 1, 15 - i));
            OM.data(MD.PR, "projectred.core.part", 1, i + 19, ANY.Glowstone, 2 * U);
        }
        OM.data(MD.PR, "projectred.core.part", 1, 16, ANY.Cu, U);
        OM.data(MD.PR, "projectred.core.part", 1, 17, ANY.Fe, U);
        OM.data(MD.PR, "projectred.core.part", 1, 18, MT.Au, U);
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.PR_EXPLORATION, "projectred.exploration.ore", null));
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ruby, MD.PR_EXPLORATION, "projectred.exploration.ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.BlueSapphire, MD.PR_EXPLORATION, "projectred.exploration.ore", 1);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Olivine, MD.PR_EXPLORATION, "projectred.exploration.ore", 2);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Cu, MD.PR_EXPLORATION, "projectred.exploration.ore", 3);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Sn, MD.PR_EXPLORATION, "projectred.exploration.ore", 4);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ag, MD.PR_EXPLORATION, "projectred.exploration.ore", 5);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Nikolite, MD.PR_EXPLORATION, "projectred.exploration.ore", 6);
    }
    // Yay for ChickenBones ALWAYS doing it wrong...
    if (MD.WR_CBE_C.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.stick, MT.Obsidian, MD.WR_CBE_C, "obsidianStick", 0);
    }
    if (MD.FMB.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.stick, MT.Stone, MD.FMB, "stoneRod", 0);
    }
    if (MD.TRANSLOCATOR.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.nugget, MT.Diamond, MD.TRANSLOCATOR, "diamondNugget", 0);
    }
    // Oh look, Matter Overdrive does this shit too...
    if (MD.MO.mLoaded) {
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.MO, "dilithium_ore", null));
        StoneLayer.REPLACEABLE_BLOCKS.add(ST.block(MD.MO, "tritanium_ore", null));
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Dolamide, MD.MO, "dilithium_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OREMATS.TritaniumDioxide, MD.MO, "tritanium_ore", 0);
        OreDictManager.INSTANCE.setTarget(OP.gem, MT.Dilithium, MD.MO, "dilithium_crystal", 0);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.TritaniumAlloy, MD.MO, "tritanium_dust", 0);
        OreDictManager.INSTANCE.setTarget(OP.nugget, MT.TritaniumAlloy, MD.MO, "tritanium_nugget", 0);
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.TritaniumAlloy, MD.MO, "tritanium_ingot", 0);
        OreDictManager.INSTANCE.setTarget(OP.plate, MT.TritaniumAlloy, MD.MO, "tritanium_plate", 0);
    }
    // ThermalExpansion gets on this ShitList too I guess...
    if (MD.TE.mLoaded) {
        ItemsGT.SHOW_RESISTANCE.add(ST.make(MD.TE, "Glass", 1, W));
        IL.TE_Rockwool.set(ST.make(MD.TE, "Rockwool", 1, 0));
        IL.TE_ObsidiGlass.set(ST.make(MD.TE, "Glass", 1, 0));
        IL.TE_LumiumGlass.set(ST.make(MD.TE, "Glass", 1, 1));
        OM.data(MD.TE, "Tank", 1, 1, ANY.Cu, U * 1, MT.Glass, U * 4);
        OM.data(MD.TE, "Tank", 1, 2, MT.Invar, U * 4, ANY.Cu, U * 1, MT.Glass, U * 4);
        OM.data(MD.TE, "Tank", 1, 3, MT.Invar, U * 4, ANY.Cu, U * 1, MT.Glass, U * 4);
        OM.data(MD.TE, "Tank", 1, 4, MT.Enderium, U * 4, MT.Invar, U * 4, ANY.Cu, U * 1, MT.Glass, U * 4);
    }
    // Wow, Ars Magica too is on this List, at least for its Blocks...
    IL.ARS_Cerublossom.set(ST.make(MD.ARS, "blueOrchid", 1, 0), null, "flowerCerublossom");
    IL.ARS_DesertNova.set(ST.make(MD.ARS, "desertNova", 1, 0), null, "flowerDesertNova");
    // Cooking for Blockheads is here too!...
    if (MD.CookBook.mLoaded) {
        OM.data(MD.CookBook, "recipebook", 1, W, MT.Paper, U * 3);
    }
    // Grimoire of Gaia... though I did not expect them to have done a good job with that...
    if (MD.GoG.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.chunkGt, MT.Fe, MD.GoG, "item.GrimoireOfGaia.Shard", 0);
        OreDictManager.INSTANCE.setTarget(OP.chunkGt, MT.Au, MD.GoG, "item.GrimoireOfGaia.Shard", 1);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Shard", 1, 2, MT.Diamond, U4);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Shard", 1, 3, MT.Emerald, U4);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Shard", 1, 4, MT.NetherStar, U4);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Shard", 1, 5, MT.EnderPearl, U4);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Shard", 1, 6, MT.Blaze, U8);
        OM.data(MD.GoG, "item.GrimoireOfGaia.Fragment", 1, 0, MT.Emerald, U8);
    }
    // Seems like it isn't "better" in all aspects.
    if (MD.BETTER_RECORDS.mLoaded) {
        OM.reg(OD.record, ST.make(MD.BETTER_RECORDS, "urlrecord", 1, 0));
        OM.reg(OD.record, ST.make(MD.BETTER_RECORDS, "urlmultirecord", 1, 0));
    }
    // Oh look what Ars Magica 2 does late too...
    if (MD.ARS.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Vinteum, MD.ARS, "vinteumOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Chimerite, MD.ARS, "vinteumOre", 1);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.BlueTopaz, MD.ARS, "vinteumOre", 2);
        OreDictManager.INSTANCE.setTarget(OP.ore, MT.Sunstone, MD.ARS, "vinteumOre", 3);
        OreDictManager.INSTANCE.setTarget(OP.oreMoon, MT.Moonstone, MD.ARS, "vinteumOre", 4);
        OreDictManager.INSTANCE.setTarget(OP.blockGem, MT.Moonstone, MD.ARS, "vinteumOre", 5);
        OreDictManager.INSTANCE.setTarget(OP.blockDust, MT.Vinteum, MD.ARS, "vinteumOre", 6);
        OreDictManager.INSTANCE.setTarget(OP.blockGem, MT.BlueTopaz, MD.ARS, "vinteumOre", 7);
        OreDictManager.INSTANCE.setTarget(OP.blockGem, MT.Sunstone, MD.ARS, "vinteumOre", 8);
        OreDictManager.INSTANCE.setTarget(OP.blockGem, MT.Chimerite, MD.ARS, "vinteumOre", 9);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.Vinteum, MD.ARS, "itemOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.ArcaneCompound, MD.ARS, "itemOre", 1);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.ArcaneAsh, MD.ARS, "itemOre", 2);
        OreDictManager.INSTANCE.setTarget(OP.dust, MT.VinteumPurified, MD.ARS, "itemOre", 3);
        OreDictManager.INSTANCE.setTarget(OP.gem, MT.Chimerite, MD.ARS, "itemOre", 4);
        OreDictManager.INSTANCE.setTarget(OP.gem, MT.BlueTopaz, MD.ARS, "itemOre", 5);
        OreDictManager.INSTANCE.setTarget(OP.gem, MT.Sunstone, MD.ARS, "itemOre", 6);
        OreDictManager.INSTANCE.setTarget(OP.gem, MT.Moonstone, MD.ARS, "itemOre", 7);
    }
    // Those "On-Demand" Materials of VoltzEngine are registered late...
    if (MD.VOLTZ.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Sn, MD.VOLTZ, "veStoneOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Cu, MD.VOLTZ, "veStoneOre", 1);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ag, MD.VOLTZ, "veStoneOre", 2);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Pb, MD.VOLTZ, "veStoneOre", 3);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Zn, MD.VOLTZ, "veStoneOre", 4);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Ni, MD.VOLTZ, "veStoneOre", 5);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OREMATS.Bauxite, MD.VOLTZ, "veStoneOre", 6);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.MgCO3, MD.VOLTZ, "veStoneOre", 7);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OREMATS.Uraninite, MD.VOLTZ, "veStoneOre", 8);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Pt, MD.VOLTZ, "veStoneOre", 9);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Amazonite, MD.VOLTZ, "veGemOre", 0);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.SmokeyQuartz, MD.VOLTZ, "veGemOre", 1);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OnyxBlack, MD.VOLTZ, "veGemOre", 2);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.OnyxRed, MD.VOLTZ, "veGemOre", 3);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Uvarovite, MD.VOLTZ, "veGemOre", 4);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Grossular, MD.VOLTZ, "veGemOre", 5);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Almandine, MD.VOLTZ, "veGemOre", 6);
        OreDictManager.INSTANCE.setTarget(OP.oreVanillastone, MT.Andradite, MD.VOLTZ, "veGemOre", 7);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 0, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 1, ANY.Steel, U2);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 2, ANY.Steel, U4);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 3, ANY.Steel, U8);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 4, ANY.Steel, U3);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 5, ANY.Steel, U4);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 6, ANY.Steel, U4);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 7, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 8, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 9, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 10, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 11, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 12, ANY.Steel, 17 * U16);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 13, ANY.Steel, 33 * U16);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 14, ANY.Steel, 67 * U16);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 15, ANY.Steel, U16);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 16, ANY.Steel, U8);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 17, ANY.Steel, U4);
        OM.data(MD.VOLTZ, "veSheetMetal", 1, 18, ANY.Steel, 3 * U2);
        OM.data(MD.VOLTZ, "veGear", 1, 1, ANY.Cu, U);
        OM.data(MD.VOLTZ, "veGear", 1, 2, MT.Sn, U);
        OM.data(MD.VOLTZ, "veGear", 1, 3, MT.Bronze, U);
        OM.data(MD.VOLTZ, "veGear", 1, 4, ANY.Fe, U);
        OM.data(MD.VOLTZ, "veGear", 1, 5, ANY.Steel, U);
        OM.data(MD.VOLTZ, "veGear", 1, 6, MT.Ag, U);
        OM.data(MD.VOLTZ, "veGear", 1, 7, MT.Au, U);
        OM.data(MD.VOLTZ, "veGear", 1, 8, MT.Pb, U);
        OM.data(MD.VOLTZ, "veGear", 1, 9, MT.Zn, U);
        OM.data(MD.VOLTZ, "veGear", 1, 10, MT.Ni, U);
        OM.data(MD.VOLTZ, "veGear", 1, 11, MT.Al, U);
        OM.data(MD.VOLTZ, "veGear", 1, 12, MT.Mg, U);
        OM.data(MD.VOLTZ, "veGear", 1, 14, MT.Brass, U);
        OM.data(MD.VOLTZ, "veGear", 1, 15, ANY.Stone, U);
        OM.data(MD.VOLTZ, "veGear", 1, 16, ANY.Wood, U);
        OM.data(MD.VOLTZ, "veGear", 1, 17, MT.Diamond, U);
        OM.data(MD.VOLTZ, "veGear", 1, 18, MT.Pt, U);
        OM.data(MD.VOLTZ, "veRod", 1, 1, ANY.Cu, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 2, MT.Sn, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 3, MT.Bronze, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 4, ANY.Fe, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 5, ANY.Steel, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 6, MT.Ag, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 7, MT.Au, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 8, MT.Pb, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 9, MT.Zn, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 10, MT.Ni, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 11, MT.Al, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 12, MT.Mg, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 14, MT.Brass, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 15, ANY.Stone, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 16, ANY.Wood, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 17, MT.Diamond, U2);
        OM.data(MD.VOLTZ, "veRod", 1, 18, MT.Pt, U2);
        OM.data(MD.VOLTZ, "veWire", 1, 1, ANY.Cu, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 2, MT.Sn, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 3, MT.Bronze, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 4, ANY.Fe, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 5, ANY.Steel, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 6, MT.Ag, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 7, MT.Au, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 8, MT.Pb, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 9, MT.Zn, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 10, MT.Ni, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 11, MT.Al, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 12, MT.Mg, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 14, MT.Brass, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 15, ANY.Stone, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 16, ANY.Wood, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 17, MT.Diamond, U9);
        OM.data(MD.VOLTZ, "veWire", 1, 18, MT.Pt, U9);
    }
    // Bugfix just in case that one broken Version of Et Futurum Requiem is used.
    if (MD.EtFu.mLoaded) {
        OreDictManager.INSTANCE.setTarget(OP.ingot, MT.Cu, MD.EtFu, "copper_ingot", 0);
    }
}
Also used : LoaderWoodDictionary(gregapi.load.LoaderWoodDictionary) OreDictItemData(gregapi.oredict.OreDictItemData)

Example 2 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class GT_API_Proxy method onWorldTick.

@SubscribeEvent
public void onWorldTick(WorldTickEvent aEvent) {
    if (aEvent.side.isServer() && aEvent.phase == Phase.END) {
        ArrayListNoNulls<EntityXPOrb> tOrbs = (XP_ORB_COMBINING && SERVER_TIME % 40 == 31 ? new ArrayListNoNulls<EntityXPOrb>(128) : null);
        for (int i = 0; i < aEvent.world.loadedEntityList.size(); i++) {
            Entity aEntity = (Entity) aEvent.world.loadedEntityList.get(i);
            if (aEntity == null || aEntity.isDead)
                continue;
            if (aEntity instanceof EntityXPOrb) {
                if (tOrbs != null)
                    tOrbs.add((EntityXPOrb) aEntity);
            } else if (aEntity instanceof EntityItem) {
                ItemStack aStack = ((EntityItem) aEntity).getEntityItem();
                if (ST.valid(aStack)) {
                    ItemStack rStack = ST.copy(aStack);
                    boolean tBreak = F, tFireProof = F;
                    // TODO make a case for Armor too whenever I decide to even add Armor.
                    if (rStack.getItem() instanceof MultiItemTool) {
                        if (MultiItemTool.getPrimaryMaterial(aStack).contains(TD.Properties.UNBURNABLE))
                            tFireProof = T;
                        if (MultiItemTool.getSecondaryMaterial(aStack).contains(TD.Properties.UNBURNABLE))
                            tFireProof = T;
                    }
                    OreDictItemData aData = OM.anydata_(rStack);
                    if (aData != null) {
                        if (aData.hasValidPrefixData())
                            for (IOreDictListenerItem tListener : aData.mPrefix.mListenersItem) {
                                rStack = tListener.onTickWorld(aData.mPrefix, aData.mMaterial.mMaterial, rStack, (EntityItem) aEntity);
                                if (!ST.equal(rStack, aStack) || rStack.stackSize != aStack.stackSize) {
                                    tBreak = T;
                                    break;
                                }
                            }
                        if (!tBreak && aData.hasValidMaterialData())
                            for (OreDictMaterialStack tMaterial : aData.getAllMaterialStacks()) {
                                if (tBreak)
                                    break;
                                if (tMaterial.mMaterial.contains(TD.Properties.UNBURNABLE))
                                    tFireProof = T;
                                for (IOreDictListenerItem tListener : tMaterial.mMaterial.mListenersItem) {
                                    rStack = tListener.onTickWorld(aData.mPrefix, tMaterial.mMaterial, rStack, (EntityItem) aEntity);
                                    if (!ST.equal(rStack, aStack) || rStack.stackSize != aStack.stackSize) {
                                        tBreak = T;
                                        break;
                                    }
                                }
                            }
                    }
                    if (rStack == null || rStack.stackSize <= 0) {
                        ((EntityItem) aEntity).setEntityItemStack(NI);
                        ((EntityItem) aEntity).setDead();
                    } else if (!ST.equal(rStack, aStack) || rStack.stackSize != aStack.stackSize) {
                        ((EntityItem) aEntity).setEntityItemStack(rStack);
                        ((EntityItem) aEntity).delayBeforeCanPickup = 40;
                    }
                    if (!aEntity.isDead && aEntity.isBurning() && (tBreak || (tFireProof && !MD.MC.owns(rStack)))) {
                        UT.Reflection.setField(EntityItem.class, aEntity, "health", 250, F);
                        UT.Reflection.setField(EntityItem.class, aEntity, "field_70291_e", 250, F);
                        aEntity.extinguish();
                    }
                }
            } else if (aEntity instanceof EntityLivingBase) {
                if (ENTITY_CRAMMING > 0 && SERVER_TIME % 50 == 0 && !(aEntity instanceof EntityPlayer) && ((EntityLivingBase) aEntity).canBePushed() && ((EntityLivingBase) aEntity).getHealth() > 0) {
                    List<?> tList = aEntity.worldObj.getEntitiesWithinAABBExcludingEntity(aEntity, aEntity.boundingBox.expand(0.2, 0.0, 0.2));
                    Class<? extends Entity> tClass = aEntity.getClass();
                    int aEntityCount = 1;
                    if (tList != null)
                        for (int j = 0; j < tList.size(); j++) if (tList.get(j) != null && tList.get(j).getClass() == tClass)
                            aEntityCount++;
                    if (aEntityCount > ENTITY_CRAMMING)
                        aEntity.attackEntityFrom(DamageSource.inWall, (aEntityCount - ENTITY_CRAMMING) * TFC_DAMAGE_MULTIPLIER);
                }
            }
        }
        if (tOrbs != null && tOrbs.size() > 32)
            for (EntityXPOrb aOrb : tOrbs) {
                if (aOrb.xpValue >= Short.MAX_VALUE)
                    continue;
                if (aOrb.xpValue <= 0) {
                    aOrb.xpValue = 0;
                    aOrb.setDead();
                    continue;
                }
                for (EntityXPOrb tOrb : tOrbs) if (aOrb != tOrb && !tOrb.isDead && tOrb.xpValue > 0 && tOrb.xpValue < Short.MAX_VALUE && aOrb.getDistanceSqToEntity(tOrb) <= 3) {
                    aOrb.xpOrbAge = Math.min(aOrb.xpOrbAge, tOrb.xpOrbAge);
                    if (aOrb.xpValue + tOrb.xpValue > Short.MAX_VALUE) {
                        tOrb.xpValue -= (Short.MAX_VALUE - aOrb.xpValue);
                        aOrb.xpValue = Short.MAX_VALUE;
                        break;
                    }
                    aOrb.xpValue += tOrb.xpValue;
                    tOrb.xpValue = 0;
                    tOrb.setDead();
                    break;
                }
            }
        if (SERVER_TIME % 20 == 1) {
            checkSaveLocation(aEvent.world.getSaveHandler().getWorldDirectory(), T);
            for (int i = 0; i < aEvent.world.loadedTileEntityList.size(); i++) {
                TileEntity aTileEntity = (TileEntity) aEvent.world.loadedTileEntityList.get(i);
                if (aTileEntity instanceof ITileEntityNeedsSaving)
                    WD.mark(aTileEntity);
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) PrefixBlockTileEntity(gregapi.block.prefixblock.PrefixBlockTileEntity) Entity(net.minecraft.entity.Entity) OreDictItemData(gregapi.oredict.OreDictItemData) OreDictMaterialStack(gregapi.oredict.OreDictMaterialStack) PacketDeathPoint(gregapi.network.packets.PacketDeathPoint) ArrayListNoNulls(gregapi.code.ArrayListNoNulls) TileEntity(net.minecraft.tileentity.TileEntity) PrefixBlockTileEntity(gregapi.block.prefixblock.PrefixBlockTileEntity) MultiItemTool(gregapi.item.multiitem.MultiItemTool) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityItem(net.minecraft.entity.item.EntityItem) IOreDictListenerItem(gregapi.oredict.listeners.IOreDictListenerItem) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 3 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class GT_API_Proxy method onItemExpireEvent.

/*
	@SubscribeEvent
	public void populate(PopulateChunkEvent.Post aEvent) {
		WorldGeneratorGT6.generate(aEvent.world, aEvent.chunkX << 4, aEvent.chunkZ << 4, F);
	}
	*/
@SubscribeEvent
public void onItemExpireEvent(ItemExpireEvent aEvent) {
    if (aEvent.entity.worldObj.isRemote)
        return;
    ItemStack aStack = aEvent.entityItem.getEntityItem();
    int aX = UT.Code.roundDown(aEvent.entity.posX), aY = UT.Code.roundDown(aEvent.entity.posY), aZ = UT.Code.roundDown(aEvent.entity.posZ);
    if (ST.valid(aStack)) {
        if (aStack.getItem() instanceof MultiTileEntityItemInternal) {
            long tExtraLife = ((MultiTileEntityItemInternal) aStack.getItem()).onDespawn(aEvent.entityItem, aStack);
            if (aStack.stackSize <= 0) {
                aEvent.extraLife = 0;
                aEvent.entityItem.setDead();
                aEvent.setCanceled(T);
                return;
            }
            aEvent.entityItem.setEntityItemStack(aStack);
            if (tExtraLife > 0) {
                aEvent.extraLife = UT.Code.bindInt(aEvent.extraLife + tExtraLife);
                aEvent.setCanceled(T);
                return;
            }
        }
        MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry("gt.multitileentity");
        if (tRegistry != null) {
            OreDictItemData tData = OM.anydata(aStack);
            if (tData != null) {
                if (tData.mPrefix == OP.rockGt || tData.mPrefix == OP.oreRaw)
                    for (byte[] tOff : CUBE_3) if (WD.irrelevant(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2]) && tRegistry.mBlock.placeBlock(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2], SIDE_TOP, (short) 32074, ST.save(NBT_VALUE, aStack), T, F)) {
                        aStack.stackSize = 0;
                        aEvent.extraLife = 0;
                        aEvent.entityItem.setDead();
                        aEvent.setCanceled(T);
                        return;
                    }
                if (tData.mPrefix == OP.ingot)
                    for (byte[] tOff : CUBE_3) if (WD.irrelevant(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2]) && tRegistry.mBlock.placeBlock(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2], SIDE_TOP, (short) 32084, ST.save(NBT_VALUE, aStack), T, F)) {
                        aStack.stackSize = 0;
                        aEvent.extraLife = 0;
                        aEvent.entityItem.setDead();
                        aEvent.setCanceled(T);
                        return;
                    }
                if (tData.mPrefix == OP.plate)
                    for (byte[] tOff : CUBE_3) if (WD.irrelevant(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2]) && tRegistry.mBlock.placeBlock(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2], SIDE_TOP, (short) 32085, ST.save(NBT_VALUE, aStack), T, F)) {
                        aStack.stackSize = 0;
                        aEvent.extraLife = 0;
                        aEvent.entityItem.setDead();
                        aEvent.setCanceled(T);
                        return;
                    }
                if (tData.mPrefix == OP.plateGem)
                    for (byte[] tOff : CUBE_3) if (WD.irrelevant(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2]) && tRegistry.mBlock.placeBlock(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2], SIDE_TOP, (short) 32086, ST.save(NBT_VALUE, aStack), T, F)) {
                        aStack.stackSize = 0;
                        aEvent.extraLife = 0;
                        aEvent.entityItem.setDead();
                        aEvent.setCanceled(T);
                        return;
                    }
                if (tData.mPrefix == OP.scrapGt)
                    for (byte[] tOff : CUBE_3) if (WD.irrelevant(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2]) && tRegistry.mBlock.placeBlock(aEvent.entity.worldObj, aX + tOff[0], aY + tOff[1], aZ + tOff[2], SIDE_TOP, (short) 32103, ST.save(NBT_VALUE, aStack), T, F)) {
                        aStack.stackSize = 0;
                        aEvent.extraLife = 0;
                        aEvent.entityItem.setDead();
                        aEvent.setCanceled(T);
                        return;
                    }
            }
        }
        GarbageGT.trash(aStack);
        aStack.stackSize = 0;
        aEvent.extraLife = 0;
        aEvent.entityItem.setEntityItemStack(aStack);
        aEvent.entityItem.setDead();
        aEvent.setCanceled(T);
        return;
    }
}
Also used : MultiTileEntityRegistry(gregapi.block.multitileentity.MultiTileEntityRegistry) OreDictItemData(gregapi.oredict.OreDictItemData) MultiTileEntityItemInternal(gregapi.block.multitileentity.MultiTileEntityItemInternal) PacketDeathPoint(gregapi.network.packets.PacketDeathPoint) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 4 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class GT_API_Proxy method onPlayerTickEvent.

@SubscribeEvent
public void onPlayerTickEvent(PlayerTickEvent aEvent) {
    if (!aEvent.player.isDead && aEvent.phase == Phase.END) {
        for (Object tPotion : aEvent.player.getActivePotionEffects()) {
            if (tPotion instanceof PotionEffect && ((PotionEffect) tPotion).getDuration() <= 0) {
                aEvent.player.removePotionEffect(((PotionEffect) tPotion).getPotionID());
                break;
            }
        }
        if (aEvent.side.isServer()) {
            if (SURVIVAL_INTO_ADVENTURE_MODE && aEvent.player.ticksExisted % 200 == 0 && aEvent.player.capabilities.allowEdit && !UT.Entities.isCreative(aEvent.player)) {
                aEvent.player.setGameType(WorldSettings.GameType.ADVENTURE);
                aEvent.player.capabilities.allowEdit = F;
                if (ADVENTURE_MODE_KIT) {
                    if (MD.GT.mLoaded) {
                        UT.Entities.sendchat(aEvent.player, CHAT_GREG + "Thank you for choosing the GregTech-6 Adventure Mode Starter Kit.");
                        ST.drop(aEvent.player, IL.Bottle_Purple_Drink.get(6));
                        ST.drop(aEvent.player, IL.Grass_Dry.get(8));
                        ST.drop(aEvent.player, IL.Stick.get(16));
                        ST.drop(aEvent.player, Items.flint, 12, 0);
                        ST.drop(aEvent.player, Blocks.dirt, 16, 0);
                        ST.drop(aEvent.player, Blocks.sapling, 4, 0);
                        switch(RNGSUS.nextInt(4)) {
                            case 0:
                                ST.drop(aEvent.player, IL.Food_Large_Sandwich_Veggie.get(1));
                                break;
                            case 1:
                                ST.drop(aEvent.player, IL.Food_Large_Sandwich_Cheese.get(1));
                                break;
                            case 2:
                                ST.drop(aEvent.player, IL.Food_Large_Sandwich_Steak.get(1));
                                break;
                            case 3:
                                ST.drop(aEvent.player, IL.Food_Large_Sandwich_Bacon.get(1));
                                break;
                        }
                    } else {
                        UT.Entities.sendchat(aEvent.player, CHAT_GREG + "It's dangerous to go alone! Take this.");
                        ST.drop(aEvent.player, Items.stone_axe, 1, 0);
                    }
                }
            }
            // , tCrazyJ1984 = "CrazyJ1984".equalsIgnoreCase(aEvent.player.getCommandSenderName());
            final boolean tHungerEffect = (HUNGER_BY_INVENTORY_WEIGHT && aEvent.player.ticksExisted % 2400 == 1200), tBetweenlands = WD.dimBTL(aEvent.player.worldObj.provider);
            if (aEvent.player.ticksExisted % 120 == 0) {
                ItemStack tStack;
                int tCount = 64, tEmptySlots = 36, tCraponite = 0;
                for (int i = 0; i < 36; i++) {
                    if (ST.valid(tStack = aEvent.player.inventory.getStackInSlot(i))) {
                        tEmptySlots--;
                        if (tBetweenlands) {
                            if (tStack.getItem() == Items.potionitem) {
                                ST.set(tStack, IL.BTL_Tainted_Potion.get(1), F, F);
                            } else if (tStack.getItem() instanceof IFluidContainerItem) {
                                FluidStack tFluid = ((IFluidContainerItem) tStack.getItem()).getFluid(tStack);
                                if (tFluid != null && !FL.Potion_Tainted.is(tFluid) && FluidsGT.POTION.contains(tFluid.getFluid().getName())) {
                                    ((IFluidContainerItem) tStack.getItem()).drain(tStack, Integer.MAX_VALUE, T);
                                    ((IFluidContainerItem) tStack.getItem()).fill(tStack, FL.Potion_Tainted.make(tFluid.amount), T);
                                }
                            }
                            ItemStack tRotten = RottingUtil.rotting(tStack, aEvent.player.worldObj, UT.Code.roundDown(aEvent.player.posX), UT.Code.roundDown(aEvent.player.posY), UT.Code.roundDown(aEvent.player.posZ));
                            if (ST.invalid(tRotten)) {
                                tStack.stackSize = 0;
                                aEvent.player.inventory.setInventorySlotContents(i, null);
                                continue;
                            }
                            if (tStack != tRotten)
                                ST.set(tStack, tRotten);
                        }
                        OreDictItemData tData = OM.anydata_(tStack);
                        if (!UT.Entities.isInvincible(aEvent.player)) {
                            UT.Entities.applyRadioactivity(aEvent.player, UT.Entities.getRadioactivityLevel(tStack), tStack.stackSize);
                            float tHeat = UT.Entities.getHeatDamageFromItem(tStack);
                            if (tHeat != 0.0F)
                                if (tHeat > 0)
                                    UT.Entities.applyHeatDamage(aEvent.player, tHeat);
                                else
                                    UT.Entities.applyFrostDamage(aEvent.player, -tHeat);
                        }
                        if (tData != null && tData.hasValidMaterialData()) {
                            if ((tData.mMaterial.mMaterial == MT.Bedrockium || tData.mMaterial.mMaterial == MT.Neutronium) && (tData.hasValidPrefixData() || tData.mByProducts.length <= 0)) {
                                PotionEffect tEffect = null;
                                UT.Entities.applyPotion(aEvent.player, Potion.moveSlowdown.id, Math.max(140, ((tEffect = aEvent.player.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), 3, F);
                            }
                            if (tData.mMaterial.mMaterial == MT.Craponite) {
                                tCraponite++;
                            }
                            if (tData.mMaterial.mMaterial == MT.Firestone && tData.hasValidPrefixData() && !MD.RC.owns(tStack))
                                for (int j = (int) UT.Code.divup(tData.mMaterial.mAmount, U) * tStack.stackSize; j > 0; j--) {
                                    WD.fire(aEvent.player.worldObj, UT.Code.roundDown(aEvent.player.posX) - 5 + RNGSUS.nextInt(11), UT.Code.roundDown(aEvent.player.posY) - 5 + RNGSUS.nextInt(11), UT.Code.roundDown(aEvent.player.posZ) - 5 + RNGSUS.nextInt(11), RNGSUS.nextInt(8) != 0);
                                }
                        }
                        if (tHungerEffect)
                            tCount += (tStack.stackSize * 64) / Math.max(1, tStack.getMaxStackSize());
                        if (INVENTORY_UNIFICATION)
                            OM.set_(tStack);
                        ST.update(tStack, aEvent.player);
                        if (tStack.hasTagCompound() && tStack.getTagCompound().hasNoTags())
                            tStack.setTagCompound(null);
                    }
                }
                // This Code is to tell Bear and all the people around him that he should clean up his always cluttered Inventory.
                if ("Bear989Sr".equalsIgnoreCase(aEvent.player.getCommandSenderName())) {
                    if (tCraponite > 0) {
                        // Crazy started to give Bear her Craponite Arrows, lets not let him have those.
                        UT.Entities.applyPotion(aEvent.player, Potion.poison, 1200, tCraponite, T);
                    }
                    if (--BEAR_INVENTORY_COOL_DOWN < 0 && tEmptySlots < 4) {
                        BEAR_INVENTORY_COOL_DOWN = 100;
                        UT.Sounds.send(SFX.MC_HMM, aEvent.player);
                        for (int i = 0; i < aEvent.player.worldObj.playerEntities.size(); i++) {
                            EntityPlayer tPlayer = (EntityPlayer) aEvent.player.worldObj.playerEntities.get(i);
                            if (tPlayer == null)
                                continue;
                            if ("Bear989Sr".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                if (tPlayer.posY < 30) {
                                    UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Stop making Holes in the Ground, Bear!"));
                                } else {
                                    // Bear does not like being called these names, so lets annoy him. XD
                                    switch(tEmptySlots) {
                                        case 0:
                                            UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Alright Buttercup, your Inventory is full, time to go home."));
                                            break;
                                        case 1:
                                            UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Your Inventory is starting to get full, Buttercup"));
                                            break;
                                        case 2:
                                            UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Your Inventory is starting to get full, Bean989Sr"));
                                            break;
                                        case 3:
                                            UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Your Inventory is starting to get full, Mr. Bear"));
                                            break;
                                    }
                                }
                            } else if ("Bear989jr".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                UT.Inventories.addStackToPlayerInventoryOrDrop(tPlayer, UT.NBT.addEnchantment(ST.make(Items.cookie, 1, 0, "Jr. Cookie"), Enchantment_WerewolfDamage.INSTANCE, 1), F);
                                UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Have a Jr. Cookie. Please tell Fatass to clean his Inventory, or smack him with it."));
                            } else if ("CrazyJ1984".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                ItemStack tArrow = ST.update(OP.arrowGtWood.mat(MT.Craponite, 1), aEvent.player);
                                if (ST.valid(tArrow)) {
                                    UT.Inventories.addStackToPlayerInventoryOrDrop(tPlayer, tArrow, F);
                                    UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "I'm not trying to tell you what to do, but please don't hurt Bear with this."));
                                } else {
                                    UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "I'm not trying to tell you what to do, but please don't hurt Bear."));
                                }
                            } else if ("GregoriusT".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                UT.Inventories.addStackToPlayerInventoryOrDrop(tPlayer, ST.update(OP.arrowGtPlastic.mat(MT.Tc, 1), aEvent.player), F);
                                UT.Entities.chat(tPlayer, new ChatComponentText(LH.Chat.BOLD + "You have received an Arrow"));
                            } else if ("Ilirith".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Could you tell Bear989Sr very gently, that his Inventory is a fucking mess again?"));
                            } else if ("Shadowkn1ght18".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "Here is your special Message to make you tell Bear989Sr to clean his Inventory."));
                            } else if ("e99999".equalsIgnoreCase(tPlayer.getCommandSenderName())) {
                                UT.Entities.chat(tPlayer, new ChatComponentText(LH.Chat.DGRAY + "You get the sneaking suspicion that Bears Inventory may or may not be full right now."));
                            } else {
                                UT.Entities.chat(tPlayer, new ChatComponentText(CHAT_GREG + "There is this fella called Bear-Nine-Eight-Nine, needing be reminded of his Inventory being a major Pine."));
                            }
                        }
                    }
                }
                for (int i = 0; i < 4; i++) if (ST.valid(tStack = aEvent.player.inventory.armorInventory[i])) {
                    // I also like this Backpack implementation, so I cant just leave the dupe exploit easy to pull off.
                    if (MD.BTRS.mLoaded && (IL.BTRS_Backpack.equal(tStack, T, T) || IL.BTRS_Thaumpack.equal(tStack, T, T) || IL.BTRS_Enderpack.equal(tStack, T, T))) {
                        ST.meta(tStack, 0);
                    }
                    if (!UT.Entities.isInvincible(aEvent.player)) {
                        UT.Entities.applyRadioactivity(aEvent.player, UT.Entities.getRadioactivityLevel(tStack), tStack.stackSize);
                        float tHeat = UT.Entities.getHeatDamageFromItem(tStack);
                        if (tHeat != 0.0F)
                            if (tHeat > 0)
                                UT.Entities.applyHeatDamage(aEvent.player, tHeat);
                            else
                                UT.Entities.applyFrostDamage(aEvent.player, -tHeat);
                    }
                    if (tHungerEffect)
                        tCount += 256;
                }
                if (tHungerEffect)
                    aEvent.player.addExhaustion(Math.max(1.0F, tCount / 666F));
            }
        }
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) IFluidContainerItem(net.minecraftforge.fluids.IFluidContainerItem) FluidStack(net.minecraftforge.fluids.FluidStack) OreDictItemData(gregapi.oredict.OreDictItemData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText) PacketDeathPoint(gregapi.network.packets.PacketDeathPoint) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 5 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class GT_API_Proxy_Client method onItemTooltip.

@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent aEvent) {
    if (Abstract_Mod.sFinalized < Abstract_Mod.sModCountUsingGTAPI || ST.invalid(aEvent.itemStack))
        return;
    if (!DISPLAY_TEMP_TOOLTIP) {
        DISPLAY_TEMP_TOOLTIP = T;
        return;
    }
    try {
        if (UT.NBT.getNBT(aEvent.itemStack).getBoolean("gt.err.oredict.output")) {
            aEvent.toolTip.clear();
            aEvent.toolTip.add(0, LH.Chat.BLINKING_RED + "A Recipe used an OreDict Item as Output directly, without copying it before!");
            aEvent.toolTip.add(1, LH.Chat.BLINKING_RED + "This is a typical CallByReference/CallByValue Error of the Modder doing it.");
            aEvent.toolTip.add(2, LH.Chat.BLINKING_RED + "Please check all Recipes outputting this Item, and report the Recipes to their Owner.");
            aEvent.toolTip.add(3, LH.Chat.BLINKING_RED + "The Owner of the RECIPE, NOT the Owner of the Item!");
            return;
        }
        String aRegName = ST.regName(aEvent.itemStack);
        if (aRegName == null) {
            aEvent.toolTip.set(0, LH.Chat.BLINKING_RED + "ERROR: THIS ITEM HAS NOT BEEN REGISTERED!!!");
            aRegName = "ERROR: THIS ITEM HAS NOT BEEN REGISTERED!!!";
        }
        short aMeta = ST.meta_(aEvent.itemStack);
        byte aBlockMeta = UT.Code.bind4(aMeta);
        Block aBlock = ST.block(aEvent.itemStack);
        Item aItem = ST.item(aEvent.itemStack);
        if (aEvent.itemStack.getTagCompound() == null) {
            if (aBlock == Blocks.dirt && aBlockMeta == 1) {
                aEvent.toolTip.set(0, aEvent.toolTip.get(0).replaceAll("Dirt", "Coarse Dirt"));
            }
            if (MD.RC.mLoaded && "Railcraft:part.plate".equalsIgnoreCase(aRegName)) {
                switch(aMeta) {
                    case 0:
                        aEvent.toolTip.set(0, LH.Chat.WHITE + LH.get("oredict.plateIron.name"));
                        break;
                    case 1:
                        aEvent.toolTip.set(0, LH.Chat.WHITE + LH.get("oredict.plateSteel.name"));
                        break;
                    case 2:
                        aEvent.toolTip.set(0, LH.Chat.WHITE + LH.get("oredict.plateTinAlloy.name"));
                        break;
                    case 3:
                        aEvent.toolTip.set(0, LH.Chat.WHITE + LH.get("oredict.plateCopper.name"));
                        break;
                    case 4:
                        aEvent.toolTip.set(0, LH.Chat.WHITE + LH.get("oredict.plateLead.name"));
                        break;
                }
            }
        }
        if (MD.Mek.owns(aRegName)) {
            aEvent.toolTip.set(0, aEvent.toolTip.get(0).replaceAll("Osmium", MT.Ge.mNameLocal));
        }
        if (ItemsGT.RECIPE_REMOVED_USE_TRASH_BIN_INSTEAD.contains(aEvent.itemStack, T)) {
            aEvent.toolTip.add(LH.Chat.BLINKING_RED + "Recipe has been removed in favour of the GregTech Ender Garbage Bin");
        }
        ICover tCover = CoverRegistry.get(aEvent.itemStack);
        if (tCover != null)
            tCover.addToolTips(aEvent.toolTip, aEvent.itemStack, aEvent.showAdvancedItemTooltips);
        if (aBlock != NB) {
            if (IL.TC_Warded_Glass.equal(aEvent.itemStack, F, T)) {
                aEvent.toolTip.add(LH.getToolTipBlastResistance(aBlock, 999));
            } else if (ItemsGT.SHOW_RESISTANCE.contains(aEvent.itemStack, T)) {
                if (IL.ICBM_Concrete.block() == aBlock) {
                    switch(aMeta) {
                        default:
                            aEvent.toolTip.add(LH.getToolTipBlastResistance(aBlock, 30));
                            break;
                        case 1:
                            aEvent.toolTip.add(LH.getToolTipBlastResistance(aBlock, 38));
                            break;
                        case 2:
                            aEvent.toolTip.add(LH.getToolTipBlastResistance(aBlock, 48));
                            break;
                    }
                } else {
                    aEvent.toolTip.add(LH.getToolTipBlastResistance(aBlock, aBlock.getExplosionResistance(null)));
                }
                aEvent.toolTip.add(LH.getToolTipHarvest(aBlock.getMaterial(), aBlock.getHarvestTool(aBlockMeta), aBlock.getHarvestLevel(aBlockMeta)));
            }
            if (BlocksGT.openableCrowbar.contains(aBlock)) {
                aEvent.toolTip.add(LH.Chat.DGRAY + LH.get(LH.TOOL_TO_OPEN_CROWBAR));
            }
        }
        if (BooksGT.BOOK_REGISTER.containsKey(aEvent.itemStack, T)) {
            aEvent.toolTip.add(LH.Chat.DGRAY + LH.get(LH.TOOLTIP_SHELFABLE));
        }
        if (Sandwiches.INGREDIENTS.containsKey(aEvent.itemStack, T)) {
            aEvent.toolTip.add(LH.Chat.DGRAY + LH.get(LH.TOOLTIP_SANDWICHABLE));
        }
        if (aItem.isBeaconPayment(aEvent.itemStack)) {
            aEvent.toolTip.add(LH.Chat.DGRAY + LH.get(LH.TOOLTIP_BEACON_PAYMENT));
        }
        OreDictItemData tData = OM.anydata_(aEvent.itemStack);
        if (!(aItem instanceof ItemFluidDisplay) && SHOW_INTERNAL_NAMES) {
            if (tData != null && tData.hasValidPrefixMaterialData()) {
                if (tData.mBlackListed) {
                    if (ST.isGT(aItem))
                        aEvent.toolTip.add(LH.Chat.ORANGE + tData.toString());
                    else
                        aEvent.toolTip.add(LH.Chat.DCYAN + aRegName + LH.Chat.WHITE + " - " + LH.Chat.CYAN + aMeta + LH.Chat.WHITE + " - " + LH.Chat.ORANGE + tData.toString());
                } else {
                    if (ST.isGT(aItem))
                        aEvent.toolTip.add(LH.Chat.GREEN + tData.toString());
                    else
                        aEvent.toolTip.add(LH.Chat.DCYAN + aRegName + LH.Chat.WHITE + " - " + LH.Chat.CYAN + aMeta + LH.Chat.WHITE + " - " + LH.Chat.GREEN + tData.toString());
                }
            } else {
                if (!ST.isGT(aItem))
                    aEvent.toolTip.add(LH.Chat.DCYAN + aRegName + LH.Chat.WHITE + " - " + LH.Chat.CYAN + aMeta);
            }
        }
        if (tData != null) {
            if (tData.hasValidPrefixData()) {
                for (IOreDictListenerItem tListener : tData.mPrefix.mListenersItem) {
                    String tToolTip = tListener.getListenerToolTip(tData.mPrefix, tData.mMaterial.mMaterial, aEvent.itemStack);
                    if (tToolTip != null)
                        aEvent.toolTip.add(tToolTip);
                }
            } else {
                if (IL.RC_Firestone_Refined.equal(aEvent.itemStack, T, T))
                    aEvent.toolTip.add(LH.Chat.CYAN + "Works in Burning Boxes (" + (800 * EU_PER_LAVA) + " HU per Lava Block)");
                else if (IL.RC_Firestone_Cracked.equal(aEvent.itemStack, T, T))
                    aEvent.toolTip.add(LH.Chat.CYAN + "Works in Burning Boxes (" + (600 * EU_PER_LAVA) + " HU per Lava Block)");
                else if (IL.TF_Pick_Giant.equal(aEvent.itemStack, T, T))
                    aEvent.toolTip.add(LH.Chat.CYAN + "Can be repaired with Knightmetal Ingots on the Anvil");
                else if (IL.TF_Sword_Giant.equal(aEvent.itemStack, T, T))
                    aEvent.toolTip.add(LH.Chat.CYAN + "Can be repaired with Ironwood Ingots on the Anvil");
                else if (IL.TF_Lamp_of_Cinders.equal(aEvent.itemStack, T, T))
                    aEvent.toolTip.add(LH.Chat.CYAN + "Can be used as a Lighter for GT6 things and TNT");
            }
            if (tData.hasValidMaterialData()) {
                boolean tUnburnable = F;
                for (OreDictMaterialStack tMaterial : tData.getAllMaterialStacks()) {
                    if (tMaterial.mMaterial.contains(TD.Properties.UNBURNABLE))
                        tUnburnable = T;
                    for (IOreDictListenerItem tListener : tMaterial.mMaterial.mListenersItem) {
                        String tToolTip = tListener.getListenerToolTip(tData.mPrefix, tData.mMaterial.mMaterial, aEvent.itemStack);
                        if (tToolTip != null)
                            aEvent.toolTip.add(tToolTip);
                    }
                }
                if (tData.mMaterial.mMaterial.mToolTypes > 0 && (tData.mPrefix != null || (aEvent.itemStack.getMaxStackSize() > 1 && tData.mByProducts.length == 0 && tData.mMaterial.mAmount <= U))) {
                    aEvent.toolTip.add(LH.Chat.BLUE + "Q: " + tData.mMaterial.mMaterial.mToolQuality + " - S: " + tData.mMaterial.mMaterial.mToolSpeed + " - D: " + tData.mMaterial.mMaterial.mToolDurability);
                }
                if (SHOW_CHEM_FORMULAS && UT.Code.stringValid(tData.mMaterial.mMaterial.mTooltipChemical) && (tData.mPrefix == null ? tData.mByProducts.length == 0 : tData.mPrefix.contains(TD.Prefix.TOOLTIP_MATERIAL))) {
                    aEvent.toolTip.add(LH.Chat.YELLOW + tData.mMaterial.mMaterial.mTooltipChemical);
                }
                if (tData.mMaterial.mMaterial == MT.Nikolite) {
                    aEvent.toolTip.set(0, aEvent.toolTip.get(0).replaceAll("(Teslatite|Electrotine)", MT.Nikolite.mNameLocal));
                }
                if (tData.mMaterial.mMaterial == MT.Ge) {
                    aEvent.toolTip.set(0, aEvent.toolTip.get(0).replaceAll("Osmium", MT.Ge.mNameLocal));
                }
                if (tData.hasValidPrefixData()) {
                    if (tData.mPrefix == OP.dustTiny && ANY.Blaze.mToThis.contains(tData.mMaterial.mMaterial)) {
                        aEvent.toolTip.set(0, aEvent.toolTip.get(0).replaceAll(tData.mMaterial.mMaterial.mNameLocal, OP.dustTiny.mMaterialPre + tData.mMaterial.mMaterial.mNameLocal));
                    }
                    if (tData.mPrefix.contains(TD.Prefix.NEEDS_SHARPENING))
                        aEvent.toolTip.add(LH.Chat.CYAN + LH.get(LH.TOOLTIP_NEEDS_SHARPENING));
                    if (tData.mPrefix.contains(TD.Prefix.NEEDS_HANDLE))
                        aEvent.toolTip.add(LH.Chat.CYAN + LH.get(LH.TOOLTIP_NEEDS_HANDLE) + LH.Chat.WHITE + tData.mMaterial.mMaterial.mHandleMaterial.getLocal());
                    ArrayListNoNulls<Integer> tShapelessAmounts = new ArrayListNoNulls<>();
                    for (AdvancedCrafting1ToY tHandler : tData.mPrefix.mShapelessManagersSingle) if (tHandler.hasOutputFor(tData.mMaterial.mMaterial))
                        tShapelessAmounts.add(1);
                    for (AdvancedCraftingXToY tHandler : tData.mPrefix.mShapelessManagers) if (tHandler.hasOutputFor(tData.mMaterial.mMaterial))
                        tShapelessAmounts.add(tHandler.mInputCount);
                    if (!tShapelessAmounts.isEmpty()) {
                        Collections.sort(tShapelessAmounts);
                        aEvent.toolTip.add(LH.Chat.CYAN + LH.get(LH.TOOLTIP_SHAPELESS_CRAFT) + LH.Chat.WHITE + tShapelessAmounts);
                    }
                    if (tData.mPrefix.contains(TD.Prefix.TOOLTIP_ENCHANTS)) {
                        if (!tData.mMaterial.mMaterial.mEnchantmentTools.isEmpty()) {
                            if (!tData.mPrefix.contains(TD.Prefix.AMMO_ALIKE)) {
                                if (tData.mMaterial.mMaterial.mEnchantmentTools.size() <= 5) {
                                    aEvent.toolTip.add(LH.Chat.PURPLE + LH.get(LH.TOOLTIP_POSSIBLE_TOOL_ENCHANTS));
                                    for (ObjectStack<Enchantment> tEnchantment : tData.mMaterial.mMaterial.mEnchantmentTools) {
                                        if (tEnchantment.mObject == Enchantment.fortune) {
                                            aEvent.toolTip.add(LH.Chat.PINK + Enchantment.fortune.getTranslatedName((int) tEnchantment.mAmount) + " / " + Enchantment.looting.getTranslatedName((int) tEnchantment.mAmount));
                                        } else if (tEnchantment.mObject == Enchantment.knockback) {
                                            aEvent.toolTip.add(LH.Chat.PINK + Enchantment.knockback.getTranslatedName((int) tEnchantment.mAmount) + " / " + Enchantment.punch.getTranslatedName((int) tEnchantment.mAmount));
                                        } else if (tEnchantment.mObject == Enchantment.fireAspect) {
                                            if (tEnchantment.mAmount >= 3)
                                                aEvent.toolTip.add(LH.Chat.PINK + Enchantment.fireAspect.getTranslatedName((int) tEnchantment.mAmount) + " / " + Enchantment.flame.getTranslatedName((int) tEnchantment.mAmount) + " / Auto Smelt I");
                                            else
                                                aEvent.toolTip.add(LH.Chat.PINK + Enchantment.fireAspect.getTranslatedName((int) tEnchantment.mAmount) + " / " + Enchantment.flame.getTranslatedName((int) tEnchantment.mAmount));
                                        } else {
                                            aEvent.toolTip.add(LH.Chat.PINK + tEnchantment.mObject.getTranslatedName((int) tEnchantment.mAmount));
                                        }
                                    }
                                } else {
                                    aEvent.toolTip.add(LH.Chat.PURPLE + LH.get(LH.TOOLTIP_TOO_MANY_TOOL_ENCHANTS));
                                }
                            }
                        }
                        if (MD.BTL.mLoaded && tData.mMaterial.mMaterial.contains(TD.Properties.BETWEENLANDS)) {
                            aEvent.toolTip.add(LH.Chat.GREEN + LH.get(LH.TOOLTIP_BETWEENLANDS_RESISTANCE));
                        }
                        if (!tData.mPrefix.containsAny(TD.Prefix.TOOL_HEAD, TD.Prefix.WEAPON_ALIKE, TD.Prefix.AMMO_ALIKE, TD.Prefix.TOOL_ALIKE)) {
                            if (!tData.mMaterial.mMaterial.mEnchantmentArmors.isEmpty()) {
                                if (tData.mMaterial.mMaterial.mEnchantmentArmors.size() <= 3) {
                                    aEvent.toolTip.add(LH.Chat.PURPLE + LH.get(LH.TOOLTIP_POSSIBLE_ARMOR_ENCHANTS));
                                    for (ObjectStack<Enchantment> tEnchantment : tData.mMaterial.mMaterial.mEnchantmentArmors) {
                                        aEvent.toolTip.add(LH.Chat.PINK + tEnchantment.mObject.getTranslatedName((int) tEnchantment.mAmount));
                                    }
                                } else {
                                    aEvent.toolTip.add(LH.Chat.PURPLE + LH.get(LH.TOOLTIP_TOO_MANY_ARMOR_ENCHANTS));
                                }
                            }
                            if ((IL.TF_Mazestone.exists() || IL.TF_Mazehedge.exists()) && tData.mMaterial.mMaterial.contains(TD.Properties.MAZEBREAKER)) {
                                aEvent.toolTip.add(LH.Chat.PINK + LH.get(LH.TOOLTIP_TWILIGHT_MAZE_BREAKING));
                            }
                        }
                    }
                    if (aBlock == NB || !(aBlock instanceof MultiTileEntityBlockInternal || aBlock instanceof IBlockBase)) {
                        if (tData.mMaterial.mMaterial.contains(TD.Properties.FLAMMABLE)) {
                            if (tData.mMaterial.mMaterial.contains(TD.Properties.EXPLOSIVE)) {
                                aEvent.toolTip.add(LH.Chat.RED + LH.get(LH.TOOLTIP_FLAMMABLE_AND_EXPLOSIVE));
                            } else {
                                aEvent.toolTip.add(LH.Chat.RED + LH.get(LH.TOOLTIP_FLAMMABLE));
                            }
                        } else if (tData.mMaterial.mMaterial.contains(TD.Properties.EXPLOSIVE)) {
                            aEvent.toolTip.add(LH.Chat.RED + LH.get(LH.TOOLTIP_EXPLOSIVE));
                        }
                    }
                }
                if (tUnburnable && !MD.MC.owns(aRegName))
                    aEvent.toolTip.add(LH.Chat.GREEN + LH.get(LH.TOOLTIP_UNBURNABLE));
            }
            if (aEvent.showAdvancedItemTooltips) {
                boolean temp = T;
                for (OreDictMaterialStack tMaterial : tData.getAllMaterialStacks()) if (tMaterial.mAmount != 0 && !tMaterial.mMaterial.contains(TD.Properties.DONT_SHOW_THIS_COMPONENT)) {
                    if (temp) {
                        aEvent.toolTip.add(LH.Chat.DCYAN + LH.get(LH.TOOLTIP_CONTAINED_MATERIALS));
                        temp = F;
                    }
                    StringBuilder tString = new StringBuilder(128);
                    double aWeight = tMaterial.weight();
                    long tWeight = ((long) (aWeight * 1000)) % 1000;
                    tString.append(LH.Chat.WHITE).append(UT.Code.displayUnits(tMaterial.mAmount)).append(" ");
                    tString.append(LH.Chat.YELLOW).append(tMaterial.mMaterial.getLocal());
                    tString.append(LH.Chat.WHITE).append(" (");
                    tString.append(LH.Chat.CYAN).append("M: ");
                    tString.append(LH.Chat.WHITE).append(tMaterial.mMaterial.mMeltingPoint);
                    tString.append(LH.Chat.RED).append("K ");
                    tString.append(LH.Chat.CYAN).append(" B: ");
                    tString.append(LH.Chat.WHITE).append(tMaterial.mMaterial.mBoilingPoint);
                    tString.append(LH.Chat.RED).append("K ");
                    tString.append(LH.Chat.CYAN).append(" W: ");
                    tString.append(LH.Chat.WHITE).append((long) aWeight).append(".").append(tWeight < 1 ? "000" : tWeight < 10 ? "00" + tWeight : tWeight < 100 ? "0" + tWeight : tWeight);
                    tString.append(LH.Chat.YELLOW).append("kg");
                    tString.append(LH.Chat.WHITE).append(")");
                    aEvent.toolTip.add(tString.toString());
                }
            } else {
                aEvent.toolTip.add(LH.Chat.DGRAY + "Enable F3+H Mode for Info about contained Materials.");
            }
            if (ST.isGT(aItem) && tData.hasValidPrefixMaterialData()) {
                if (tData.mMaterial.mMaterial.mOriginalMod == null) {
                    aEvent.toolTip.add(LH.Chat.BLUE + "Material from an Unknown Mod");
                } else if (tData.mMaterial.mMaterial.mOriginalMod == MD.MC) {
                    aEvent.toolTip.add(LH.Chat.BLUE + "Vanilla Material");
                } else if (tData.mMaterial.mMaterial.mOriginalMod == MD.GAPI) {
                    if (tData.mMaterial.mMaterial.mID > 0 && tData.mMaterial.mMaterial.mID < 8000) {
                        aEvent.toolTip.add(LH.Chat.BLUE + "Material from the Periodic Table of Elements");
                    } else {
                        aEvent.toolTip.add(LH.Chat.BLUE + "Random Material handled by Greg API");
                    }
                } else {
                    aEvent.toolTip.add(LH.Chat.BLUE + "Material from " + tData.mMaterial.mMaterial.mOriginalMod.mName);
                }
            }
        }
        // Remove all Nulls and fix eventual Formatting mistakes.
        for (int i = 1, j = aEvent.toolTip.size(); i < j; i++) {
            String tTooltip = aEvent.toolTip.get(i);
            if (tTooltip == null) {
                aEvent.toolTip.remove(i--);
                j--;
            } else
                aEvent.toolTip.set(i, tTooltip + LH.Chat.RESET_TOOLTIP);
        }
    } catch (Throwable e) {
        e.printStackTrace(ERR);
    }
}
Also used : AdvancedCrafting1ToY(gregapi.recipes.AdvancedCrafting1ToY) OreDictItemData(gregapi.oredict.OreDictItemData) MultiTileEntityBlockInternal(gregapi.block.multitileentity.MultiTileEntityBlockInternal) OreDictMaterialStack(gregapi.oredict.OreDictMaterialStack) IBlockBase(gregapi.block.IBlockBase) ArrayListNoNulls(gregapi.code.ArrayListNoNulls) AdvancedCraftingXToY(gregapi.recipes.AdvancedCraftingXToY) Item(net.minecraft.item.Item) IOreDictListenerItem(gregapi.oredict.listeners.IOreDictListenerItem) ICover(gregapi.cover.ICover) Block(net.minecraft.block.Block) RenderFallingBlock(net.minecraft.client.renderer.entity.RenderFallingBlock) ItemFluidDisplay(gregapi.item.ItemFluidDisplay) Enchantment(net.minecraft.enchantment.Enchantment) IOreDictListenerItem(gregapi.oredict.listeners.IOreDictListenerItem) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

OreDictItemData (gregapi.oredict.OreDictItemData)64 ItemStack (net.minecraft.item.ItemStack)41 OreDictMaterial (gregapi.oredict.OreDictMaterial)20 FluidStack (net.minecraftforge.fluids.FluidStack)16 ArrayListNoNulls (gregapi.code.ArrayListNoNulls)12 OreDictMaterialStack (gregapi.oredict.OreDictMaterialStack)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 Recipe (gregapi.recipes.Recipe)9 Block (net.minecraft.block.Block)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)5 List (java.util.List)5 OreDictPrefix (gregapi.oredict.OreDictPrefix)4 IOreDictListenerEvent (gregapi.oredict.event.IOreDictListenerEvent)4 OreDictListenerEvent_Names (gregapi.oredict.event.OreDictListenerEvent_Names)4 HashSetNoNulls (gregapi.code.HashSetNoNulls)3 IItemContainer (gregapi.code.IItemContainer)3 ItemStackContainer (gregapi.code.ItemStackContainer)3 PacketDeathPoint (gregapi.network.packets.PacketDeathPoint)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 Item (net.minecraft.item.Item)3