Improved battery GUI information

This commit is contained in:
Calclavia 2013-08-12 20:04:48 +08:00
parent 53054f6c5e
commit 0f66ba8360
4 changed files with 12 additions and 84 deletions

View file

@ -20,7 +20,7 @@
<exclude name=".git/**"/>
<exclude name="**/*.xml"/>
</fileset>
<fileset dir="${dir.development}Universal-Electricity/src">
<fileset dir="${dir.development}Modding-Library/src">
<exclude name=".git/**"/>
<exclude name="**/*.xml"/>
</fileset>

View file

@ -102,7 +102,7 @@ public class ResonantInduction
* Settings
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static float FURNACE_WATTAGE = 4;
public static float FURNACE_WATTAGE = 1;
public static boolean SOUND_FXS = true;
/** Block ID by Jyzarc */
@ -146,7 +146,7 @@ public class ResonantInduction
CONFIGURATION.load();
// Config
FURNACE_WATTAGE = (float) CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage", FURNACE_WATTAGE).getDouble(FURNACE_WATTAGE);
FURNACE_WATTAGE = (float) CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage Per Tick", FURNACE_WATTAGE).getDouble(FURNACE_WATTAGE);
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
MAX_CONTRACTOR_DISTANCE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_CONTRACTOR_DISTANCE).getInt(MAX_CONTRACTOR_DISTANCE);

View file

@ -2,20 +2,21 @@ package resonantinduction.battery;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import resonantinduction.battery.BatteryManager.SlotBattery;
import resonantinduction.battery.BatteryManager.SlotOut;
import universalelectricity.core.item.IItemElectric;
import calclavia.lib.gui.ContainerBase;
public class ContainerBattery extends Container
public class ContainerBattery extends ContainerBase
{
private TileEntityBattery tileEntity;
public ContainerBattery(InventoryPlayer inventory, TileEntityBattery unit)
{
super(unit);
tileEntity = unit;
addSlotToContainer(new SlotBattery(unit, 0, 8, 22));
addSlotToContainer(new SlotOut(unit, 1, 8, 58));
@ -74,81 +75,4 @@ public class ContainerBattery extends Container
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot) inventorySlots.get(slotID);
if (currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if (slotID == 0 || slotID == 1)
{
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
else if (slotID == 2 || slotID == 3)
{
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
else if (slotStack.getItem() instanceof IItemElectric)
{
if (!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else
{
if (slotID >= 4 && slotID <= 30)
{
if (!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
{
return null;
}
}
else if (slotID > 30)
{
if (!mergeItemStack(slotStack, 4, 30, false))
{
return null;
}
}
else
{
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
if (slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack) null);
}
else
{
currentSlot.onSlotChanged();
}
if (slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -10,6 +10,8 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import resonantinduction.battery.ContainerBattery;
import resonantinduction.battery.TileEntityBattery;
import universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
public class GuiBattery extends GuiContainer
{
@ -32,8 +34,10 @@ public class GuiBattery extends GuiContainer
fontRenderer.drawString("Battery", 43, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
fontRenderer.drawString("Cells: " + tileEntity.clientCells + " / " + tileEntity.structure.getMaxCells(), 62, 23, 0x404040);
fontRenderer.drawString("Energy: " + (int) tileEntity.getEnergyStored() + " / " + (int) tileEntity.getMaxEnergyStored(), 62, 32, 0x404040);
fontRenderer.drawString("Volume: " + tileEntity.structure.getVolume(), 62, 41, 0x404040);
fontRenderer.drawString("Energy: " + ElectricityDisplay.getDisplayShort(this.tileEntity.getEnergyStored(), ElectricUnit.JOULES), 62, 33, 0x404040);
fontRenderer.drawString("Max: " + ElectricityDisplay.getDisplayShort(this.tileEntity.getMaxEnergyStored(), ElectricUnit.JOULES), 62, 43, 0x404040);
fontRenderer.drawString("Percentage: " + (int) (this.tileEntity.getEnergyStored() / this.tileEntity.getMaxEnergyStored() * 100) + "%", 62, 53, 0x404040);
fontRenderer.drawString("Volume: " + tileEntity.structure.getVolume(), 62, 63, 0x404040);
}
@Override