fix: energy values now show correctly in GUIs

This commit is contained in:
Timo Ley 2022-10-30 14:11:01 +01:00
parent 994c6746e9
commit 4101578cd5
7 changed files with 17 additions and 13 deletions

View File

@ -153,8 +153,8 @@ public abstract class TileEntityFortron extends TileEntityFrequency
public int getFortronCapacity() { return this.fortronTank.getCapacity(); }
public int requestFortron(final int joules, final boolean doUse) {
return FortronHelper.getAmount(this.fortronTank.drain(joules, doUse));
public int requestFortron(final int amount, final boolean doUse) {
return FortronHelper.getAmount(this.fortronTank.drain(amount, doUse));
}
public int provideFortron(final int joules, final boolean doUse) {

View File

@ -71,7 +71,7 @@ public class GuiCoercionDeriver extends GuiBase {
this.drawTextWithTooltip("fortron",
"%1: " +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronEnergy(),
this.tileEntity.getFortronEnergy() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES),
8, 105, x, y);
this.fontRendererObj.drawString(

View File

@ -2,6 +2,7 @@ package mffs.gui;
import mffs.base.GuiBase;
import mffs.container.ContainerForceFieldProjector;
import mffs.tileentity.TileEntityCoercionDeriver;
import mffs.tileentity.TileEntityForceFieldProjector;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IBlockAccess;
@ -89,11 +90,11 @@ public class GuiForceFieldProjector extends GuiBase {
this.drawTextWithTooltip("fortron",
"%1: " +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronEnergy(),
this.tileEntity.getFortronEnergy() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES) +
"/" +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronCapacity(),
this.tileEntity.getFortronCapacity() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES),
8, 110, x, y);
this.fontRendererObj.drawString(

View File

@ -5,6 +5,7 @@ import mffs.base.GuiBase;
import mffs.base.PacketTile;
import mffs.container.ContainerForceManipulator;
import mffs.gui.button.GuiIcon;
import mffs.tileentity.TileEntityCoercionDeriver;
import mffs.tileentity.TileEntityForceManipulator;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
@ -111,12 +112,12 @@ public class GuiForceManipulator extends GuiBase {
this.drawTextWithTooltip("fortron",
"%1: " +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronEnergy(),
this.tileEntity.getFortronEnergy() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES)
+
"/" +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronCapacity(),
this.tileEntity.getFortronCapacity() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES),
8, 110, x, y);
this.fontRendererObj.drawString(

View File

@ -5,6 +5,7 @@ import mffs.base.GuiBase;
import mffs.base.PacketTile;
import mffs.container.ContainerFortronCapacitor;
import mffs.gui.button.GuiButtonPressTransferMode;
import mffs.tileentity.TileEntityCoercionDeriver;
import mffs.tileentity.TileEntityFortronCapacitor;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
@ -59,11 +60,11 @@ public class GuiFortronCapacitor extends GuiBase {
this.drawTextWithTooltip("fortron", "%1:", 8, 95, x, y);
this.fontRendererObj.drawString(
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronEnergy(),
this.tileEntity.getFortronEnergy() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES) +
"/" +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronCapacity(),
this.tileEntity.getFortronCapacity() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES),
8, 105, 4210752);
super.drawGuiContainerForegroundLayer(x, y);

View File

@ -4,6 +4,7 @@ import mffs.ModularForceFieldSystem;
import mffs.base.GuiBase;
import mffs.base.PacketTile;
import mffs.container.ContainerInterdictionMatrix;
import mffs.tileentity.TileEntityCoercionDeriver;
import mffs.tileentity.TileEntityInterdictionMatrix;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
@ -64,11 +65,11 @@ public class GuiInterdictionMatrix extends GuiBase {
this.drawTextWithTooltip("fortron",
"%1: " +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronEnergy(),
this.tileEntity.getFortronEnergy() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES) +
"/" +
ElectricityDisplay.getDisplayShort(
this.tileEntity.getFortronCapacity(),
this.tileEntity.getFortronCapacity() * TileEntityCoercionDeriver.FORTRON_UE_RATIO,
ElectricityDisplay.ElectricUnit.JOULES),
8, 110, x, y);
this.fontRendererObj.drawString(

View File

@ -44,7 +44,7 @@ public class TileEntityCoercionDeriver extends TileEntityUniversalEnergy {
if (!this.isDisabled() && this.isActive()) {
if (this.isInversed && Settings.ENABLE_ELECTRICITY) {
final double watts =
Math.min(this.getFortronEnergy() * 6.0f, 1000.0f);
Math.min(this.getFortronEnergy() * FORTRON_UE_RATIO, 1000.0f);
final ElectricityPack remainder = this.produce(watts);
double electricItemGiven = 0.0;
if (remainder.getWatts() > 0.0) {
@ -53,7 +53,7 @@ public class TileEntityCoercionDeriver extends TileEntityUniversalEnergy {
this.getVoltage());
}
this.requestFortron(
(int)((watts - (remainder.getWatts() - electricItemGiven)) / 6.0),
(int)((watts - (remainder.getWatts() - electricItemGiven)) / FORTRON_UE_RATIO),
true);
} else {
super.wattsReceived += ElectricItemHelper.dechargeItem(