Refactor Laser Tables to share common ancestor
This commit is contained in:
parent
fedb4d5a42
commit
4356c1098b
5 changed files with 183 additions and 208 deletions
|
@ -48,7 +48,7 @@ import static net.minecraftforge.common.ForgeDirection.WEST;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
|
||||
public class TileAdvancedCraftingTable extends TileEntity implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
|
||||
public class TileAdvancedCraftingTable extends TileLaserTableBase implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
|
||||
|
||||
private final class InternalInventoryCraftingContainer extends Container {
|
||||
|
||||
|
@ -175,12 +175,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
private final InventoryMapper invInput;
|
||||
private final InventoryMapper invOutput;
|
||||
private SlotCrafting craftSlot;
|
||||
private float storedEnergy;
|
||||
private float[] recentEnergy = new float[20];
|
||||
private boolean craftable;
|
||||
private boolean justCrafted;
|
||||
private int tick;
|
||||
private int recentEnergyAverage;
|
||||
private InternalPlayer internalPlayer;
|
||||
private IRecipe currentRecipe;
|
||||
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
|
||||
|
@ -216,7 +212,6 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
super.writeToNBT(data);
|
||||
storageSlots.writeToNBT(data, "StorageSlots");
|
||||
craftingSlots.writeToNBT(data);
|
||||
data.setFloat("StoredEnergy", storedEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -224,7 +219,6 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
super.readFromNBT(data);
|
||||
storageSlots.readFromNBT(data, "StorageSlots");
|
||||
craftingSlots.readFromNBT(data);
|
||||
storedEnergy = data.getFloat("StoredEnergy");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -256,20 +250,13 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
public void closeChest() {
|
||||
}
|
||||
|
||||
public int getRecentEnergyAverage() {
|
||||
return recentEnergyAverage;
|
||||
}
|
||||
|
||||
public float getStoredEnergy() {
|
||||
return storedEnergy;
|
||||
}
|
||||
|
||||
public float getRequiredEnergy() {
|
||||
@Override
|
||||
public double getRequiredEnergy() {
|
||||
return craftResult.getStackInSlot(0) != null ? REQUIRED_POWER : 0f;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int i) {
|
||||
return (int) ((storedEnergy * i) / REQUIRED_POWER);
|
||||
return (int) ((getEnergy() * i) / REQUIRED_POWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -295,11 +282,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
locateAndBindIngredients();
|
||||
updateRecipeOutputDisplay();
|
||||
justCrafted = false;
|
||||
tick++;
|
||||
tick = tick % recentEnergy.length;
|
||||
recentEnergy[tick] = 0.0f;
|
||||
if (canCraftAndOutput()) {
|
||||
if (storedEnergy >= getRequiredEnergy()) {
|
||||
if (getEnergy() >= getRequiredEnergy()) {
|
||||
craftItem();
|
||||
justCrafted = true;
|
||||
}
|
||||
|
@ -307,7 +291,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
craftable = false;
|
||||
internalInventoryCrafting.tempStacks = null;
|
||||
internalInventoryCrafting.hitCount = null;
|
||||
storedEnergy = 0;
|
||||
setEnergy(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,7 +354,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
}
|
||||
storageSlots.getItemStacks()[i] = tempStorage[i];
|
||||
}
|
||||
storedEnergy -= getRequiredEnergy();
|
||||
subtractEnergy(getRequiredEnergy());
|
||||
List<ItemStack> outputs = Lists.newArrayList(recipeOutput.copy());
|
||||
for (int i = 0; i < internalPlayer.inventory.mainInventory.length; i++) {
|
||||
if (internalPlayer.inventory.mainInventory[i] != null) {
|
||||
|
@ -465,29 +449,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLaserEnergy() {
|
||||
return craftable && !justCrafted && lastMode != ActionMachineControl.Mode.Off && storedEnergy < REQUIRED_POWER * 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(float energy) {
|
||||
storedEnergy += energy;
|
||||
recentEnergy[tick] += energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord() {
|
||||
return zCoord;
|
||||
public boolean canCraft() {
|
||||
return craftable && !justCrafted && lastMode != ActionMachineControl.Mode.Off;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -510,38 +473,6 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
return action == BuildCraftCore.actionOn || action == BuildCraftCore.actionOff;
|
||||
}
|
||||
|
||||
public void getGUINetworkData(int id, int data) {
|
||||
int currentStored = (int) (storedEnergy * 100.0);
|
||||
switch (id) {
|
||||
case 1:
|
||||
currentStored = (currentStored & 0xFFFF0000) | (data & 0xFFFF);
|
||||
storedEnergy = (currentStored / 100.0f);
|
||||
break;
|
||||
case 3:
|
||||
currentStored = (currentStored & 0xFFFF) | ((data & 0xFFFF) << 16);
|
||||
storedEnergy = (currentStored / 100.0f);
|
||||
break;
|
||||
case 4:
|
||||
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (data & 0xFFFF);
|
||||
break;
|
||||
case 5:
|
||||
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((data & 0xFFFF) << 16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
int currentStored = (int) (storedEnergy * 100.0);
|
||||
int lRecentEnergy = 0;
|
||||
for (int i = 0; i < recentEnergy.length; i++) {
|
||||
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
|
||||
}
|
||||
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -576,9 +507,4 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
lastMode = ActionMachineControl.Mode.Off;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalidTarget() {
|
||||
return isInvalid();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package buildcraft.silicon;
|
||||
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager;
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.IMachine;
|
||||
|
@ -18,25 +17,17 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class TileAssemblyTable extends TileEntity implements IMachine, IInventory, ILaserTarget {
|
||||
public class TileAssemblyTable extends TileLaserTableBase implements IMachine, IInventory {
|
||||
|
||||
ItemStack[] items = new ItemStack[12];
|
||||
Set<AssemblyRecipe> plannedOutput = new LinkedHashSet<AssemblyRecipe>();
|
||||
public AssemblyRecipe currentRecipe;
|
||||
private double currentRequiredEnergy = 0;
|
||||
private float energyStored = 0;
|
||||
private double[] recentEnergy = new double[20];
|
||||
private int tick = 0;
|
||||
private int recentEnergyAverage;
|
||||
|
||||
public static class SelectionMessage {
|
||||
|
||||
|
@ -77,10 +68,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
|
||||
@Override
|
||||
public void updateEntity() { // WARNING: run only server-side, see canUpdate()
|
||||
tick++;
|
||||
tick = tick % recentEnergy.length;
|
||||
recentEnergy[tick] = 0.0f;
|
||||
|
||||
if (currentRecipe == null)
|
||||
return;
|
||||
|
||||
|
@ -91,8 +78,8 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
return;
|
||||
}
|
||||
|
||||
if (energyStored >= currentRecipe.getEnergyCost()) {
|
||||
energyStored = 0;
|
||||
if (getEnergy() >= currentRecipe.getEnergyCost()) {
|
||||
setEnergy(0);
|
||||
|
||||
if (currentRecipe.canBeDone(this)) {
|
||||
|
||||
|
@ -116,15 +103,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
}
|
||||
}
|
||||
|
||||
public double getCompletionRatio(float ratio) {
|
||||
if (currentRecipe == null)
|
||||
return 0;
|
||||
else if (energyStored >= currentRequiredEnergy)
|
||||
return ratio;
|
||||
else
|
||||
return energyStored / currentRequiredEnergy * ratio;
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
|
@ -193,8 +171,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
|
||||
InvUtils.readStacksFromNBT(nbt, "items", items);
|
||||
|
||||
energyStored = nbt.getFloat("energyStored");
|
||||
|
||||
NBTTagList list = nbt.getTagList("planned");
|
||||
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
|
@ -228,8 +204,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
|
||||
InvUtils.writeStacksToNBT(nbt, "items", items);
|
||||
|
||||
nbt.setFloat("energyStored", energyStored);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for (AssemblyRecipe recipe : plannedOutput) {
|
||||
|
@ -260,11 +234,14 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
|
||||
private void setCurrentRecipe(AssemblyRecipe recipe) {
|
||||
this.currentRecipe = recipe;
|
||||
if (recipe != null) {
|
||||
this.currentRequiredEnergy = recipe.getEnergyCost();
|
||||
} else {
|
||||
this.currentRequiredEnergy = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRequiredEnergy() {
|
||||
if (currentRecipe != null) {
|
||||
return currentRecipe.getEnergyCost();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void planOutput(AssemblyRecipe recipe) {
|
||||
|
@ -347,51 +324,6 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
}
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
int currentStored = (int) (energyStored * 100.0);
|
||||
int requiredEnergy = (int) (currentRequiredEnergy * 100.0);
|
||||
switch (i) {
|
||||
case 0:
|
||||
requiredEnergy = (requiredEnergy & 0xFFFF0000) | (j & 0xFFFF);
|
||||
currentRequiredEnergy = (requiredEnergy / 100.0f);
|
||||
break;
|
||||
case 1:
|
||||
currentStored = (currentStored & 0xFFFF0000) | (j & 0xFFFF);
|
||||
energyStored = (currentStored / 100.0f);
|
||||
break;
|
||||
case 2:
|
||||
requiredEnergy = (requiredEnergy & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
currentRequiredEnergy = (requiredEnergy / 100.0f);
|
||||
break;
|
||||
case 3:
|
||||
currentStored = (currentStored & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
energyStored = (currentStored / 100.0f);
|
||||
break;
|
||||
case 4:
|
||||
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (j & 0xFFFF);
|
||||
break;
|
||||
case 5:
|
||||
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
int requiredEnergy = (int) (currentRequiredEnergy * 100.0);
|
||||
int currentStored = (int) (energyStored * 100.0);
|
||||
int lRecentEnergy = 0;
|
||||
for (int i = 0; i < recentEnergy.length; i++) {
|
||||
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
|
||||
}
|
||||
iCrafting.sendProgressBarUpdate(container, 0, requiredEnergy & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 2, (requiredEnergy >>> 16) & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return currentRecipe != null;
|
||||
|
@ -412,42 +344,9 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
return false;
|
||||
}
|
||||
|
||||
public int getRecentEnergyAverage() {
|
||||
return recentEnergyAverage;
|
||||
}
|
||||
|
||||
public float getStoredEnergy() {
|
||||
return energyStored;
|
||||
}
|
||||
|
||||
public double getRequiredEnergy() {
|
||||
return currentRequiredEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLaserEnergy() {
|
||||
return currentRecipe != null && energyStored < currentRequiredEnergy * 5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(float energy) {
|
||||
energyStored += energy;
|
||||
recentEnergy[tick] += energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord() {
|
||||
return zCoord;
|
||||
public boolean canCraft() {
|
||||
return currentRecipe != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -460,9 +359,4 @@ public class TileAssemblyTable extends TileEntity implements IMachine, IInventor
|
|||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalidTarget() {
|
||||
return isInvalid();
|
||||
}
|
||||
}
|
||||
|
|
155
common/buildcraft/silicon/TileLaserTableBase.java
Normal file
155
common/buildcraft/silicon/TileLaserTableBase.java
Normal file
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Copyright (c) SpaceToad, 2011-2012
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.silicon;
|
||||
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public abstract class TileLaserTableBase extends TileBuildCraft implements ILaserTarget {
|
||||
|
||||
public double clientRequiredEnergy = 0;
|
||||
private double[] recentEnergy = new double[20];
|
||||
private double energy = 0;
|
||||
private int tick = 0;
|
||||
private int recentEnergyAverage;
|
||||
|
||||
@Override
|
||||
public void updateEntity() { // WARNING: run only server-side, see canUpdate()
|
||||
tick++;
|
||||
tick = tick % recentEnergy.length;
|
||||
recentEnergy[tick] = 0.0f;
|
||||
}
|
||||
|
||||
public double getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
||||
public void setEnergy(double energy) {
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
public void addEnergy(double energy) {
|
||||
this.energy += energy;
|
||||
}
|
||||
|
||||
public void subtractEnergy(double energy) {
|
||||
this.energy -= energy;
|
||||
}
|
||||
|
||||
public abstract double getRequiredEnergy();
|
||||
|
||||
public double getCompletionRatio(float ratio) {
|
||||
if (!canCraft())
|
||||
return 0;
|
||||
if (energy >= clientRequiredEnergy)
|
||||
return ratio;
|
||||
return energy / clientRequiredEnergy * ratio;
|
||||
}
|
||||
|
||||
public int getRecentEnergyAverage() {
|
||||
return recentEnergyAverage;
|
||||
}
|
||||
|
||||
public abstract boolean canCraft();
|
||||
|
||||
@Override
|
||||
public boolean requiresLaserEnergy() {
|
||||
return canCraft() && energy < getRequiredEnergy() * 5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(float energy) {
|
||||
energy += energy;
|
||||
recentEnergy[tick] += energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalidTarget() {
|
||||
return isInvalid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord() {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
energy = nbt.getDouble("energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setDouble("energy", energy);
|
||||
}
|
||||
/* SMP GUI */
|
||||
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
int currentStored = (int) (energy * 100.0);
|
||||
int requiredEnergy = (int) (clientRequiredEnergy * 100.0);
|
||||
switch (i) {
|
||||
case 0:
|
||||
requiredEnergy = (requiredEnergy & 0xFFFF0000) | (j & 0xFFFF);
|
||||
clientRequiredEnergy = (requiredEnergy / 100.0f);
|
||||
break;
|
||||
case 1:
|
||||
currentStored = (currentStored & 0xFFFF0000) | (j & 0xFFFF);
|
||||
energy = (currentStored / 100.0f);
|
||||
break;
|
||||
case 2:
|
||||
requiredEnergy = (requiredEnergy & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
clientRequiredEnergy = (requiredEnergy / 100.0f);
|
||||
break;
|
||||
case 3:
|
||||
currentStored = (currentStored & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
energy = (currentStored / 100.0f);
|
||||
break;
|
||||
case 4:
|
||||
recentEnergyAverage = recentEnergyAverage & 0xFFFF0000 | (j & 0xFFFF);
|
||||
break;
|
||||
case 5:
|
||||
recentEnergyAverage = (recentEnergyAverage & 0xFFFF) | ((j & 0xFFFF) << 16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
int requiredEnergy = (int) (getRequiredEnergy() * 100.0);
|
||||
int currentStored = (int) (energy * 100.0);
|
||||
int lRecentEnergy = 0;
|
||||
for (int i = 0; i < recentEnergy.length; i++) {
|
||||
lRecentEnergy += (int) (recentEnergy[i] * 100.0 / (recentEnergy.length - 1));
|
||||
}
|
||||
iCrafting.sendProgressBarUpdate(container, 0, requiredEnergy & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 1, currentStored & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 2, (requiredEnergy >>> 16) & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 3, (currentStored >>> 16) & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 4, lRecentEnergy & 0xFFFF);
|
||||
iCrafting.sendProgressBarUpdate(container, 5, (lRecentEnergy >>> 16) & 0xFFFF);
|
||||
}
|
||||
}
|
|
@ -43,9 +43,9 @@ public class GuiAdvancedCraftingTable extends GuiBuildCraft {
|
|||
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", workbench.getRequiredEnergy()), x + 22, y + 32, textColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", workbench.clientRequiredEnergy), x + 22, y + 32, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", workbench.getStoredEnergy()), x + 22, y + 56, textColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", workbench.getEnergy()), x + 22, y + 56, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%3.2f MJ/t", workbench.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class GuiAdvancedCraftingTable extends GuiBuildCraft {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
if (workbench.getStoredEnergy() > 0) {
|
||||
if (workbench.getEnergy() > 0) {
|
||||
int progress = workbench.getProgressScaled(24);
|
||||
drawTexturedModalRect(cornerX + 93, cornerY + 32, 176, 0, progress + 1, 18);
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.getRequiredEnergy()), x + 22, y + 32, textColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.clientRequiredEnergy), x + 22, y + 32, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.getStoredEnergy()), x + 22, y + 56, textColour);
|
||||
fontRenderer.drawString(String.format("%2.1f MJ", assemblyTable.getEnergy()), x + 22, y + 56, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
|
||||
fontRenderer.drawString(String.format("%3.2f MJ/t", assemblyTable.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
|
||||
|
||||
|
@ -158,9 +158,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
}
|
||||
}
|
||||
|
||||
int height = (int) assemblyTable.getCompletionRatio(70);
|
||||
int h = (int) assemblyTable.getCompletionRatio(70);
|
||||
|
||||
drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - height, 176, 18, 4, height);
|
||||
drawTexturedModalRect(cornerX + 95, cornerY + 36 + 70 - h, 176, 18, 4, h);
|
||||
|
||||
drawBackgroundSlots();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue