Search in sources :

Example 1 with OrePrefix

use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.

the class MaterialMetaItem method registerOreDict.

public void registerOreDict() {
    for (short metaItem : generatedItems) {
        OrePrefix prefix = this.orePrefixes[metaItem / 1000];
        Material material = Material.MATERIAL_REGISTRY.getObjectById(metaItem % 1000);
        OreDictUnifier.registerOre(new ItemStack(this, 1, metaItem), prefix, material);
    }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.type.Material) MarkerMaterial(gregtech.api.unification.material.type.MarkerMaterial) ItemStack(net.minecraft.item.ItemStack)

Example 2 with OrePrefix

use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.

the class MaterialMetaItem method addInformation.

// TODO DELETE ON RELEASE
@Override
public void addInformation(ItemStack itemStack, @Nullable World worldIn, List<String> lines, ITooltipFlag tooltipFlag) {
    if (itemStack.getMetadata() >= 32000)
        return;
    OrePrefix prefix = this.orePrefixes[itemStack.getMetadata() / 1000];
    Material material = Material.MATERIAL_REGISTRY.getObjectById(itemStack.getMetadata() % 1000);
    if (prefix != null) {
        lines.add("IconType: " + prefix.materialIconType);
    }
    if (material != null) {
        lines.add("IconSet: " + material.materialIconSet);
    }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.type.Material) MarkerMaterial(gregtech.api.unification.material.type.MarkerMaterial)

Example 3 with OrePrefix

use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.

the class ProcessingGem method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material instanceof GemMaterial) {
        GemMaterial material = (GemMaterial) entry.material;
        ItemStack stack = simpleStack.asItemStack();
        long materialAmount = entry.orePrefix.materialAmount;
        ItemStack crushedStack = OreDictUnifier.getDust(material, materialAmount);
        if (material.hasFlag(SolidMaterial.MatFlags.MORTAR_GRINDABLE)) {
            ModHandler.addShapelessRecipe("gem_t_dust_" + material, crushedStack, "m", stack);
        }
        if (!material.hasFlag(DustMaterial.MatFlags.NO_SMASHING)) {
            OrePrefix prevPrefix = GTUtility.getItem(ORDER, ORDER.indexOf(entry.orePrefix) - 1, null);
            if (prevPrefix != null) {
                ItemStack prevStack = OreDictUnifier.get(prevPrefix, material, 2);
                ModHandler.addShapelessRecipe("gem_t_gem_" + material, prevStack, "h", stack);
                RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(prevStack).duration(20).EUt(16).buildAndRegister();
            }
        }
        if (!material.hasFlag(DustMaterial.MatFlags.NO_WORKING)) {
            if (material.hasFlag(SolidMaterial.MatFlags.GENERATE_LONG_ROD) && materialAmount >= M * 2) {
                RecipeMap.LATHE_RECIPES.recipeBuilder().inputs(stack).outputs(OreDictUnifier.get(OrePrefix.stickLong, material, (int) (materialAmount / (M * 2))), OreDictUnifier.getDust(material, materialAmount % (M * 2))).duration((int) material.getMass()).EUt(16).buildAndRegister();
            } else if (materialAmount >= M) {
                RecipeMap.LATHE_RECIPES.recipeBuilder().inputs(stack).outputs(OreDictUnifier.get(OrePrefix.stick, material, (int) (materialAmount / M)), OreDictUnifier.getDust(material, materialAmount % M)).duration((int) material.getMass()).EUt(16).buildAndRegister();
            }
        }
    }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack) GemMaterial(gregtech.api.unification.material.type.GemMaterial)

Example 4 with OrePrefix

use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.

the class ModHandler method addSmeltingAndAlloySmeltingRecipe.

/**
 * Adds to Furnace AND Alloysmelter AND Induction Smelter
 */
