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();
}
}
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");
}
Aggregations