use of mcjty.lib.network.clientinfo.PacketGetInfoFromServer in project RFTools by McJty.
the class PowerCellBlock method getWailaBody.
@Override
@SideOnly(Side.CLIENT)
@Optional.Method(modid = "waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
TileEntity tileEntity = accessor.getTileEntity();
if (tileEntity instanceof PowerCellTileEntity) {
PowerCellTileEntity powerCellTileEntity = (PowerCellTileEntity) tileEntity;
int id = powerCellTileEntity.getNetworkId();
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
if (id != -1) {
currenttip.add(TextFormatting.GREEN + "ID: " + new DecimalFormat("#.##").format(id));
} else {
currenttip.add(TextFormatting.GREEN + "Local storage!");
}
}
if (System.currentTimeMillis() - lastTime > 250) {
lastTime = System.currentTimeMillis();
RFToolsMessages.INSTANCE.sendToServer(new PacketGetInfoFromServer(RFTools.MODID, new PowerCellInfoPacketServer(powerCellTileEntity)));
}
long total = (PowerCellInfoPacketClient.tooltipBlocks - PowerCellInfoPacketClient.tooltipAdvancedBlocks - (long) PowerCellInfoPacketClient.tooltipSimpleBlocks) * PowerCellConfiguration.rfPerNormalCell;
total += (long) PowerCellInfoPacketClient.tooltipAdvancedBlocks * PowerCellConfiguration.rfPerNormalCell * advancedFactor;
total += (long) PowerCellInfoPacketClient.tooltipSimpleBlocks * PowerCellConfiguration.rfPerNormalCell / PowerCellConfiguration.simpleFactor;
if (total > Integer.MAX_VALUE) {
total = Integer.MAX_VALUE;
}
currenttip.add(TextFormatting.GREEN + "Energy: " + PowerCellInfoPacketClient.tooltipEnergy + "/" + total + " RF (" + PowerCellInfoPacketClient.tooltipRfPerTick + " RF/t)");
PowerCellTileEntity.Mode mode = powerCellTileEntity.getMode(accessor.getSide());
if (mode == PowerCellTileEntity.Mode.MODE_INPUT) {
currenttip.add(TextFormatting.YELLOW + "Side: input");
} else if (mode == PowerCellTileEntity.Mode.MODE_OUTPUT) {
int cost = (int) ((PowerCellInfoPacketClient.tooltipCostFactor - 1.0f) * 1000.0f);
currenttip.add(TextFormatting.YELLOW + "Side: output (cost " + cost / 10 + "." + cost % 10 + "%)");
}
}
return currenttip;
}
use of mcjty.lib.network.clientinfo.PacketGetInfoFromServer in project RFTools by McJty.
the class ScreenBlock method getWailaBodyScreen.
@SideOnly(Side.CLIENT)
@Optional.Method(modid = "waila")
public List<String> getWailaBodyScreen(List<String> currenttip, EntityPlayer player, ScreenTileEntity te) {
if (!te.isConnected() && te.isControllerNeeded()) {
currenttip.add(TextFormatting.YELLOW + "[NOT CONNECTED]");
}
if (!isCreative()) {
boolean power = te.isPowerOn();
if (!power) {
currenttip.add(TextFormatting.YELLOW + "[NO POWER]");
}
if (player.isSneaking()) {
int rfPerTick = te.getTotalRfPerTick();
currenttip.add(TextFormatting.GREEN + (power ? "Consuming " : "Needs ") + rfPerTick + " RF/tick");
}
}
if (System.currentTimeMillis() - lastTime > 500) {
lastTime = System.currentTimeMillis();
RFToolsMessages.INSTANCE.sendToServer(new PacketGetInfoFromServer(RFTools.MODID, new ScreenInfoPacketServer(te.getWorld().provider.getDimension(), te.getPos())));
}
Collections.addAll(currenttip, ScreenInfoPacketClient.infoReceived);
return currenttip;
}
use of mcjty.lib.network.clientinfo.PacketGetInfoFromServer in project RFTools by McJty.
the class GuiPowerCell method requestRF.
private void requestRF() {
if (System.currentTimeMillis() - lastTime > 250) {
lastTime = System.currentTimeMillis();
RFToolsMessages.INSTANCE.sendToServer(new PacketGetInfoFromServer(RFTools.MODID, new PowerCellInfoPacketServer(tileEntity)));
}
}
Aggregations