Search in sources :

Example 1 with NetworkMonitorItem

use of mcjty.rftools.items.netmonitor.NetworkMonitorItem in project RFTools by McJty.

the class RenderWorldLastEventHandler method renderPower.

private static void renderPower(RenderWorldLastEvent evt) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    ItemStack mainItem = player.getHeldItemMainhand();
    ItemStack offItem = player.getHeldItemOffhand();
    if ((!mainItem.isEmpty() && mainItem.getItem() instanceof NetworkMonitorItem) || (!offItem.isEmpty() && offItem.getItem() instanceof NetworkMonitorItem)) {
        double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
        double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
        double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();
        GlStateManager.pushMatrix();
        GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
        GlStateManager.disableDepth();
        GlStateManager.enableTexture2D();
        if (System.currentTimeMillis() - lastTime > 500) {
            lastTime = System.currentTimeMillis();
            RFToolsMessages.sendToServer(CommandHandler.CMD_GET_RF_IN_RANGE);
        }
        if (PacketReturnRfInRange.clientLevels == null) {
            return;
        }
        for (Map.Entry<BlockPos, MachineInfo> entry : PacketReturnRfInRange.clientLevels.entrySet()) {
            BlockPos pos = entry.getKey();
            List<String> log = new ArrayList<>();
            MachineInfo info = entry.getValue();
            log.add(TextFormatting.BLUE + "RF:  " + TextFormatting.WHITE + info.getEnergy());
            log.add(TextFormatting.BLUE + "Max: " + TextFormatting.WHITE + info.getMaxEnergy());
            if (info.getEnergyPerTick() != null) {
                TileEntity te = player.getEntityWorld().getTileEntity(pos);
                String unit = "";
                if (te instanceof IMachineInformation) {
                    unit = ((IMachineInformation) te).getEnergyUnitName();
                    if (unit == null) {
                        unit = "";
                    }
                }
                int usage = info.getEnergyPerTick();
                if (usage < 0) {
                    log.add(TextFormatting.RED + "" + usage + unit + "/t");
                } else if (usage > 0) {
                    log.add(TextFormatting.GREEN + "" + usage + unit + "/t");
                }
            }
            HudRenderHelper.renderHud(log, HudRenderHelper.HudPlacement.HUD_CENTER, HudRenderHelper.HudOrientation.HUD_TOPLAYER, null, pos.getX(), pos.getY(), pos.getZ(), 2.0f);
            renderBoxOutline(pos);
        }
        GlStateManager.enableDepth();
        GlStateManager.popMatrix();
    }
}
Also used : NetworkMonitorItem(mcjty.rftools.items.netmonitor.NetworkMonitorItem) BlockProtectorTileEntity(mcjty.rftools.blocks.blockprotector.BlockProtectorTileEntity) BuilderTileEntity(mcjty.rftools.blocks.builder.BuilderTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) MachineInfo(mcjty.rftools.network.MachineInfo) IMachineInformation(mcjty.lib.api.information.IMachineInformation) BlockPos(net.minecraft.util.math.BlockPos) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ItemStack(net.minecraft.item.ItemStack)

Example 2 with NetworkMonitorItem

use of mcjty.rftools.items.netmonitor.NetworkMonitorItem in project RFTools by McJty.

the class ModItems method setupVariousItems.

