use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.
the class RealizedDimensionTab method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null) {
String name = tagCompound.getString("name");
int id = 0;
if (name != null) {
id = tagCompound.getInteger("id");
if (id == 0) {
list.add(EnumChatFormatting.BLUE + "Name: " + name);
} else {
list.add(EnumChatFormatting.BLUE + "Name: " + name + " (Id " + id + ")");
}
}
String descriptionString = tagCompound.getString("descriptionString");
constructDescriptionHelp(list, descriptionString);
Integer ticksLeft = tagCompound.getInteger("ticksLeft");
if (ticksLeft == 0) {
DimensionInformation information = RfToolsDimensionManager.getDimensionManager(player.getEntityWorld()).getDimensionInformation(id);
if (information == null) {
list.add(EnumChatFormatting.RED + "Dimension information Missing!");
} else {
list.add(EnumChatFormatting.BLUE + "Dimension ready!");
int maintainCost = tagCompound.getInteger("rfMaintainCost");
int actualCost = information.getActualRfCost();
if (actualCost == maintainCost || actualCost == 0) {
list.add(EnumChatFormatting.YELLOW + " Maintenance cost: " + maintainCost + " RF/tick");
} else {
list.add(EnumChatFormatting.YELLOW + " Maintenance cost: " + actualCost + " RF/tick (Specified: " + maintainCost + " RF/tick)");
}
if (id != 0) {
if (System.currentTimeMillis() - lastTime > 500) {
lastTime = System.currentTimeMillis();
RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
}
DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEntityWorld());
int power = storage.getEnergyLevel(id);
list.add(EnumChatFormatting.YELLOW + " Current power: " + power + " RF");
}
}
} else {
int createCost = tagCompound.getInteger("rfCreateCost");
int maintainCost = tagCompound.getInteger("rfMaintainCost");
int tickCost = tagCompound.getInteger("tickCost");
int percentage = (tickCost - ticksLeft) * 100 / tickCost;
list.add(EnumChatFormatting.BLUE + "Dimension progress: " + percentage + "%");
list.add(EnumChatFormatting.YELLOW + " Creation cost: " + createCost + " RF/tick");
list.add(EnumChatFormatting.YELLOW + " Maintenance cost: " + maintainCost + " RF/tick");
list.add(EnumChatFormatting.YELLOW + " Tick cost: " + tickCost + " ticks");
}
}
}
use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.
the class DimensionMonitorItem method addInformation.
// @SideOnly(Side.CLIENT)
// @Override
// public IIcon getIconIndex(ItemStack stack) {
// EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
// int id = player.worldObj.provider.dimensionId;
// DimensionStorage storage = DimensionStorage.getDimensionStorage(player.worldObj);
// int energyLevel = storage.getEnergyLevel(id);
// int level = (9*energyLevel) / DimletConfiguration.MAX_DIMENSION_POWER;
// if (level < 0) {
// level = 0;
// } else if (level > 8) {
// level = 8;
// }
// return powerLevel[8-level];
// }
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
int id = player.getEntityWorld().provider.getDimension();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManagerNullable(player.getEntityWorld());
DimensionInformation dimensionInformation = dimensionManager == null ? null : dimensionManager.getDimensionInformation(id);
if (dimensionInformation == null) {
list.add("Not an RFTools dimension!");
} else {
if (System.currentTimeMillis() - lastTime > 500) {
lastTime = System.currentTimeMillis();
RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
}
String name = dimensionInformation.getName();
DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEntityWorld());
int power = storage != null ? storage.getEnergyLevel(id) : 0;
list.add(TextFormatting.BLUE + "Name: " + name + " (Id " + id + ")");
list.add(TextFormatting.YELLOW + "Power: " + power + " RF");
}
}
use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.
the class DimensionMonitorItem method addInformation.
// @SideOnly(Side.CLIENT)
// @Override
// public IIcon getIconIndex(ItemStack stack) {
// EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
// int id = player.worldObj.provider.dimensionId;
// DimensionStorage storage = DimensionStorage.getDimensionStorage(player.worldObj);
// int energyLevel = storage.getEnergyLevel(id);
// int level = (9*energyLevel) / DimletConfiguration.MAX_DIMENSION_POWER;
// if (level < 0) {
// level = 0;
// } else if (level > 8) {
// level = 8;
// }
// return powerLevel[8-level];
// }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, World world, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, world, list, whatIsThis);
if (world == null || world.provider == null) {
return;
}
int id = world.provider.getDimension();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManagerClientNullable(world);
DimensionInformation dimensionInformation = dimensionManager == null ? null : dimensionManager.getDimensionInformation(id);
if (dimensionInformation == null) {
list.add("Not an RFTools dimension!");
} else {
if (System.currentTimeMillis() - lastTime > 500) {
lastTime = System.currentTimeMillis();
RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
}
String name = dimensionInformation.getName();
DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
int power = storage != null ? storage.getEnergyLevel(id) : 0;
list.add(TextFormatting.BLUE + "Name: " + name + " (Id " + id + ")");
list.add(TextFormatting.YELLOW + "Power: " + power + " RF");
}
}
use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.
the class RealizedDimensionTab method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World world, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, world, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null) {
String name = tagCompound.getString("name");
int id = 0;
if (name != null) {
id = tagCompound.getInteger("id");
if (id == 0) {
list.add(TextFormatting.BLUE + "Name: " + name);
} else {
list.add(TextFormatting.BLUE + "Name: " + name + " (Id " + id + ")");
}
}
String descriptionString = tagCompound.getString("descriptionString");
constructDescriptionHelp(list, descriptionString);
Integer ticksLeft = tagCompound.getInteger("ticksLeft");
if (ticksLeft == 0) {
DimensionInformation information = RfToolsDimensionManager.getDimensionManagerClient().getDimensionInformation(id);
if (information == null) {
list.add(TextFormatting.RED + "Dimension information Missing!");
} else {
list.add(TextFormatting.BLUE + "Dimension ready!");
int maintainCost = tagCompound.getInteger("rfMaintainCost");
int actualCost = information.getActualRfCost();
if (actualCost == maintainCost || actualCost == 0) {
list.add(TextFormatting.YELLOW + " Maintenance cost: " + maintainCost + " RF/tick");
} else {
list.add(TextFormatting.YELLOW + " Maintenance cost: " + actualCost + " RF/tick (Specified: " + maintainCost + " RF/tick)");
}
if (id != 0) {
if (System.currentTimeMillis() - lastTime > 500) {
lastTime = System.currentTimeMillis();
RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
}
DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
int power = storage.getEnergyLevel(id);
list.add(TextFormatting.YELLOW + " Current power: " + power + " RF");
}
}
} else {
int createCost = tagCompound.getInteger("rfCreateCost");
int maintainCost = tagCompound.getInteger("rfMaintainCost");
int tickCost = tagCompound.getInteger("tickCost");
int percentage = (tickCost - ticksLeft) * 100 / tickCost;
list.add(TextFormatting.BLUE + "Dimension progress: " + percentage + "%");
list.add(TextFormatting.YELLOW + " Creation cost: " + createCost + " RF/tick");
list.add(TextFormatting.YELLOW + " Maintenance cost: " + maintainCost + " RF/tick");
list.add(TextFormatting.YELLOW + " Tick cost: " + tickCost + " ticks");
}
}
}
use of mcjty.rftoolsdim.network.PacketGetDimensionEnergy in project RFToolsDimensions by McJty.
the class GenericWorldProvider method getSkyColor.
@Override
@SideOnly(Side.CLIENT)
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
int dim = worldObj.provider.getDimensionId();
if (System.currentTimeMillis() - lastTime > 1000) {
lastTime = System.currentTimeMillis();
RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(dim));
}
float factor = calculatePowerBlackout(dim);
getDimensionInformation();
float r;
float g;
float b;
if (dimensionInformation == null) {
r = g = b = 1.0f;
} else {
r = dimensionInformation.getSkyDescriptor().getSkyColorFactorR() * factor;
g = dimensionInformation.getSkyDescriptor().getSkyColorFactorG() * factor;
b = dimensionInformation.getSkyDescriptor().getSkyColorFactorB() * factor;
}
Vec3 skyColor = super.getSkyColor(cameraEntity, partialTicks);
return new Vec3(skyColor.xCoord * r, skyColor.yCoord * g, skyColor.zCoord * b);
}
Aggregations