Search in sources :

Example 16 with Material

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

the class BlockCompressedFactory method fillSample.

@Override
protected String fillSample(Block block, String blockStateSample) {
    ImmutableList<Material> allowedValues = ((BlockCompressed) block).variantProperty.getAllowedValues();
    ArrayList<String> variants = new ArrayList<>();
    for (Material material : allowedValues) {
        variants.add(VARIANT_DEFINITION.replace("$MATERIAL$", material.toString()).replace("$TEXTURE$", MaterialIconType.block.getBlockPath(material.materialIconSet).toString()));
    }
    return blockStateSample.replace("$VARIANTS$", COMMA_JOINER.join(variants));
}
Also used : ArrayList(java.util.ArrayList) Material(gregtech.api.unification.material.type.Material)

Example 17 with Material

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

the class MetaItem1 method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> lines, ITooltipFlag tooltipFlag) {
    super.addInformation(itemStack, world, lines, tooltipFlag);
    int damage = itemStack.getItemDamage();
    if (damage < this.metaItemOffset && damage >= 0) {
        Material material = Material.MATERIAL_REGISTRY.getObjectById(damage % 1000);
        if (material != null) {
            OrePrefix prefix = this.orePrefixes[(damage / 1000)];
            if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure) {
                lines.add(I18n.format("metaitem.dust.tooltip.purify"));
            }
        }
    }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.type.Material) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Material (gregtech.api.unification.material.type.Material)17 OrePrefix (gregtech.api.unification.ore.OrePrefix)11 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 DustMaterial (gregtech.api.unification.material.type.DustMaterial)5 MarkerMaterial (gregtech.api.unification.material.type.MarkerMaterial)5 java.util (java.util)4 Nullable (javax.annotation.Nullable)4 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)4 ItemStack (net.minecraft.item.ItemStack)4 GregTechAPI (gregtech.api.GregTechAPI)3 Materials (gregtech.api.unification.material.Materials)3 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)3 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)3 IBlockState (net.minecraft.block.state.IBlockState)3 CaseFormat (com.google.common.base.CaseFormat)2 Joiner (com.google.common.base.Joiner)2 ImmutableList (com.google.common.collect.ImmutableList)2 Streams (com.google.common.collect.Streams)2 M (gregtech.api.GTValues.M)2 BlockMachine (gregtech.api.block.machines.BlockMachine)2