private static void setupVariousItems() {
    shapeCardItem = new ShapeCardItem();
    shapeCardItem.setUnlocalizedName("ShapeCard");
    shapeCardItem.setCreativeTab(RFTools.tabRfTools);
    shapeCardItem.setTextureName(RFTools.MODID + ":shapeCardItem");
    GameRegistry.registerItem(shapeCardItem, "shapeCardItem");
    smartWrenchItem = new SmartWrenchItem();
    smartWrenchItem.setUnlocalizedName("SmartWrench");
    smartWrenchItem.setCreativeTab(RFTools.tabRfTools);
    smartWrenchItem.setTextureName(RFTools.MODID + ":smartWrenchItem");
    GameRegistry.registerItem(smartWrenchItem, "smartWrenchItem");
    networkMonitorItem = new NetworkMonitorItem();
    networkMonitorItem.setUnlocalizedName("NetworkMonitor");
    networkMonitorItem.setCreativeTab(RFTools.tabRfTools);
    networkMonitorItem.setTextureName(RFTools.MODID + ":networkMonitorItem");
    GameRegistry.registerItem(networkMonitorItem, "networkMonitorItem");
    rfToolsManualItem = new RFToolsManualItem();
    rfToolsManualItem.setUnlocalizedName("RFToolsManual");
    rfToolsManualItem.setCreativeTab(RFTools.tabRfTools);
    rfToolsManualItem.setTextureName(RFTools.MODID + ":rftoolsManual");
    GameRegistry.registerItem(rfToolsManualItem, "rfToolsManualItem");
    rfToolsManualDimensionItem = new RFToolsManualDimensionItem();
    rfToolsManualDimensionItem.setUnlocalizedName("RFToolsManualDimension");
    rfToolsManualDimensionItem.setCreativeTab(RFTools.tabRfTools);
    rfToolsManualDimensionItem.setTextureName(RFTools.MODID + ":rftoolsManualDimension");
    GameRegistry.registerItem(rfToolsManualDimensionItem, "rfToolsManualDimensionItem");
    developersDelightItem = new DevelopersDelightItem();
    developersDelightItem.setUnlocalizedName("DevelopersDelight");
    developersDelightItem.setCreativeTab(RFTools.tabRfTools);
    developersDelightItem.setTextureName(RFTools.MODID + ":developersDelightItem");
    GameRegistry.registerItem(developersDelightItem, "developersDelightItem");
    shardWandItem = new ShardWandItem();
    shardWandItem.setUnlocalizedName("ShardWand");
    shardWandItem.setCreativeTab(RFTools.tabRfTools);
    shardWandItem.setTextureName(RFTools.MODID + ":shardWandItem");
    GameRegistry.registerItem(shardWandItem, "shardWandItem");
}
Also used : ShapeCardItem(mcjty.rftools.items.shapecard.ShapeCardItem) NetworkMonitorItem(mcjty.rftools.items.netmonitor.NetworkMonitorItem) SmartWrenchItem(mcjty.rftools.items.smartwrench.SmartWrenchItem) RFToolsManualDimensionItem(mcjty.rftools.items.manual.RFToolsManualDimensionItem) ShardWandItem(mcjty.rftools.items.devdelight.ShardWandItem) RFToolsManualItem(mcjty.rftools.items.manual.RFToolsManualItem) DevelopersDelightItem(mcjty.rftools.items.devdelight.DevelopersDelightItem)

Aggregations

NetworkMonitorItem (mcjty.rftools.items.netmonitor.NetworkMonitorItem)2 IMachineInformation (mcjty.lib.api.information.IMachineInformation)1 BlockProtectorTileEntity (mcjty.rftools.blocks.blockprotector.BlockProtectorTileEntity)1 BuilderTileEntity (mcjty.rftools.blocks.builder.BuilderTileEntity)1 DevelopersDelightItem (mcjty.rftools.items.devdelight.DevelopersDelightItem)1 ShardWandItem (mcjty.rftools.items.devdelight.ShardWandItem)1 RFToolsManualDimensionItem (mcjty.rftools.items.manual.RFToolsManualDimensionItem)1 RFToolsManualItem (mcjty.rftools.items.manual.RFToolsManualItem)1 ShapeCardItem (mcjty.rftools.items.shapecard.ShapeCardItem)1 SmartWrenchItem (mcjty.rftools.items.smartwrench.SmartWrenchItem)1 MachineInfo (mcjty.rftools.network.MachineInfo)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1