Search in sources :

Example 31 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ToolRecipeHandler method processScrewdriverHead.

public static void processScrewdriverHead(OrePrefix toolPrefix, Material material) {
    if (!(material instanceof SolidMaterial))
        return;
    SolidMaterial solidMaterial = (SolidMaterial) material;
    processSimpleElectricToolHead(toolPrefix, solidMaterial, new MetaToolValueItem[] { MetaItems.SCREWDRIVER_LV });
    ModHandler.addShapedRecipe(String.format("screwdriver_head_%s", solidMaterial.toString()), OreDictUnifier.get(OrePrefix.toolHeadScrewdriver, solidMaterial), "fX", "Xh", 'X', new UnificationEntry(OrePrefix.stick, solidMaterial));
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry)

Example 32 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ToolRecipeHandler method processStick.

public static void processStick(OrePrefix stickPrefix, SolidMaterial material) {
    if (material.hasFlag(DustMaterial.MatFlags.NO_SMASHING)) {
        return;
    }
    if (material instanceof IngotMaterial && material.toolDurability > 0) {
        ModHandler.addShapedRecipe(String.format("plunger_%s", material), MetaItems.PLUNGER.getStackForm(material), "xRR", " SR", "S f", 'S', new UnificationEntry(OrePrefix.stick, material), 'R', new UnificationEntry(OrePrefix.plate, Materials.Rubber));
    }
    SolidMaterial handleMaterial = Materials.Wood;
    if (material.hasFlag(GENERATE_ROD) && material.toolDurability > 0) {
        ModHandler.addShapedRecipe(String.format("screwdriver_%s_%s", material.toString(), handleMaterial.toString()), MetaItems.SCREWDRIVER.getStackForm(material), " fS", " Sh", "W  ", 'S', new UnificationEntry(OrePrefix.stick, material), 'W', new UnificationEntry(OrePrefix.stick, handleMaterial));
        ModHandler.addShapedRecipe(String.format("crowbar_%s", material), MetaItems.CROWBAR.getStackForm(material), "hDS", "DSD", "SDf", 'S', new UnificationEntry(OrePrefix.stick, material), 'D', new UnificationEntry(OrePrefix.dye, MarkerMaterials.Color.COLORS.get(EnumDyeColor.BLUE)));
        ModHandler.addShapedRecipe(String.format("scoop_%s", material.toString()), MetaItems.SCOOP.getStackForm(material), "SWS", "SSS", "xSh", 'S', new UnificationEntry(OrePrefix.stick, material), 'W', new ItemStack(Blocks.WOOL, 1, GTValues.W));
    }
    if (material.hasFlag(GENERATE_PLATE) && material.toolDurability > 0) {
        ModHandler.addShapedRecipe(String.format("knife_%s", material.toString()), MetaItems.KNIFE.getStackForm(material), "fPh", " S ", 'S', new UnificationEntry(stickPrefix, material), 'P', new UnificationEntry(OrePrefix.plate, material));
    }
    if (material.hasFlag(GENERATE_PLATE | GENERATE_ROD) && material.toolDurability > 0) {
        ModHandler.addShapedRecipe(String.format("butchery_knife_%s", material.toString()), MetaItems.BUTCHERY_KNIFE.getStackForm(material), "PPf", "PP ", "Sh ", 'S', new UnificationEntry(OrePrefix.stick, material), 'P', new UnificationEntry(OrePrefix.plate, material));
    }
    if (material.hasFlag(GENERATE_PLATE | GENERATE_ROD | GENERATE_BOLT_SCREW) && material.toolDurability > 0) {
        ModHandler.addShapedRecipe(String.format("wire_cutter_%s", material.toString()), MetaItems.WIRE_CUTTER.getStackForm(material), "PfP", "hPd", "STS", 'S', new UnificationEntry(stickPrefix, material), 'P', new UnificationEntry(OrePrefix.plate, material), 'T', new UnificationEntry(OrePrefix.screw, material));
        ModHandler.addShapedRecipe(String.format("branch_cutter_%s", material.toString()), MetaItems.BRANCH_CUTTER.getStackForm(material), "PfP", "PdP", "STS", 'S', new UnificationEntry(stickPrefix, material), 'P', new UnificationEntry(OrePrefix.plate, material), 'T', new UnificationEntry(OrePrefix.screw, material));
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 33 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ToolRecipeHandler method processFileHead.

public static void processFileHead(OrePrefix toolPrefix, SolidMaterial solidMaterial) {
    processSimpleToolHead(toolPrefix, solidMaterial, MetaItems.FILE, " I ", " I ", " fh");
    if (solidMaterial instanceof IngotMaterial) {
        SolidMaterial handleMaterial = Materials.Wood;
        ModHandler.addShapedRecipe(String.format("file_%s", solidMaterial), MetaItems.FILE.getStackForm(solidMaterial), "P", "P", "S", 'P', new UnificationEntry(OrePrefix.plate, solidMaterial), 'S', new UnificationEntry(OrePrefix.stick, handleMaterial));
    }
    int voltageMultiplier = getVoltageMultiplier(solidMaterial);
    RecipeMaps.EXTRUDER_RECIPES.recipeBuilder().input(OrePrefix.ingot, solidMaterial, 2).notConsumable(MetaItems.SHAPE_EXTRUDER_FILE).outputs(OreDictUnifier.get(toolPrefix, solidMaterial)).duration((int) solidMaterial.getAverageMass() * 2).EUt(8 * voltageMultiplier).buildAndRegister();
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry)

Example 34 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class SurfaceRockPopulator method findUndergroundMaterials.

private Set<Material> findUndergroundMaterials(Collection<IBlockState> generatedBlocks) {
    HashSet<Material> result = new HashSet<>();
    for (IBlockState blockState : generatedBlocks) {
        Material resultMaterial;
        if (blockState.getBlock() instanceof IFluidBlock || blockState.getBlock() instanceof BlockLiquid) {
            Fluid fluid = FluidRegistry.lookupFluidForBlock(blockState.getBlock());
            resultMaterial = fluid == null ? null : MetaFluids.getMaterialFromFluid(fluid);
        } else {
            ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().damageDropped(blockState));
            UnificationEntry entry = OreDictUnifier.getUnificationEntry(itemStack);
            resultMaterial = entry == null ? null : entry.material;
        }
        if (resultMaterial != null) {
            result.add(resultMaterial);
        }
    }
    return result;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockLiquid(net.minecraft.block.BlockLiquid) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Fluid(net.minecraftforge.fluids.Fluid) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Material(gregtech.api.unification.material.type.Material) ItemStack(net.minecraft.item.ItemStack)

Example 35 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ClientProxy method addMaterialFormulaHandler.

@SubscribeEvent
public static void addMaterialFormulaHandler(ItemTooltipEvent event) {
    ItemStack itemStack = event.getItemStack();
    // Handles Item tooltips
    if (!(itemStack.getItem() instanceof ItemBlock)) {
        String chemicalFormula = null;
        // Test for Items
        UnificationEntry unificationEntry = OreDictUnifier.getUnificationEntry(itemStack);
        if (unificationEntry != null && unificationEntry.material != null) {
            chemicalFormula = unificationEntry.material.chemicalFormula;
        // Test for Fluids
        } else if (ItemNBTUtils.hasTag(itemStack)) {
            // Vanilla bucket
            chemicalFormula = FluidTooltipUtil.getFluidTooltip(ItemNBTUtils.getString(itemStack, "FluidName"));
            // GTCE Cells, Forestry cans, some other containers
            if (chemicalFormula == null) {
                NBTTagCompound compound = itemStack.getTagCompound();
                if (compound != null && compound.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) {
                    chemicalFormula = FluidTooltipUtil.getFluidTooltip(FluidStack.loadFluidStackFromNBT(compound.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)));
                }
            }
        // Water buckets have a separate registry name from other buckets
        } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) {
            chemicalFormula = FluidTooltipUtil.getWaterTooltip();
        }
        if (chemicalFormula != null && !chemicalFormula.isEmpty())
            event.getToolTip().add(1, ChatFormatting.GRAY.toString() + chemicalFormula);
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) FluidHandlerItemStack(net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack) ItemStack(net.minecraft.item.ItemStack) ItemBlock(net.minecraft.item.ItemBlock) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

UnificationEntry (gregtech.api.unification.stack.UnificationEntry)65 ItemStack (net.minecraft.item.ItemStack)50 OrePrefix (gregtech.api.unification.ore.OrePrefix)11 Material (gregtech.api.unification.material.type.Material)10 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)10 MaterialStack (gregtech.api.unification.stack.MaterialStack)8 IntCircuitIngredient (gregtech.api.recipes.ingredients.IntCircuitIngredient)6 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)6 MetaValueItem (gregtech.api.items.metaitem.MetaItem.MetaValueItem)5 CountableIngredient (gregtech.api.recipes.CountableIngredient)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)4 Nullable (javax.annotation.Nullable)4 CaseFormat (com.google.common.base.CaseFormat)3 Joiner (com.google.common.base.Joiner)3 ImmutableList (com.google.common.collect.ImmutableList)3 GTValues (gregtech.api.GTValues)3 M (gregtech.api.GTValues.M)3 ToolMetaItem (gregtech.api.items.toolitem.ToolMetaItem)3 ModHandler (gregtech.api.recipes.ModHandler)3