mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +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 UUID id;
|
||||||
|
|
||||||
public boolean displayTesla;
|
public int energyDisplayMode;
|
||||||
public boolean bookGottenAlready;
|
public boolean bookGottenAlready;
|
||||||
public boolean didBookTutorial;
|
public boolean didBookTutorial;
|
||||||
public boolean hasBatWings;
|
public boolean hasBatWings;
|
||||||
|
@ -65,7 +65,7 @@ public final class PlayerData{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound compound, boolean savingToFile){
|
public void readFromNBT(NBTTagCompound compound, boolean savingToFile){
|
||||||
this.displayTesla = compound.getBoolean("DisplayTesla");
|
this.energyDisplayMode = compound.getInteger("EnergyDisplayMode");
|
||||||
this.bookGottenAlready = compound.getBoolean("BookGotten");
|
this.bookGottenAlready = compound.getBoolean("BookGotten");
|
||||||
this.didBookTutorial = compound.getBoolean("DidTutorial");
|
this.didBookTutorial = compound.getBoolean("DidTutorial");
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public final class PlayerData{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
|
public void writeToNBT(NBTTagCompound compound, boolean savingToFile){
|
||||||
compound.setBoolean("DisplayTesla", this.displayTesla);
|
compound.setInteger("EnergyDisplayMode", this.energyDisplayMode);
|
||||||
compound.setBoolean("BookGotten", this.bookGottenAlready);
|
compound.setBoolean("BookGotten", this.bookGottenAlready);
|
||||||
compound.setBoolean("DidTutorial", this.didBookTutorial);
|
compound.setBoolean("DidTutorial", this.didBookTutorial);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||||
|
@ -34,7 +33,7 @@ public class EnergyDisplay extends Gui{
|
||||||
private int y;
|
private int y;
|
||||||
private boolean outline;
|
private boolean outline;
|
||||||
private boolean drawTextNextTo;
|
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){
|
public EnergyDisplay(int x, int y, CustomEnergyStorage rfReference, boolean outline, boolean drawTextNextTo){
|
||||||
this.setData(x, y, rfReference, outline, drawTextNextTo);
|
this.setData(x, y, rfReference, outline, drawTextNextTo);
|
||||||
|
@ -51,7 +50,7 @@ public class EnergyDisplay extends Gui{
|
||||||
this.outline = outline;
|
this.outline = outline;
|
||||||
this.drawTextNextTo = drawTextNextTo;
|
this.drawTextNextTo = drawTextNextTo;
|
||||||
|
|
||||||
this.displayTesla = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer).displayTesla;
|
this.displayMode = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer).energyDisplayMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(){
|
public void draw(){
|
||||||
|
@ -60,7 +59,8 @@ public class EnergyDisplay extends Gui{
|
||||||
|
|
||||||
int barX = this.x;
|
int barX = this.x;
|
||||||
int barY = this.y;
|
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){
|
if(this.outline){
|
||||||
this.drawTexturedModalRect(this.x, this.y, 52, 163, 26, 93);
|
this.drawTexturedModalRect(this.x, this.y, 52, 163, 26, 93);
|
||||||
|
@ -68,11 +68,11 @@ public class EnergyDisplay extends Gui{
|
||||||
barX += 4;
|
barX += 4;
|
||||||
barY += 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){
|
if(this.rfReference.getEnergyStored() > 0){
|
||||||
int i = this.rfReference.getEnergyStored()*83/this.rfReference.getMaxEnergyStored();
|
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){
|
if(this.drawTextNextTo){
|
||||||
|
@ -87,8 +87,10 @@ public class EnergyDisplay extends Gui{
|
||||||
List<String> text = new ArrayList<String>();
|
List<String> text = new ArrayList<String>();
|
||||||
text.add(this.getOverlayText());
|
text.add(this.getOverlayText());
|
||||||
text.add("");
|
text.add("");
|
||||||
text.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.to"+(this.displayTesla ? "RF" : "T")));
|
text.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.to"+(this.displayMode == 1 ? "T" : (this.displayMode == 0 ? "FU" : "RF"))));
|
||||||
text.add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".energy.disclaimer"));
|
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);
|
GuiUtils.drawHoveringText(text, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,14 +107,17 @@ public class EnergyDisplay extends Gui{
|
||||||
|
|
||||||
private String getOverlayText(){
|
private String getOverlayText(){
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
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(){
|
private void changeDisplayMode(){
|
||||||
this.displayTesla = !this.displayTesla;
|
this.displayMode++;
|
||||||
|
if(this.displayMode >= 3){
|
||||||
|
this.displayMode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
PlayerData.getDataFromPlayer(player).displayTesla = this.displayTesla;
|
PlayerData.getDataFromPlayer(player).energyDisplayMode = this.displayMode;
|
||||||
PacketHandlerHelper.sendPlayerDataPacket(player, true, false);
|
PacketHandlerHelper.sendPlayerDataPacket(player, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
boolean tesla = PlayerData.getDataFromPlayer(player).displayTesla;
|
int display = PlayerData.getDataFromPlayer(player).energyDisplayMode;
|
||||||
list.add(format.format(this.getEnergyStored(stack))+"/"+format.format(this.getMaxEnergyStored(stack))+(tesla ? " T" : " RF"));
|
list.add(format.format(this.getEnergyStored(stack))+"/"+format.format(this.getMaxEnergyStored(stack))+(display == 1 ? "FU" : (display == 0 ? "RF" : "T")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.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.toRF=Click for Redstone Flux display mode!
|
||||||
info.actuallyadditions.energy.toT=Click for Tesla 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 Names
|
||||||
container.actuallyadditions.inputter.name=ESD
|
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