diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-04 19:55:10 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-04 19:55:10 +1000 |
commit | a94c9acbb4455be86d5841598d4ac07f3cddbaf0 (patch) | |
tree | 6c17ca80736ac3faedddebd0b83a5b51fd1e4b6b /src/Java/miscutil/core/item/general | |
parent | a0d482a7f23bd959ca26466de024d779ec6bf352 (diff) | |
download | GT5-Unofficial-a94c9acbb4455be86d5841598d4ac07f3cddbaf0.tar.gz GT5-Unofficial-a94c9acbb4455be86d5841598d4ac07f3cddbaf0.tar.bz2 GT5-Unofficial-a94c9acbb4455be86d5841598d4ac07f3cddbaf0.zip |
% Changed handling of generated block names back to how it was.
% Changed power handling for Universal Battery.
% Disabled Sinter furnacing and related debugging completely for release.
% Changed generated dust tooltip handling.
Diffstat (limited to 'src/Java/miscutil/core/item/general')
-rw-r--r-- | src/Java/miscutil/core/item/general/RF2EU_Battery.java | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/Java/miscutil/core/item/general/RF2EU_Battery.java b/src/Java/miscutil/core/item/general/RF2EU_Battery.java index a6888b4dcc..ae03ea5a06 100644 --- a/src/Java/miscutil/core/item/general/RF2EU_Battery.java +++ b/src/Java/miscutil/core/item/general/RF2EU_Battery.java @@ -17,6 +17,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.MathHelper; import net.minecraft.world.World; import cofh.api.energy.ItemEnergyContainer; @@ -110,7 +111,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Universally chargeable battery"); + return ("Universally Chargeable Battery"); } @Override @@ -149,13 +150,13 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add("IC2/EU Information"); - list.add("Tier: ["+getTier(thisStack)+"]"+" Current Power: ["+(long) getCharge(stack)+"/EU]"); - list.add("Transfer Limit: ["+getTransferLimit(thisStack)+"Eu/t]"+" Burn Time: ["+getBurnTime(stack)/20+"s]"); + list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"/EU]"); + list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+getBurnTime(stack)/20+EnumChatFormatting.GRAY+"s]"); list.add(""); - list.add("RF Information"); - list.add("Extraction Rate: [" + this.maxExtract + "Rf/t]" + " Insert Rate: [" + this.maxReceive+"Rf/t]"); - list.add("Current Charge: ["+getEnergyStored(stack) + "Rf / " + getMaxEnergyStored(stack)+"Rf] "+MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack))+"%"); + list.add(EnumChatFormatting.RED+"RF Information"); + list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]"); + list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%"); super.addInformation(stack, aPlayer, list, bool); } @@ -205,6 +206,10 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { if ((stack.stackTagCompound == null) || (!stack.stackTagCompound.hasKey("Energy"))) { + double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + if (euCharge != 0 && euCharge >= 1){ + return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); + } return 0; } int energy = stack.stackTagCompound.getInteger("Energy"); @@ -248,8 +253,12 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, @Override public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - if (container.stackTagCompound == null) { - container.stackTagCompound = new NBTTagCompound(); + if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { + double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + if (euCharge != 0 && euCharge >= 1){ + return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); + } + return 0; } int energy = container.stackTagCompound.getInteger("Energy"); int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); @@ -268,6 +277,10 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { + double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + if (euCharge != 0 && euCharge >= 1){ + return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); + } return 0; } int energy = container.stackTagCompound.getInteger("Energy"); @@ -286,6 +299,10 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public int getEnergyStored(ItemStack container) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { + double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + if (euCharge != 0 && euCharge >= 1){ + return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); + } return 0; } int energy = container.stackTagCompound.getInteger("Energy"); |