Search in sources :

Example 1 with DustProperty

use of gregtech.api.unification.material.properties.DustProperty in project gregicality-science by GregTechCEu.

the class GCYSPropertyAddition method init.

public static void init() {
    // Dusts
    Praseodymium.setProperty(PropertyKey.DUST, new DustProperty());
    Scandium.setProperty(PropertyKey.DUST, new DustProperty());
    Gadolinium.setProperty(PropertyKey.DUST, new DustProperty());
    Terbium.setProperty(PropertyKey.DUST, new DustProperty());
    Dysprosium.setProperty(PropertyKey.DUST, new DustProperty());
    Holmium.setProperty(PropertyKey.DUST, new DustProperty());
    Erbium.setProperty(PropertyKey.DUST, new DustProperty());
    Thulium.setProperty(PropertyKey.DUST, new DustProperty());
    Ytterbium.setProperty(PropertyKey.DUST, new DustProperty());
    RhodiumSulfate.setProperty(PropertyKey.DUST, new DustProperty());
    RhodiumSulfate.setMaterialIconSet(MaterialIconSet.ROUGH);
    Zirconium.setProperty(PropertyKey.DUST, new DustProperty());
}
Also used : DustProperty(gregtech.api.unification.material.properties.DustProperty)

Example 2 with DustProperty

use of gregtech.api.unification.material.properties.DustProperty 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 DustProperty

use of gregtech.api.unification.material.properties.DustProperty 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 4 with DustProperty

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

the class CommonProxy method modifyFuelBurnTime.

@SubscribeEvent
public static void modifyFuelBurnTime(FurnaceFuelBurnTimeEvent event) {
    ItemStack stack = event.getItemStack();
    Block block = Block.getBlockFromItem(stack.getItem());
    // handle sapling and log burn rates
    if (block == RUBBER_LOG || block == PLANKS) {
        event.setBurnTime(300);
    } else if (block == RUBBER_SAPLING) {
        event.setBurnTime(100);
    }
    // handle material blocks burn value
    if (stack.getItem() instanceof CompressedItemBlock) {
        CompressedItemBlock itemBlock = (CompressedItemBlock) stack.getItem();
        Material material = itemBlock.getBlockState(stack).getValue(itemBlock.compressedBlock.variantProperty);
        DustProperty property = material.getProperty(PropertyKey.DUST);
        if (property != null && property.getBurnTime() > 0) {
            // compute burn value for block prefix, taking amount of material in block into account
            double materialUnitsInBlock = OrePrefix.block.getMaterialAmount(material) / (GTValues.M * 1.0);
            event.setBurnTime((int) (materialUnitsInBlock * property.getBurnTime()));
        }
    }
}
Also used : Block(net.minecraft.block.Block) MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) ItemBlock(net.minecraft.item.ItemBlock) Material(gregtech.api.unification.material.Material) DustProperty(gregtech.api.unification.material.properties.DustProperty) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with DustProperty

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

the class ToolMetaItem method getHarvestLevel.

public int getHarvestLevel(ItemStack itemStack) {
    T metaToolValueItem = getItem(itemStack);
    if (metaToolValueItem != null) {
        NBTTagCompound toolTag = getToolStatsTag(itemStack);
        Material toolMaterial = getToolMaterial(itemStack);
        IToolStats toolStats = metaToolValueItem.getToolStats();
        int harvestLevel = 0;
        if (toolTag != null && toolTag.hasKey("HarvestLevel")) {
            harvestLevel = toolTag.getInteger("HarvestLevel");
        } else if (toolMaterial != null) {
            DustProperty prop = toolMaterial.getProperty(PropertyKey.DUST);
            if (prop != null)
                harvestLevel = prop.getHarvestLevel();
            else
                return 0;
        }
        int baseHarvestLevel = toolStats.getBaseQuality(itemStack);
        return baseHarvestLevel + harvestLevel;
    }
    return 0;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Material(gregtech.api.unification.material.Material) DustProperty(gregtech.api.unification.material.properties.DustProperty)

Aggregations

DustProperty (gregtech.api.unification.material.properties.DustProperty)7 Material (gregtech.api.unification.material.Material)5 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)1 StoneType (gregtech.api.unification.ore.StoneType)1 PropertyMaterial (gregtech.common.blocks.properties.PropertyMaterial)1 PropertyStoneType (gregtech.common.blocks.properties.PropertyStoneType)1 Block (net.minecraft.block.Block)1 ItemBlock (net.minecraft.item.ItemBlock)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1