use of stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDarkEnergyCore in project MorePlanets by SteveKunG.
the class WailaTileEntityProviderMP method getWailaHead.
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntity tile = accessor.getTileEntity();
Block block = accessor.getBlock();
NBTTagCompound nbt = accessor.getNBTData();
if (nbt.hasKey("EnergyF") && !(block == MPBlocks.NWT_MIDDLE_DUMMY || block == MPBlocks.NWT_TOP_DUMMY) && !(tile instanceof TileEntityNuclearWasteTank)) {
tooltip.add(TextFormatting.GREEN + LangUtils.translate("gui.message.energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("EnergyF")));
}
// block
if (block == MPBlocks.DER_SOLAR1_DUMMY || block == MPBlocks.DER_SOLAR2_DUMMY || block == MPBlocks.DER_SOLAR3_DUMMY || block == MPBlocks.DER_SOLAR4_DUMMY) {
int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
int destruct = nbt.getInteger("FailedTick");
if (destruct > 0) {
destruct = 600 - destruct;
tooltip.add(TextFormatting.DARK_RED + LangUtils.translate("gui.status.destruct.name") + ": " + CommonUtils.ticksToElapsedTime(destruct));
} else {
tooltip.add(LangUtils.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
if (process > 0 && process < 100) {
tooltip.add("Process: " + process + "%");
}
}
if (block == MPBlocks.WARP_PAD_DUMMY) {
if (tile instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy) tile;
TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) accessor.getWorld().getTileEntity(dummy.mainBlockPosition);
String dimension = LangUtils.translate("gui.status.unknown.name");
String name = LangUtils.translate("gui.status.unknown.name");
String dest = LangUtils.translate("gui.status.unknown.name");
if (warp.hasWarpCore() && warp.getInventory().get(1).hasTagCompound()) {
NBTTagCompound compound = warp.getInventory().get(1).getTagCompound();
dimension = String.valueOf(compound.getInteger("DimensionID"));
name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
}
tooltip.add(LangUtils.translate("gui.status.dimension.name") + ": " + dimension + " ");
tooltip.add(LangUtils.translate("gui.status.name.name") + ": " + name);
tooltip.add(LangUtils.translate("gui.status.destination.name") + ": " + dest);
}
}
if (block == MPBlocks.SHIELD_GENERATOR_DUMMY) {
int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
tooltip.add(LangUtils.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
tooltip.add(LangUtils.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
tooltip.add(LangUtils.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
tooltip.add(LangUtils.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
if (chargeCooldown > 0) {
tooltip.add(LangUtils.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
}
}
if (block == MPBlocks.NWT_MIDDLE_DUMMY || block == MPBlocks.NWT_TOP_DUMMY) {
if (!nbt.getBoolean("HasRod") && !nbt.getBoolean("CreateRod")) {
tooltip.add(LangUtils.translate("gui.status.no_waste_rod"));
}
if (nbt.getCompoundTag("FluidTank").getInteger("Amount") > 0 && nbt.getCompoundTag("FluidTank").getInteger("Amount") < 3000) {
int amount = nbt.getCompoundTag("FluidTank").getInteger("Amount") * 100 / 3000;
tooltip.add(LangUtils.translate("gui.status.has_waste"));
tooltip.add(LangUtils.translate("gui.status.waste_fluid_amount") + ": " + amount + "%");
}
if (nbt.getInteger("Time") > 0 && nbt.getCompoundTag("FluidTank").getInteger("Amount") == 3000) {
int cooldown = nbt.getInteger("RodCreateTime") * 100 / nbt.getInteger("Time");
tooltip.add(LangUtils.translate("gui.status.rod_processing"));
tooltip.add(LangUtils.translate("gui.status.create_rod_progress.name") + ": " + cooldown + "%");
}
}
// tile
if (tile instanceof TileEntityDarkEnergyReceiver) {
int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
int destruct = nbt.getInteger("FailedTick");
if (destruct > 0) {
destruct = 600 - destruct;
tooltip.add(TextFormatting.DARK_RED + LangUtils.translate("gui.status.destruct.name") + ": " + CommonUtils.ticksToElapsedTime(destruct));
} else {
tooltip.add(LangUtils.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
if (process > 0 && process < 100) {
tooltip.add(LangUtils.translate("gui.status.process.name") + ": " + process + "%");
}
}
if (tile instanceof TileEntityDarkEnergyCore) {
int transform = nbt.getInteger("ProduceTime");
if (transform > 0) {
tooltip.add(LangUtils.translate("gui.status.transform_time.name") + ": " + CommonUtils.ticksToElapsedTime(transform));
}
}
if (tile instanceof TileEntityDarkEnergyGenerator) {
int generateWatts = nbt.getInteger("GenerateWatts");
int fuel = nbt.getInteger("DarkEnergyFuel");
tooltip.add(LangUtils.translate("gui.message.generating.name") + ": " + (generateWatts > 0 ? EnergyDisplayHelper.getEnergyDisplayS(generateWatts) + "/t" : LangUtils.translate("gui.status.not_generating.name")));
tooltip.add(LangUtils.translate("gui.status.dark_energy_fuel.name") + ": " + (fuel > 0 ? String.valueOf(fuel * 100 / 1000) + "%" : TextFormatting.GOLD + LangUtils.translate("gui.status.empty.name")));
}
if (tile instanceof TileEntitySpaceWarpPadFull) {
TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) tile;
String dimension = LangUtils.translate("gui.status.unknown.name");
String name = LangUtils.translate("gui.status.unknown.name");
String dest = LangUtils.translate("gui.status.unknown.name");
if (warp.hasWarpCore() && warp.getInventory().get(1).hasTagCompound()) {
NBTTagCompound compound = warp.getInventory().get(1).getTagCompound();
dimension = String.valueOf(compound.getInteger("DimensionID"));
name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
}
tooltip.add(LangUtils.translate("gui.status.dimension.name") + ": " + dimension + " ");
tooltip.add(LangUtils.translate("gui.status.name.name") + ": " + name);
tooltip.add(LangUtils.translate("gui.status.destination.name") + ": " + dest);
}
if (tile instanceof TileEntityEnergyStorageClusterMP || tile instanceof TileEntityNuclearWasteGenerator) {
tooltip.add(TextFormatting.GREEN + LangUtils.translate("gui.message.max_energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxEnergy")));
tooltip.add(LangUtils.translate("gui.max_output.desc") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxOutput")) + "/t");
if (nbt.hasKey("Status")) {
tooltip.add(LangUtils.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
}
}
if (tile instanceof TileEntityBlackHoleStorage) {
String owner = LangUtils.translate("gui.status.unknown.name");
String collectMode = nbt.getString("CollectMode").equals("item") ? LangUtils.translate("gui.status.collect_item.name") : nbt.getString("CollectMode").equals("item_and_xp") ? LangUtils.translate("gui.status.collect_item_and_xp.name") : LangUtils.translate("gui.status.collect_xp.name");
try {
owner = accessor.getWorld().getPlayerEntityByUUID(UUID.fromString(nbt.getString("OwnerUUID"))).getName();
} catch (Exception e) {
owner = "";
}
int xp = nbt.hasKey("XpFluid", Constants.NBT.TAG_COMPOUND) ? nbt.getCompoundTag("XpFluid").getInteger("Amount") : 0;
tooltip.add(LangUtils.translate("gui.status.owner.name") + ": " + owner);
tooltip.add(LangUtils.translate("gui.status.mode.name") + ": " + collectMode);
tooltip.add(LangUtils.translate("desc.bhs_xp.name") + ": " + xp + "/" + 1000000);
}
if (tile instanceof TileEntityShieldGenerator) {
int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
tooltip.add(LangUtils.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
tooltip.add(LangUtils.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
tooltip.add(LangUtils.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
tooltip.add(LangUtils.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
if (chargeCooldown > 0) {
tooltip.add(LangUtils.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
}
}
if (tile instanceof TileEntityNuclearWasteTank) {
if (!nbt.getBoolean("HasRod") && !nbt.getBoolean("CreateRod")) {
tooltip.add(LangUtils.translate("gui.status.no_waste_rod"));
}
if (nbt.getCompoundTag("FluidTank").getInteger("Amount") > 0 && nbt.getCompoundTag("FluidTank").getInteger("Amount") < 3000) {
int amount = nbt.getCompoundTag("FluidTank").getInteger("Amount") * 100 / 3000;
tooltip.add(LangUtils.translate("gui.status.has_waste"));
tooltip.add(LangUtils.translate("gui.status.waste_fluid_amount") + ": " + amount + "%");
}
if (nbt.getInteger("Time") > 0 && nbt.getCompoundTag("FluidTank").getInteger("Amount") == 3000) {
int cooldown = nbt.getInteger("RodCreateTime") * 100 / nbt.getInteger("Time");
tooltip.add(LangUtils.translate("gui.status.rod_processing"));
tooltip.add(LangUtils.translate("gui.status.create_rod_progress.name") + ": " + cooldown + "%");
}
}
return tooltip;
}
Aggregations