Search in sources :

Example 6 with DustProperty

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

the class BlockOre method getHarvestLevel.

@Override
public int getHarvestLevel(IBlockState state) {
    StoneType stoneType = state.getValue(STONE_TYPE);
    if (material != null) {
        DustProperty matProp = material.getProperty(PropertyKey.DUST);
        if (matProp != null) {
            int toolQuality = matProp.getHarvestLevel();
            DustProperty stoneProp = stoneType.stoneMaterial.getProperty(PropertyKey.DUST);
            if (stoneProp != null) {
                return Math.max(stoneProp.getHarvestLevel(), toolQuality > 1 ? toolQuality - 1 : toolQuality);
            }
        }
    }
    return 1;
}
Also used : StoneType(gregtech.api.unification.ore.StoneType) PropertyStoneType(gregtech.common.blocks.properties.PropertyStoneType) DustProperty(gregtech.api.unification.material.properties.DustProperty)

Example 7 with DustProperty

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

the class BlockCompressed method getHarvestLevel.

@Override
public int getHarvestLevel(IBlockState state) {
    Material material = state.getValue(variantProperty);
    DustProperty prop = material.getProperty(PropertyKey.DUST);
    if (prop != null) {
        return material.getHarvestLevel();
    }
    return 0;
}
Also used : PropertyMaterial(gregtech.common.blocks.properties.PropertyMaterial) 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