Search in sources :

Example 1 with BlockMaterialPipe

use of gregtech.api.pipenet.block.material.BlockMaterialPipe in project GregTech by GregTechCEu.

the class ItemBlockCable method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) {
    WireProperties wireProperties = blockPipe.createItemProperties(stack);
    int tier = GTUtility.getTierByVoltage(wireProperties.getVoltage());
    if (wireProperties.isSuperconductor())
        tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier]));
    tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.getVoltage(), GTValues.VNF[tier]));
    tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.getAmperage()));
    tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.getLossPerBlock()));
    if (flagIn.isAdvanced()) {
        tooltip.add("MetaItem Id: " + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getPrefix().name + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getItemMaterial(stack).toCamelCaseString());
    }
}
Also used : BlockMaterialPipe(gregtech.api.pipenet.block.material.BlockMaterialPipe) ItemBlockMaterialPipe(gregtech.api.pipenet.block.material.ItemBlockMaterialPipe) WireProperties(gregtech.api.unification.material.properties.WireProperties) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with BlockMaterialPipe

use of gregtech.api.pipenet.block.material.BlockMaterialPipe 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() + ")";
}
Also used : MetaValueItem(gregtech.api.items.metaitem.MetaItem.MetaValueItem) MetaItem(gregtech.api.items.metaitem.MetaItem) BlockCompressed(gregtech.common.blocks.BlockCompressed) OrePrefix(gregtech.api.unification.ore.OrePrefix) MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) Material(gregtech.api.unification.material.Material) BlockMaterialPipe(gregtech.api.pipenet.block.material.BlockMaterialPipe) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) Block(net.minecraft.block.Block) MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) MetaPrefixItem(gregtech.api.items.materialitem.MetaPrefixItem) BlockFrame(gregtech.common.blocks.BlockFrame)

Example 3 with BlockMaterialPipe

use of gregtech.api.pipenet.block.material.BlockMaterialPipe in project GregTech by GregTechCEu.

the class PipeRenderer method renderItem.

@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
    ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
    if (!(stack.getItem() instanceof ItemBlockPipe)) {
        return;
    }
    CCRenderState renderState = CCRenderState.instance();
    GlStateManager.enableBlend();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    BlockPipe<?, ?, ?> blockFluidPipe = (BlockPipe<?, ?, ?>) ((ItemBlockPipe<?, ?>) stack.getItem()).getBlock();
    IPipeType<?> pipeType = blockFluidPipe.getItemPipeType(stack);
    Material material = blockFluidPipe instanceof BlockMaterialPipe ? ((BlockMaterialPipe<?, ?, ?>) blockFluidPipe).getItemMaterial(stack) : null;
    if (pipeType != null) {
        // 12 == 0b1100 is North and South connection (index 2 & 3)
        PipeRenderContext renderContext = new PipeRenderContext(12, 0, pipeType.getThickness());
        renderContext.color = GTUtility.convertRGBtoOpaqueRGBA_CL(getPipeColor(material, -1));
        buildRenderer(renderContext, blockFluidPipe, null, pipeType, material);
        renderPipeBlock(renderState, renderContext);
    }
    renderState.draw();
    GlStateManager.disableBlend();
}
Also used : BlockMaterialPipe(gregtech.api.pipenet.block.material.BlockMaterialPipe) ItemBlockPipe(gregtech.api.pipenet.block.ItemBlockPipe) Material(gregtech.api.unification.material.Material) BlockPipe(gregtech.api.pipenet.block.BlockPipe) ItemBlockPipe(gregtech.api.pipenet.block.ItemBlockPipe) ItemStack(net.minecraft.item.ItemStack) CCRenderState(codechicken.lib.render.CCRenderState)

Example 4 with BlockMaterialPipe

use of gregtech.api.pipenet.block.material.BlockMaterialPipe in project GregTech by GregTechCEu.

the class ItemBlockItemPipe method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) {
    ItemPipeProperties pipeProperties = blockPipe.createItemProperties(stack);
    if (pipeProperties.getTransferRate() % 1 != 0)
        tooltip.add(I18n.format("gregtech.item_pipe.rate_items", (int) ((pipeProperties.getTransferRate() * 64) + 0.5)));
    else
        tooltip.add(I18n.format("gregtech.item_pipe.rate_stacks", (int) pipeProperties.getTransferRate()));
    tooltip.add(I18n.format("gregtech.item_pipe.priority", pipeProperties.getPriority()));
    if (flagIn.isAdvanced()) {
        tooltip.add("MetaItem Id: " + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getPrefix().name + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getItemMaterial(stack).toCamelCaseString());
    }
}
Also used : BlockMaterialPipe(gregtech.api.pipenet.block.material.BlockMaterialPipe) ItemBlockMaterialPipe(gregtech.api.pipenet.block.material.ItemBlockMaterialPipe) ItemPipeProperties(gregtech.api.unification.material.properties.ItemPipeProperties) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with BlockMaterialPipe

use of gregtech.api.pipenet.block.material.BlockMaterialPipe in project GregTech by GregTechCEu.

the class ItemBlockFluidPipe method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, List<String> tooltip, @Nonnull ITooltipFlag flagIn) {
    FluidPipeProperties pipeProperties = blockPipe.createItemProperties(stack);
    tooltip.add(I18n.format("gregtech.fluid_pipe.throughput", pipeProperties.getThroughput() * 20));
    tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", pipeProperties.getMaxFluidTemperature()));
    if (!pipeProperties.isGasProof())
        tooltip.add(I18n.format("gregtech.fluid_pipe.non_gas_proof"));
    if (pipeProperties.getTanks() > 1)
        tooltip.add(I18n.format("gregtech.fluid_pipe.channels", pipeProperties.getTanks()));
    if (flagIn.isAdvanced()) {
        tooltip.add("MetaItem Id: " + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getPrefix().name + ((BlockMaterialPipe<?, ?, ?>) blockPipe).getItemMaterial(stack).toCamelCaseString());
    }
}
Also used : BlockMaterialPipe(gregtech.api.pipenet.block.material.BlockMaterialPipe) ItemBlockMaterialPipe(gregtech.api.pipenet.block.material.ItemBlockMaterialPipe) FluidPipeProperties(gregtech.api.unification.material.properties.FluidPipeProperties) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BlockMaterialPipe (gregtech.api.pipenet.block.material.BlockMaterialPipe)5 ItemBlockMaterialPipe (gregtech.api.pipenet.block.material.ItemBlockMaterialPipe)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 Material (gregtech.api.unification.material.Material)2 CCRenderState (codechicken.lib.render.CCRenderState)1 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)1 MetaPrefixItem (gregtech.api.items.materialitem.MetaPrefixItem)1 MetaItem (gregtech.api.items.metaitem.MetaItem)1 MetaValueItem (gregtech.api.items.metaitem.MetaItem.MetaValueItem)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 BlockPipe (gregtech.api.pipenet.block.BlockPipe)1 ItemBlockPipe (gregtech.api.pipenet.block.ItemBlockPipe)1 FluidPipeProperties (gregtech.api.unification.material.properties.FluidPipeProperties)1 ItemPipeProperties (gregtech.api.unification.material.properties.ItemPipeProperties)1 WireProperties (gregtech.api.unification.material.properties.WireProperties)1 OrePrefix (gregtech.api.unification.ore.OrePrefix)1 BlockCompressed (gregtech.common.blocks.BlockCompressed)1 BlockFrame (gregtech.common.blocks.BlockFrame)1 Block (net.minecraft.block.Block)1 ItemStack (net.minecraft.item.ItemStack)1