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));
}
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));
}
}
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();
}
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;
}
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);
}
}
Aggregations