Search in sources :

Example 1 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class MetaFluids method init.

public static void init() {
    fluidSprites.add(AUTO_GENERATED_PLASMA_TEXTURE);
    registerIconFluidSprites();
    // handle vanilla fluids
    handleNonMaterialFluids(Materials.Water, FluidRegistry.WATER);
    handleNonMaterialFluids(Materials.Lava, FluidRegistry.LAVA);
    // alternative names for forestry fluids
    addAlternativeNames();
    // set custom textures for fluids
    setCustomTextures();
    for (Material material : GregTechAPI.MATERIAL_REGISTRY) {
        FluidProperty fluidProperty = material.getProperty(PropertyKey.FLUID);
        if (fluidProperty != null && fluidProperty.getFluid() == null) {
            int temperature = Math.max(material.getBlastTemperature(), fluidProperty.getFluidTemperature());
            Fluid fluid = registerFluid(material, fluidProperty.getFluidType(), temperature, fluidProperty.hasBlock());
            fluidProperty.setFluid(fluid);
            fluidProperty.setFluidTemperature(fluid.getTemperature(), fluid.getTemperature() >= 0);
        }
        PlasmaProperty plasmaProperty = material.getProperty(PropertyKey.PLASMA);
        if (plasmaProperty != null && plasmaProperty.getPlasma() == null) {
            int temperature = (fluidProperty == null ? 0 : fluidProperty.getFluidTemperature()) + 30000;
            Fluid fluid = registerFluid(material, FluidTypes.PLASMA, temperature, false);
            plasmaProperty.setPlasma(fluid);
        }
    }
}
Also used : FluidProperty(gregtech.api.unification.material.properties.FluidProperty) Fluid(net.minecraftforge.fluids.Fluid) Material(gregtech.api.unification.material.Material) PlasmaProperty(gregtech.api.unification.material.properties.PlasmaProperty)

Example 2 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class MetaPrefixItem method isBeaconPayment.

@Override
public boolean isBeaconPayment(ItemStack stack) {
    int damage = stack.getMetadata();
    Material material = GregTechAPI.MATERIAL_REGISTRY.getObjectById(damage);
    if (this.prefix != null && material != null) {
        boolean isSolidState = this.prefix == OrePrefix.ingot || this.prefix == OrePrefix.gem;
        DustProperty property = material.getProperty(PropertyKey.DUST);
        boolean isMaterialTiered = property != null && property.getHarvestLevel() >= 2;
        return isSolidState && isMaterialTiered;
    }
    return false;
}
Also used : Material(gregtech.api.unification.material.Material) DustProperty(gregtech.api.unification.material.properties.DustProperty)

Example 3 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class MetaPrefixItem method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List<String> lines, @Nonnull ITooltipFlag tooltipFlag) {
    super.addInformation(itemStack, worldIn, lines, tooltipFlag);
    int damage = itemStack.getItemDamage();
    Material material = GregTechAPI.MATERIAL_REGISTRY.getObjectById(damage);
    if (prefix == null || material == null)
        return;
    addMaterialTooltip(lines, itemStack);
}
Also used : Material(gregtech.api.unification.material.Material) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class MetaPrefixItem method getItemBurnTime.

@Override
public int getItemBurnTime(@Nonnull ItemStack itemStack) {
    int damage = itemStack.getItemDamage();
    Material material = GregTechAPI.MATERIAL_REGISTRY.getObjectById(damage);
    DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST);
    if (property != null)
        return (int) (property.getBurnTime() * prefix.getMaterialAmount(material) / GTValues.M);
    return super.getItemBurnTime(itemStack);
}
Also used : Material(gregtech.api.unification.material.Material) DustProperty(gregtech.api.unification.material.properties.DustProperty)

Example 5 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class ToolMetaItem method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List<String> lines, @Nonnull ITooltipFlag tooltipFlag) {
    T item = getItem(itemStack);
    if (item == null) {
        return;
    }
    IToolStats toolStats = item.getToolStats();
    Material primaryMaterial = getToolMaterial(itemStack);
    int maxInternalDamage = getMaxItemDamage(itemStack);
    if (toolStats.isUsingDurability(itemStack) && maxInternalDamage > 0) {
        lines.add(I18n.format("metaitem.tool.tooltip.durability", maxInternalDamage - getItemDamage(itemStack), maxInternalDamage));
    }
    lines.add(I18n.format("metaitem.tool.tooltip.primary_material", primaryMaterial.getLocalizedName(), getHarvestLevel(itemStack)));
    lines.add(I18n.format("metaitem.tool.tooltip.attack_damage", toolStats.getBaseDamage(itemStack) + primaryMaterial.getHarvestLevel()));
    lines.add(I18n.format("metaitem.tool.tooltip.mining_speed", getToolDigSpeed(itemStack)));
    super.addInformation(itemStack, worldIn, lines, tooltipFlag);
    toolStats.addInformation(itemStack, lines, tooltipFlag.isAdvanced());
}
Also used : Material(gregtech.api.unification.material.Material) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Material (gregtech.api.unification.material.Material)76 ItemStack (net.minecraft.item.ItemStack)31 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)19 OrePrefix (gregtech.api.unification.ore.OrePrefix)13 MaterialStack (gregtech.api.unification.stack.MaterialStack)12 Nonnull (javax.annotation.Nonnull)10 PropertyKey (gregtech.api.unification.material.properties.PropertyKey)9 Block (net.minecraft.block.Block)8 IBlockState (net.minecraft.block.state.IBlockState)8 GTValues (gregtech.api.GTValues)7 Collectors (java.util.stream.Collectors)7 Nullable (javax.annotation.Nullable)7 Materials (gregtech.api.unification.material.Materials)6 DustProperty (gregtech.api.unification.material.properties.DustProperty)6 ToolProperty (gregtech.api.unification.material.properties.ToolProperty)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)6 GregTechAPI (gregtech.api.GregTechAPI)5 OreDictUnifier (gregtech.api.unification.OreDictUnifier)5 MarkerMaterial (gregtech.api.unification.material.MarkerMaterial)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)5