Cleanups, fixed UE ratios

This commit is contained in:
Aidan Brady 2013-07-31 16:44:53 -04:00
parent 1953e16b5a
commit fc964ad8db
20 changed files with 81 additions and 74 deletions

View file

@ -41,7 +41,7 @@ public class GuiAdvancedElectricMachine extends GuiContainer
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)

View file

@ -41,7 +41,7 @@ public class GuiElectricMachine extends GuiContainer
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)

View file

@ -39,7 +39,7 @@ public class GuiElectricPump extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 94) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(tileEntity.fluidTank.getFluid() != null ? FluidRegistry.getFluidName(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount : "No fluid.", 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
@ -50,7 +50,7 @@ public class GuiElectricPump extends GuiContainer
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -1,21 +1,20 @@
package mekanism.client;
import mekanism.common.ContainerEnergyCube;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityEnergyCube;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.TileEntityEnergyCube;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiEnergyCube extends GuiContainer
@ -34,7 +33,7 @@ public class GuiEnergyCube extends GuiContainer
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
String capacityInfo = ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricityDisplay.getDisplayShort((float)tileEntity.tier.MAX_ELECTRICITY, ElectricUnit.JOULES);
String capacityInfo = ElectricityDisplay.getDisplayShort((float)(tileEntity.getEnergyStored()), ElectricUnit.JOULES) + "/" + ElectricityDisplay.getDisplayShort((float)(tileEntity.getMaxEnergyStored()), ElectricUnit.JOULES);
String outputInfo = "Voltage: " + tileEntity.getVoltage() + "v";
fontRenderer.drawString(tileEntity.tier.name + " Energy Cube", 43, 6, 0x404040);
fontRenderer.drawString(capacityInfo, 45, 40, 0x00CD00);

View file

@ -112,7 +112,7 @@ public class GuiRobitMain extends GuiContainer
if(!displayNameChange)
{
fontRenderer.drawString("Hi, I'm " + robit.getTranslatedEntityName() + "!", 29, 18, 0x00CD00);
fontRenderer.drawString("Energy: " + ElectricityDisplay.getDisplayShort((float)robit.getEnergy(), ElectricUnit.JOULES), 29, 36-4, 0x00CD00);
fontRenderer.drawString("Energy: " + ElectricityDisplay.getDisplayShort((float)(robit.getEnergy()*Mekanism.TO_UE), ElectricUnit.JOULES), 29, 36-4, 0x00CD00);
fontRenderer.drawString("Following: " + robit.getFollowing(), 29, 45-4, 0x00CD00);
fontRenderer.drawString("Drop pickup: " + robit.getDropPickup(), 29, 54-4, 0x00CD00);
fontRenderer.drawString("Owner: " + robit.getOwnerName(), 29, 63-4, 0x00CD00);
@ -123,7 +123,7 @@ public class GuiRobitMain extends GuiContainer
if(xAxis >= 28 && xAxis <= 148 && yAxis >= 75 && yAxis <= 79)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)robit.getEnergy(), ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)(robit.getEnergy()*Mekanism.TO_UE), ElectricUnit.JOULES), xAxis, yAxis);
}
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 54 && yAxis <= 72)
{

View file

@ -45,7 +45,7 @@ public class GuiTeleporter extends GuiContainer
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -27,7 +27,7 @@ public final class ChargeUtils
}
else if(storer.inventory[slotID].getItem() instanceof IItemElectric)
{
storer.setEnergy(storer.getEnergy() + ElectricItemHelper.dischargeItem(storer.inventory[slotID], (float)(storer.getMaxEnergy() - storer.getEnergy())));
storer.setEnergy(storer.getEnergy() + ElectricItemHelper.dischargeItem(storer.inventory[slotID], (float)((storer.getMaxEnergy() - storer.getEnergy())*Mekanism.TO_UE)));
}
else if(Mekanism.hooks.IC2Loaded && storer.inventory[slotID].getItem() instanceof IElectricItem)
{
@ -78,7 +78,7 @@ public final class ChargeUtils
}
else if(storer.inventory[slotID].getItem() instanceof IItemElectric)
{
storer.setEnergy(storer.getEnergy() - ElectricItemHelper.chargeItem(storer.inventory[slotID], (float)storer.getEnergy()));
storer.setEnergy(storer.getEnergy() - ElectricItemHelper.chargeItem(storer.inventory[slotID], (float)(storer.getEnergy()*Mekanism.TO_UE)));
}
else if(Mekanism.hooks.IC2Loaded && storer.inventory[slotID].getItem() instanceof IElectricItem)
{

View file

@ -43,7 +43,7 @@ public class EnergyNetwork
public EnergyNetwork(Set<EnergyNetwork> networks)
{
for (EnergyNetwork net : networks)
for(EnergyNetwork net : networks)
{
if(net != null)
{
@ -51,6 +51,7 @@ public class EnergyNetwork
net.deregister();
}
}
refresh();
EnergyNetworkRegistry.getInstance().registerNetwork(this);
}
@ -123,6 +124,7 @@ public class EnergyNetwork
}
}
}
sent = energyAvailable - energyToSend;
joulesTransmitted += sent;
}
@ -293,9 +295,10 @@ public class EnergyNetwork
{
if(cable instanceof TileEntity)
{
NetworkFinder finder = new NetworkFinder(((TileEntity) cable).getWorldObj(), Object3D.get((TileEntity)cable), null);
NetworkFinder finder = new NetworkFinder(((TileEntity)cable).getWorldObj(), Object3D.get((TileEntity)cable), null);
List<Object3D> partNetwork = finder.exploreNetwork();
Set<IUniversalCable> newCables = new HashSet<IUniversalCable>();
for(Object3D node : partNetwork)
{
TileEntity nodeTile = node.getTileEntity(((TileEntity)cable).worldObj);
@ -306,6 +309,7 @@ public class EnergyNetwork
newCables.add((IUniversalCable)nodeTile);
}
}
EnergyNetwork newNetwork = new EnergyNetwork(newCables.toArray(new IUniversalCable[0]));
newNetwork.refresh();
newNetwork.fixed = true;
@ -411,6 +415,7 @@ public class EnergyNetwork
public void tick()
{
clearJoulesTransmitted();
//Fix weird behaviour periodically.
if(!fixed)
{

View file

@ -38,7 +38,8 @@ public class EnergyNetworkRegistry implements ITickHandler
}
}
public void pruneEmptyNetworks() {
public void pruneEmptyNetworks()
{
for(EnergyNetwork e : networks)
{
if(e.cables.size() == 0)

View file

@ -303,13 +303,13 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, II
@Override
public float receiveEnergy(ItemStack theItem, float energy, boolean doReceive)
{
return (float)(recharge(theItem, (float)(energy*Mekanism.FROM_BC), doReceive)*Mekanism.TO_BC);
return (float)(recharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doReceive)*Mekanism.TO_BC);
}
@Override
public float transferEnergy(ItemStack theItem, float energy, boolean doTransfer)
{
return (float)(discharge(theItem, (float)(energy*Mekanism.FROM_BC), doTransfer)*Mekanism.TO_BC);
return (float)(discharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doTransfer)*Mekanism.TO_BC);
}
@Override
@ -336,14 +336,14 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, II
if(canReceive(itemStack))
{
double energyNeeded = getMaxEnergy(itemStack)-getEnergy(itemStack);
double toReceive = Math.min(energy, energyNeeded);
double toReceive = Math.min(energy*Mekanism.FROM_UE, energyNeeded);
if(doRecharge)
{
setEnergy(itemStack, getEnergy(itemStack) + toReceive);
}
return (float)toReceive;
return (float)(toReceive*Mekanism.TO_UE);
}
return 0;
@ -355,14 +355,14 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, II
if(canSend(itemStack))
{
double energyRemaining = getEnergy(itemStack);
double toSend = Math.min(energy, energyRemaining);
double toSend = Math.min((energy*Mekanism.FROM_UE), energyRemaining);
if(doDischarge)
{
setEnergy(itemStack, getEnergy(itemStack) - toSend);
}
return (float)toSend;
return (float)(toSend*Mekanism.TO_UE);
}
return 0;
@ -371,24 +371,24 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, II
@Override
public float getElectricityStored(ItemStack theItem)
{
return (float)getEnergy(theItem);
return (float)(getEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public float getMaxElectricityStored(ItemStack theItem)
{
return (float)getMaxEnergy(theItem);
return (float)(getMaxEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public void setElectricity(ItemStack itemStack, float joules)
{
setEnergy(itemStack, joules);
setEnergy(itemStack, joules*Mekanism.TO_UE);
}
@Override
public float getTransfer(ItemStack itemStack)
{
return (float)getMaxTransfer(itemStack);
return (float)(getMaxTransfer(itemStack)*Mekanism.TO_UE);
}
}

View file

@ -744,13 +744,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
@Override
public float receiveEnergy(ItemStack theItem, float energy, boolean doReceive)
{
return (float)(recharge(theItem, (float)(energy*Mekanism.FROM_BC), doReceive)*Mekanism.TO_BC);
return (float)(recharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doReceive)*Mekanism.TO_BC);
}
@Override
public float transferEnergy(ItemStack theItem, float energy, boolean doTransfer)
{
return (float)(discharge(theItem, (float)(energy*Mekanism.FROM_BC), doTransfer)*Mekanism.TO_BC);
return (float)(discharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doTransfer)*Mekanism.TO_BC);
}
@Override
@ -777,14 +777,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
if(canReceive(itemStack))
{
double energyNeeded = getMaxEnergy(itemStack)-getEnergy(itemStack);
double toReceive = Math.min(energy, energyNeeded);
double toReceive = Math.min(energy*Mekanism.FROM_UE, energyNeeded);
if(doRecharge)
{
setEnergy(itemStack, getEnergy(itemStack) + toReceive);
}
return (float)toReceive;
return (float)(toReceive*Mekanism.TO_UE);
}
return 0;
@ -796,14 +796,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
if(canSend(itemStack))
{
double energyRemaining = getEnergy(itemStack);
double toSend = Math.min(energy, energyRemaining);
double toSend = Math.min((energy*Mekanism.FROM_UE), energyRemaining);
if(doDischarge)
{
setEnergy(itemStack, getEnergy(itemStack) - toSend);
}
return (float)toSend;
return (float)(toSend*Mekanism.TO_UE);
}
return 0;
@ -812,24 +812,24 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
@Override
public float getElectricityStored(ItemStack theItem)
{
return (float)getEnergy(theItem);
return (float)(getEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public float getMaxElectricityStored(ItemStack theItem)
{
return (float)getMaxEnergy(theItem);
return (float)(getMaxEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public void setElectricity(ItemStack itemStack, float joules)
{
setEnergy(itemStack, joules);
setEnergy(itemStack, joules*Mekanism.TO_UE);
}
@Override
public float getTransfer(ItemStack itemStack)
{
return (float)getMaxTransfer(itemStack);
return (float)(getMaxTransfer(itemStack)*Mekanism.TO_UE);
}
}

View file

@ -213,13 +213,13 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem
@Override
public float receiveEnergy(ItemStack theItem, float energy, boolean doReceive)
{
return (float)(recharge(theItem, (float)(energy*Mekanism.FROM_BC), doReceive)*Mekanism.TO_BC);
return (float)(recharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doReceive)*Mekanism.TO_BC);
}
@Override
public float transferEnergy(ItemStack theItem, float energy, boolean doTransfer)
{
return (float)(discharge(theItem, (float)(energy*Mekanism.FROM_BC), doTransfer)*Mekanism.TO_BC);
return (float)(discharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doTransfer)*Mekanism.TO_BC);
}
@Override
@ -246,14 +246,14 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem
if(canReceive(itemStack))
{
double energyNeeded = getMaxEnergy(itemStack)-getEnergy(itemStack);
double toReceive = Math.min(energy, energyNeeded);
double toReceive = Math.min(energy*Mekanism.FROM_UE, energyNeeded);
if(doRecharge)
{
setEnergy(itemStack, getEnergy(itemStack) + toReceive);
}
return (float)toReceive;
return (float)(toReceive*Mekanism.TO_UE);
}
return 0;
@ -265,14 +265,14 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem
if(canSend(itemStack))
{
double energyRemaining = getEnergy(itemStack);
double toSend = Math.min(energy, energyRemaining);
double toSend = Math.min((energy*Mekanism.FROM_UE), energyRemaining);
if(doDischarge)
{
setEnergy(itemStack, getEnergy(itemStack) - toSend);
}
return (float)toSend;
return (float)(toSend*Mekanism.TO_UE);
}
return 0;
@ -281,24 +281,24 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem
@Override
public float getElectricityStored(ItemStack theItem)
{
return (float)getEnergy(theItem);
return (float)(getEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public float getMaxElectricityStored(ItemStack theItem)
{
return (float)getMaxEnergy(theItem);
return (float)(getMaxEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public void setElectricity(ItemStack itemStack, float joules)
{
setEnergy(itemStack, joules);
setEnergy(itemStack, joules*Mekanism.TO_UE);
}
@Override
public float getTransfer(ItemStack itemStack)
{
return (float)getMaxTransfer(itemStack);
return (float)(getMaxTransfer(itemStack)*Mekanism.TO_UE);
}
}

View file

@ -189,6 +189,8 @@ public class Mekanism
public static double TO_BC;
public static double FROM_IC2;
public static double FROM_BC;
public static double TO_UE = .001;
public static double FROM_UE = 1000;
public static double ENERGY_PER_REDSTONE = 10000;
//Usage Configuration

View file

@ -182,14 +182,14 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
{
if(getConsumingSides().contains(from))
{
float toAdd = (float)Math.min(getMaxEnergy()-getEnergy(), receive.getWatts());
double toAdd = (float)Math.min(getMaxEnergy()-getEnergy(), receive.getWatts()*Mekanism.FROM_UE);
if(doReceive)
{
setEnergy(getEnergy() + toAdd);
}
return toAdd;
return (float)(toAdd*Mekanism.TO_UE);
}
return 0;
@ -206,7 +206,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
{
if(getConsumingSides().contains(direction))
{
return (float)(getMaxEnergy()-getEnergy());
return (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_UE);
}
return 0;
@ -221,18 +221,18 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
@Override
public void setEnergyStored(float energy)
{
setEnergy(energy);
setEnergy(energy*Mekanism.FROM_UE);
}
@Override
public float getEnergyStored()
{
return (float)getEnergy();
return (float)(getEnergy()*Mekanism.TO_UE);
}
@Override
public float getMaxEnergyStored()
{
return (float)getMaxEnergy();
return (float)(getMaxEnergy()*Mekanism.TO_UE);
}
}

View file

@ -37,13 +37,13 @@ public class GuiBioGenerator extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("BioFuel: " + tileEntity.bioFuelSlot.fluidStored, 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -38,13 +38,13 @@ public class GuiHeatGenerator extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("Fuel: " + (tileEntity.lavaTank.getFluid() != null ? tileEntity.lavaTank.getFluid().amount : 0), 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -38,13 +38,13 @@ public class GuiHydrogenGenerator extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("H: " + tileEntity.hydrogenStored, 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -38,13 +38,13 @@ public class GuiSolarGenerator extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, tileEntity.fullName != "Advanced Solar Generator" ? 45 : 30, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("Sun: " + tileEntity.seesSun, 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -39,7 +39,7 @@ public class GuiWindTurbine extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("Power: " + MekanismGenerators.windGeneration*tileEntity.getMultiplier(), 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
@ -53,7 +53,7 @@ public class GuiWindTurbine extends GuiContainer
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
}
}

View file

@ -414,13 +414,13 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
@Override
public float receiveEnergy(ItemStack theItem, float energy, boolean doReceive)
{
return (float)(recharge(theItem, (float)(energy*Mekanism.FROM_BC), doReceive)*Mekanism.TO_BC);
return (float)(recharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doReceive)*Mekanism.TO_BC);
}
@Override
public float transferEnergy(ItemStack theItem, float energy, boolean doTransfer)
{
return (float)(discharge(theItem, (float)(energy*Mekanism.FROM_BC), doTransfer)*Mekanism.TO_BC);
return (float)(discharge(theItem, (float)((energy*Mekanism.FROM_BC)*Mekanism.TO_UE), doTransfer)*Mekanism.TO_BC);
}
@Override
@ -447,14 +447,14 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
if(canReceive(itemStack))
{
double energyNeeded = getMaxEnergy(itemStack)-getEnergy(itemStack);
double toReceive = Math.min(energy, energyNeeded);
double toReceive = Math.min(energy*Mekanism.FROM_UE, energyNeeded);
if(doRecharge)
{
setEnergy(itemStack, getEnergy(itemStack) + toReceive);
}
return (float)toReceive;
return (float)(toReceive*Mekanism.TO_UE);
}
return 0;
@ -466,14 +466,14 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
if(canSend(itemStack))
{
double energyRemaining = getEnergy(itemStack);
double toSend = Math.min(energy, energyRemaining);
double toSend = Math.min((energy*Mekanism.FROM_UE), energyRemaining);
if(doDischarge)
{
setEnergy(itemStack, getEnergy(itemStack) - toSend);
}
return (float)toSend;
return (float)(toSend*Mekanism.TO_UE);
}
return 0;
@ -482,24 +482,24 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
@Override
public float getElectricityStored(ItemStack theItem)
{
return (float)getEnergy(theItem);
return (float)(getEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public float getMaxElectricityStored(ItemStack theItem)
{
return (float)getMaxEnergy(theItem);
return (float)(getMaxEnergy(theItem)*Mekanism.TO_UE);
}
@Override
public void setElectricity(ItemStack itemStack, float joules)
{
setEnergy(itemStack, joules);
setEnergy(itemStack, joules*Mekanism.TO_UE);
}
@Override
public float getTransfer(ItemStack itemStack)
{
return (float)getMaxTransfer(itemStack);
return (float)(getMaxTransfer(itemStack)*Mekanism.TO_UE);
}
}