mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Added FU as an option to the energy display
This commit is contained in:
parent
c334b31761
commit
cc5e517a1d
5 changed files with 25 additions and 18 deletions
|
@ -48,7 +48,7 @@ public final class PlayerData{
|
|||
|
||||
public UUID id;
|
||||
|
||||
public boolean displayTesla;
|
||||
public int energyDisplayMode;
|
||||
public boolean bookGottenAlready;
|
||||
public boolean didBookTutorial;
|
||||
public boolean hasBatWings;
|
||||
|
@ -65,7 +65,7 @@ public final class PlayerData{
|
|||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound, boolean savingToFile){
|
||||
this.displayTesla = compound.getBoolean("DisplayTesla");
|
||||
this.energyDisplayMode = compound.getInteger("EnergyDisplayMode");
|
||||
this.bookGottenAlready = compound.getBoolean("BookGotten");
|
||||
this.didBookTutorial = compound.getBoolean("DidTutorial");
|
||||
|
||||
|
@ -87,7 +87,7 @@ public final class PlayerData{
|
|||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
|
||||
compound.setBoolean("DisplayTesla", this.displayTesla);
|
||||
compound.setInteger("EnergyDisplayMode", this.energyDisplayMode);
|
||||
compound.setBoolean("BookGotten", this.bookGottenAlready);
|
||||
compound.setBoolean("DidTutorial", this.didBookTutorial);
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||
|
@ -34,7 +33,7 @@ public class EnergyDisplay extends Gui{
|
|||
private int y;
|
||||
private boolean outline;
|
||||
private boolean drawTextNextTo;
|
||||
private boolean displayTesla;
|
||||
private int displayMode; //0: RF, 1: FU, 2: T
|
||||
|
||||
public EnergyDisplay(int x, int y, CustomEnergyStorage rfReference, boolean outline, boolean drawTextNextTo){
|
||||
this.setData(x, y, rfReference, outline, drawTextNextTo);
|
||||
|
@ -51,7 +50,7 @@ public class EnergyDisplay extends Gui{
|
|||
this.outline = outline;
|
||||
this.drawTextNextTo = drawTextNextTo;
|
||||
|
||||
this.displayTesla = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer).displayTesla;
|
||||
this.displayMode = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer).energyDisplayMode;
|
||||
}
|
||||
|
||||
public void draw(){
|
||||
|
@ -60,7 +59,8 @@ public class EnergyDisplay extends Gui{
|
|||
|
||||
int barX = this.x;
|
||||
int barY = this.y;
|
||||
int vOffset = this.displayTesla ? 85 : 0;
|
||||
int uOffset = this.displayMode == 1 ? 60 : 0;
|
||||
int vOffset = this.displayMode == 0 ? 0 : 85;
|
||||
|
||||
if(this.outline){
|
||||
this.drawTexturedModalRect(this.x, this.y, 52, 163, 26, 93);
|
||||
|
@ -68,11 +68,11 @@ public class EnergyDisplay extends Gui{
|
|||
barX += 4;
|
||||
barY += 4;
|
||||
}
|
||||
this.drawTexturedModalRect(barX, barY, 18, 171-vOffset, 18, 85);
|
||||
this.drawTexturedModalRect(barX, barY, 18+uOffset, 171-vOffset, 18, 85);
|
||||
|
||||
if(this.rfReference.getEnergyStored() > 0){
|
||||
int i = this.rfReference.getEnergyStored()*83/this.rfReference.getMaxEnergyStored();
|
||||
this.drawTexturedModalRect(barX+1, barY+84-i, 36, 172-vOffset, 16, i);
|
||||
this.drawTexturedModalRect(barX+1, barY+84-i, 36+uOffset, 172-vOffset, 16, i);
|
||||
}
|
||||
|
||||
if(this.drawTextNextTo){
|
||||
|
@ -87,8 +87,10 @@ public class EnergyDisplay extends Gui{
|
|||
List<String> text = new ArrayList<String>();
|
||||
text.add(this.getOverlayText());
|
||||
text.add("");
|
||||
text.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.to"+(this.displayTesla ? "RF" : "T")));
|
||||
text.add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.disclaimer"));
|
||||
text.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.to"+(this.displayMode == 1 ? "T" : (this.displayMode == 0 ? "FU" : "RF"))));
|
||||
for(int i = 1; i <= 2; i++){
|
||||
text.add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.disclaimer."+i));
|
||||
}
|
||||
GuiUtils.drawHoveringText(text, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
@ -105,14 +107,17 @@ public class EnergyDisplay extends Gui{
|
|||
|
||||
private String getOverlayText(){
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
return format.format(this.rfReference.getEnergyStored())+"/"+format.format(this.rfReference.getMaxEnergyStored())+(this.displayTesla ? " T" : " RF");
|
||||
return format.format(this.rfReference.getEnergyStored())+"/"+format.format(this.rfReference.getMaxEnergyStored())+(this.displayMode == 0 ? " RF" : (this.displayMode == 2 ? " T" : " FU"));
|
||||
}
|
||||
|
||||
private void changeDisplayMode(){
|
||||
this.displayTesla = !this.displayTesla;
|
||||
this.displayMode++;
|
||||
if(this.displayMode >= 3){
|
||||
this.displayMode = 0;
|
||||
}
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
PlayerData.getDataFromPlayer(player).displayTesla = this.displayTesla;
|
||||
PacketHandlerHelper.sendPlayerDataPacket(player, true, false);
|
||||
PlayerData.getDataFromPlayer(player).energyDisplayMode = this.displayMode;
|
||||
PacketHandlerHelper.sendPlayerDataPacket(player, false, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
|
|||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
boolean tesla = PlayerData.getDataFromPlayer(player).displayTesla;
|
||||
list.add(format.format(this.getEnergyStored(stack))+"/"+format.format(this.getMaxEnergyStored(stack))+(tesla ? " T" : " RF"));
|
||||
int display = PlayerData.getDataFromPlayer(player).energyDisplayMode;
|
||||
list.add(format.format(this.getEnergyStored(stack))+"/"+format.format(this.getMaxEnergyStored(stack))+(display == 1 ? "FU" : (display == 0 ? "RF" : "T")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -604,7 +604,9 @@ info.actuallyadditions.placer.sides.1=Placement Sides
|
|||
info.actuallyadditions.placer.sides.2=Usually when placing down blocks, they are placed towards the side of another block that you are looking at. Because the Phantom Placer can place blocks in mid-air, it doesn't know that. Usually you should just set it to a solid side.
|
||||
info.actuallyadditions.energy.toRF=Click for Redstone Flux display mode!
|
||||
info.actuallyadditions.energy.toT=Click for Tesla display mode!
|
||||
info.actuallyadditions.energy.disclaimer=Note that this is just for looks.
|
||||
info.actuallyadditions.energy.toFU=Click for Forge Units display mode!
|
||||
info.actuallyadditions.energy.disclaimer.1=Changing this is just visual.
|
||||
info.actuallyadditions.energy.disclaimer.2=All systems are always supported.
|
||||
|
||||
#Container Names
|
||||
container.actuallyadditions.inputter.name=ESD
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 8.2 KiB |
Loading…
Reference in a new issue