use of gregtech.api.items.materialitem.MetaPrefixItem in project GregTech by GregTechCEu.
the class CommandRecipeCheck method prettyPrintItemStack.
public String prettyPrintItemStack(ItemStack stack) {
if (stack.getItem() instanceof MetaItem) {
MetaItem<?> metaItem = (MetaItem<?>) stack.getItem();
MetaValueItem metaValueItem = metaItem.getItem(stack);
if (metaValueItem == null) {
if (metaItem instanceof MetaPrefixItem) {
Material material = ((MetaPrefixItem) metaItem).getMaterial(stack);
OrePrefix orePrefix = ((MetaPrefixItem) metaItem).getOrePrefix();
return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + stack.getCount();
}
} else {
if (MetaItems.INTEGRATED_CIRCUIT.isItemEqual(stack)) {
return "Config circuit #" + IntCircuitIngredient.getCircuitConfiguration(stack);
}
return "(MetaItem) " + metaValueItem.unlocalizedName + " * " + stack.getCount();
}
} else if (stack.getItem() instanceof MachineItemBlock) {
MetaTileEntity mte = MachineItemBlock.getMetaTileEntity(stack);
if (mte != null) {
String id = mte.metaTileEntityId.toString();
if (mte.metaTileEntityId.getNamespace().equals("gregtech"))
id = mte.metaTileEntityId.getPath();
return "(MetaTileEntity) " + id + " * " + stack.getCount();
}
} else {
Block block = Block.getBlockFromItem(stack.getItem());
String id = null;
if (block instanceof BlockCompressed) {
id = "block" + ((BlockCompressed) block).getGtMaterial(stack.getMetadata()).toCamelCaseString();
} else if (block instanceof BlockFrame) {
id = "frame" + ((BlockFrame) block).getGtMaterial(stack.getMetadata()).toCamelCaseString();
} else if (block instanceof BlockMaterialPipe) {
id = ((BlockMaterialPipe<?, ?, ?>) block).getPrefix().name + ((BlockMaterialPipe<?, ?, ?>) block).getItemMaterial(stack).toCamelCaseString();
}
if (id != null) {
return "(MetaBlock) " + id + " * " + stack.getCount();
}
}
// noinspection ConstantConditions
return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + stack.getItemDamage() + ")";
}
use of gregtech.api.items.materialitem.MetaPrefixItem in project GregTech by GregTechCEu.
the class MetaItems method init.
public static void init() {
MetaItem1 first = new MetaItem1();
first.setRegistryName("meta_item_1");
MetaTool tool = new MetaTool();
tool.setRegistryName("meta_tool");
CT_OREDICT_ITEM = new MetaOreDictItem((short) 0);
CT_OREDICT_ITEM.setRegistryName("meta_oredict_item_ct");
MetaArmor armor = new MetaArmor();
armor.setRegistryName("gt_armor");
for (OrePrefix prefix : orePrefixes) {
String regName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, prefix.name());
MetaPrefixItem metaOrePrefix = new MetaPrefixItem(prefix);
metaOrePrefix.setRegistryName(String.format("meta_%s", regName));
}
}
Aggregations