public static void addSmeltingAndAlloySmeltingRecipe(ItemStack input, ItemStack output, boolean hidden) {
    boolean skip = false;
    if (input.isEmpty()) {
        GTLog.logger.error("Input cannot be an empty ItemStack", new IllegalArgumentException());
        skip = true;
    }
    if (output.isEmpty()) {
        GTLog.logger.error("Output cannot be an empty ItemStack", new IllegalArgumentException());
        skip = true;
    }
    if (skip)
        return;
    if (input.getCount() == 1) {
        addSmeltingRecipe(input, output);
    }
    RecipeBuilder.NotConsumableInputRecipeBuilder recipeBuilder = RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder().inputs(input).outputs(output).duration(130).EUt(3);
    OrePrefix prefix = OreDictUnifier.getPrefix(output);
    if (prefix != null) {
        switch(prefix) {
            case ingot:
                recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_INGOT);
                break;
            case block:
                recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_BLOCK);
                break;
            case nugget:
                recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_NUGGET);
                break;
        }
        if (hidden) {
            recipeBuilder.hidden();
        }
        recipeBuilder.buildAndRegister();
    }
// if (GregTechMod.gregtechproxy.mTEMachineRecipes) {
// ThermalExpansion.addInductionSmelterRecipe(input, null, output, null, output.stackSize * 1600, 0);
// }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix)

Example 5 with OrePrefix

use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.

the class MetaItem1 method onEntityItemUpdate.

@Override
public boolean onEntityItemUpdate(EntityItem itemEntity) {
    int damage = itemEntity.getItem().getMetadata();
    if (damage < this.metaItemOffset && damage >= 0 && !itemEntity.getEntityWorld().isRemote) {
        Material material = Material.MATERIAL_REGISTRY.getObjectById(damage % 1000);
        if (material != null) {
            int posX = MathHelper.floor(itemEntity.posX);
            int posY = MathHelper.floor(itemEntity.posY);
            int posZ = MathHelper.floor(itemEntity.posZ);
            OrePrefix prefix = this.orePrefixes[(damage / 1000)];
            if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure || prefix == OrePrefix.crushed || prefix == OrePrefix.dust) {
                IBlockState blockState = itemEntity.getEntityWorld().getBlockState(new BlockPos(posX, posY, posZ));
                if (blockState.getBlock() == Blocks.CAULDRON) {
                    int waterLevel = blockState.getValue(BlockCauldron.LEVEL);
                    if (waterLevel > 0) {
                        boolean waterConsumed = false;
                        if (prefix == OrePrefix.crushed) {
                            itemEntity.setItem(OreDictUnifier.get(OrePrefix.crushedPurified, material, itemEntity.getItem().getCount()));
                            waterConsumed = true;
                        } else if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure) {
                            itemEntity.setItem(OreDictUnifier.get(OrePrefix.dust, material, itemEntity.getItem().getCount()));
                            waterConsumed = true;
                        }
                        if (waterConsumed) {
                            itemEntity.getEntityWorld().setBlockState(new BlockPos(posX, posY, posZ), blockState.withProperty(BlockCauldron.LEVEL, waterLevel - 1));
                        }
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.type.Material) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

OrePrefix (gregtech.api.unification.ore.OrePrefix)11 Material (gregtech.api.unification.material.type.Material)9 MarkerMaterial (gregtech.api.unification.material.type.MarkerMaterial)5 ItemStack (net.minecraft.item.ItemStack)4 GemMaterial (gregtech.api.unification.material.type.GemMaterial)3 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 CaseFormat (com.google.common.base.CaseFormat)2 Joiner (com.google.common.base.Joiner)2 ImmutableList (com.google.common.collect.ImmutableList)2 M (gregtech.api.GTValues.M)2 DustMaterial (gregtech.api.unification.material.type.DustMaterial)2 MetalMaterial (gregtech.api.unification.material.type.MetalMaterial)2 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)2 MaterialStack (gregtech.api.unification.stack.MaterialStack)2 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)2 java.util (java.util)2 Nullable (javax.annotation.Nullable)2 MinecraftForge (net.minecraftforge.common.MinecraftForge)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2