implement #2672, add color-coding and percentage to robot charge

This commit is contained in:
asiekierka 2015-04-27 17:04:42 +02:00
parent d8b302eee0
commit e749c6f36b
4 changed files with 41 additions and 4 deletions

View file

@ -19,6 +19,25 @@ buildcraft.boardRobotDelivery=Delivery
buildcraft.boardRobotPump=Pump
buildcraft.boardRobotStripes=Stripes
buildcraft.boardRobotPicker.desc=Picks up items
buildcraft.boardRobotLumberjack.desc=Breaks logs
buildcraft.boardRobotPlanter.desc=Plants crops
buildcraft.boardRobotLeaveCutter.desc=Cuts leaves
buildcraft.boardRobotCarrier.desc=Moves items between inventories
buildcraft.boardRobotFluidCarrier.desc=Moves fluids between tanks
buildcraft.boardRobotBomber.desc=Bombs locations
buildcraft.boardRobotKnight.desc=Fights mobs
buildcraft.boardRobotMiner.desc=Mines ores
buildcraft.boardRobotFarmer.desc=Farms animals
buildcraft.boardRobotHarvester.desc=Harvests mature crops
buildcraft.boardRobotShovelman.desc=Shovels area
buildcraft.boardRobotButcher.desc=Fights animals
buildcraft.boardRobotBuilder.desc=Builds structures
buildcraft.boardRobotCrafter.desc=Crafts items
buildcraft.boardRobotDelivery.desc=Delivers items upon request
buildcraft.boardRobotPump.desc=Pumps out liquids
buildcraft.boardRobotStripes.desc=Uhh... Stripes!
chat.gateCopier.clear=Gate information cleared.
chat.gateCopier.gateCopied=Copied gate information to copier.
chat.gateCopier.gatePasted=Pasted copied data to gate.

View file

@ -0,0 +1,7 @@
Everything from BuildCraft 6.4.14, and:
Improvements:
* [#2672] Add tooltips to robots and color-code energy information (asie)
Bugs fixed:
* Erratic robot recharge (hea3ven)

View file

@ -16,6 +16,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -95,10 +96,18 @@ public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem {
if (nbt != null) {
nbt.addInformation(stack, player, list, advanced);
}
}
int energy = NBTUtils.getItemData(stack).getInteger("energy");
list.add(energy + "/" + EntityRobotBase.MAX_ENERGY + " RF");
int energy = NBTUtils.getItemData(stack).getInteger("energy");
int pct = (energy * 100 / EntityRobotBase.MAX_ENERGY);
String enInfo = pct + "% Charged";
if (energy == EntityRobotBase.MAX_ENERGY) {
enInfo = "Full Charge";
} else if (energy == 0) {
enInfo = "No Charge";
}
enInfo = (pct >= 80 ? EnumChatFormatting.GREEN : (pct >= 50 ? EnumChatFormatting.YELLOW : (pct >= 30 ? EnumChatFormatting.GOLD : (pct >= 20 ? EnumChatFormatting.RED : EnumChatFormatting.DARK_RED)))) + enInfo;
list.add(enInfo);
}
}
@Override

View file

@ -8,6 +8,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
@ -54,7 +55,8 @@ public class BCBoardNBT extends RedstoneBoardRobotNBT {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobot" + upperName));
list.add(EnumChatFormatting.BOLD + StringUtils.localize("buildcraft.boardRobot" + upperName));
list.add(StringUtils.localize("buildcraft.boardRobot" + upperName + ".desc"));
}
@Override