Added Forestry-style energy ledger to engines.
This commit is contained in:
parent
6f8d594197
commit
175703ddf2
24 changed files with 399 additions and 44 deletions
|
@ -109,7 +109,7 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
|
||||
public AdvancedSlot[] slots;
|
||||
|
||||
public GuiAdvancedInterface(Container container) {
|
||||
public GuiAdvancedInterface(BuildCraftContainer container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,233 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.core.utils.SessionVars;
|
||||
|
||||
public abstract class GuiBuildCraft extends GuiContainer {
|
||||
|
||||
public GuiBuildCraft(Container par1Container) {
|
||||
super(par1Container);
|
||||
/// LEDGERS
|
||||
protected LedgerManager ledgerManager = new LedgerManager(this);
|
||||
|
||||
protected class LedgerManager {
|
||||
|
||||
private GuiBuildCraft gui;
|
||||
protected ArrayList<Ledger> ledgers = new ArrayList<Ledger>();
|
||||
|
||||
public LedgerManager(GuiBuildCraft gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public void add(Ledger ledger) {
|
||||
this.ledgers.add(ledger);
|
||||
if(SessionVars.getOpenedLedger() != null
|
||||
&& ledger.getClass().equals(SessionVars.getOpenedLedger()))
|
||||
ledger.setFullyOpen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a ledger into the next-to-last position.
|
||||
* @param ledger
|
||||
*/
|
||||
public void insert(Ledger ledger) {
|
||||
this.ledgers.add(ledgers.size() - 1, ledger);
|
||||
}
|
||||
|
||||
protected Ledger getAtPosition(int mX, int mY) {
|
||||
|
||||
int xShift = ((gui.width - gui.xSize) / 2) + gui.xSize;
|
||||
int yShift = ((gui.height - gui.ySize) / 2) + 8;
|
||||
|
||||
for(int i = 0; i < ledgers.size(); i++) {
|
||||
Ledger ledger = ledgers.get(i);
|
||||
if(!ledger.isVisible())
|
||||
continue;
|
||||
|
||||
ledger.currentShiftX = xShift;
|
||||
ledger.currentShiftY = yShift;
|
||||
if(ledger.intersectsWith(mX, mY, xShift, yShift))
|
||||
return ledger;
|
||||
|
||||
yShift += ledger.getHeight();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void drawLedgers(int mouseX, int mouseY) {
|
||||
|
||||
int xPos = 8;
|
||||
for(Ledger ledger : ledgers) {
|
||||
|
||||
ledger.update();
|
||||
if(!ledger.isVisible())
|
||||
continue;
|
||||
|
||||
ledger.draw(xSize, xPos);
|
||||
xPos += ledger.getHeight();
|
||||
}
|
||||
|
||||
Ledger ledger = getAtPosition(mouseX, mouseY);
|
||||
if(ledger != null) {
|
||||
int startX = mouseX - ((gui.width - gui.xSize) / 2) + 12;
|
||||
int startY = mouseY - ((gui.height - gui.ySize) / 2) - 12;
|
||||
|
||||
String tooltip = ledger.getTooltip();
|
||||
int textWidth = fontRenderer.getStringWidth(tooltip);
|
||||
drawGradientRect(startX - 3, startY - 3, startX + textWidth + 3, startY + 8 + 3, 0xc0000000, 0xc0000000);
|
||||
fontRenderer.drawStringWithShadow(tooltip, startX, startY, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleMouseClicked(int x, int y, int mouseButton) {
|
||||
|
||||
if(mouseButton == 0) {
|
||||
|
||||
Ledger ledger = this.getAtPosition(x, y);
|
||||
|
||||
// Default action only if the mouse click was not handled by the ledger itself.
|
||||
if(ledger != null
|
||||
&& !ledger.handleMouseClicked(x, y, mouseButton)) {
|
||||
|
||||
for(Ledger other : ledgers)
|
||||
if(other != ledger
|
||||
&& other.isOpen())
|
||||
other.toggleOpen();
|
||||
ledger.toggleOpen();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Side ledger for guis
|
||||
*/
|
||||
protected abstract class Ledger {
|
||||
private boolean open;
|
||||
|
||||
protected int overlayColor = 0xffffff;
|
||||
|
||||
public int currentShiftX = 0;
|
||||
public int currentShiftY = 0;
|
||||
|
||||
protected int limitWidth = 128;
|
||||
protected int maxWidth = 124;
|
||||
protected int minWidth = 24;
|
||||
protected int currentWidth = minWidth;
|
||||
|
||||
protected int maxHeight = 24;
|
||||
protected int minHeight = 24;
|
||||
protected int currentHeight = minHeight;
|
||||
|
||||
public void update() {
|
||||
// Width
|
||||
if(open && currentWidth < maxWidth)
|
||||
currentWidth += 4;
|
||||
else if(!open && currentWidth > minWidth)
|
||||
currentWidth -= 4;
|
||||
|
||||
// Height
|
||||
if(open && currentHeight < maxHeight)
|
||||
currentHeight += 4;
|
||||
else if(!open && currentHeight > minHeight)
|
||||
currentHeight -= 4;
|
||||
}
|
||||
|
||||
public int getHeight() { return currentHeight; }
|
||||
public abstract void draw(int x, int y);
|
||||
public abstract String getTooltip();
|
||||
|
||||
public boolean handleMouseClicked(int x, int y, int mouseButton) { return false; }
|
||||
public boolean intersectsWith(int mouseX, int mouseY, int shiftX, int shiftY) {
|
||||
|
||||
if(mouseX >= shiftX && mouseX <= shiftX + currentWidth
|
||||
&& mouseY >= shiftY && mouseY <= shiftY + getHeight())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setFullyOpen() {
|
||||
open = true;
|
||||
currentWidth = maxWidth;
|
||||
currentHeight = maxHeight;
|
||||
}
|
||||
public void toggleOpen() {
|
||||
if(open) {
|
||||
open = false;
|
||||
SessionVars.setOpenedLedger(null);
|
||||
} else {
|
||||
open = true;
|
||||
SessionVars.setOpenedLedger(this.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVisible() { return true; }
|
||||
public boolean isOpen() { return this.open; }
|
||||
|
||||
protected boolean isFullyOpened() {
|
||||
return currentWidth >= maxWidth;
|
||||
}
|
||||
|
||||
protected void drawBackground(int x, int y) {
|
||||
int texture = mc.renderEngine.getTexture("/gfx/gui/ledger.png");
|
||||
|
||||
float colorR = (overlayColor >> 16 & 255) / 255.0F;
|
||||
float colorG = (overlayColor >> 8 & 255) / 255.0F;
|
||||
float colorB = (overlayColor & 255) / 255.0F;
|
||||
|
||||
GL11.glColor4f(colorR, colorG, colorB, 1.0F);
|
||||
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(x, y, 0, 256 - currentHeight, 4, currentHeight);
|
||||
drawTexturedModalRect(x + 4, y, 256 - currentWidth + 4, 0, currentWidth - 4, 4);
|
||||
// Add in top left corner again
|
||||
drawTexturedModalRect(x, y, 0, 0, 4, 4);
|
||||
|
||||
drawTexturedModalRect(x + 4, y + 4, 256 - currentWidth + 4, 256 - currentHeight + 4, currentWidth - 4, currentHeight - 4);
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
|
||||
}
|
||||
|
||||
protected void drawIcon(String texture, int iconIndex, int x, int y) {
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
|
||||
int tex = mc.renderEngine.getTexture(texture);
|
||||
mc.renderEngine.bindTexture(tex);
|
||||
int textureRow = iconIndex >> 4;
|
||||
int textureColumn = iconIndex - 16 * textureRow;
|
||||
drawTexturedModalRect(x , y, 16 * textureColumn, 16 * textureRow, 16, 16);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected TileEntity tile;
|
||||
|
||||
public GuiBuildCraft(BuildCraftContainer container) {
|
||||
super(container);
|
||||
|
||||
if(container.inventory instanceof TileEntity)
|
||||
tile = (TileEntity)container.inventory;
|
||||
|
||||
initLedgers(container.inventory);
|
||||
}
|
||||
|
||||
protected void initLedgers(IInventory inventory) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
ledgerManager.drawLedgers(mouseX, mouseY);
|
||||
}
|
||||
|
||||
protected int getCenteredOffset(String string) {
|
||||
return getCenteredOffset(string, xSize);
|
||||
}
|
||||
|
@ -16,5 +235,25 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
|||
return (xWidth - fontRenderer.getStringWidth(string)) / 2;
|
||||
}
|
||||
|
||||
/// MOUSE CLICKS
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int mouseButton) {
|
||||
super.mouseClicked(par1, par2, mouseButton);
|
||||
|
||||
/// Handle ledger clicks
|
||||
ledgerManager.handleMouseClicked(par1, par2, mouseButton);
|
||||
}
|
||||
|
||||
/// MOUSE MOVEMENT
|
||||
private int mouseX = 0;
|
||||
private int mouseY = 0;
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int i, int j, int k) {
|
||||
super.mouseMovedOrUp(i, j, k);
|
||||
|
||||
mouseX = i;
|
||||
mouseY = j;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,19 +20,17 @@ import net.minecraft.src.forge.MinecraftForgeClient;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiCombustionEngine extends GuiBuildCraft {
|
||||
|
||||
private TileEngine tileEngine;
|
||||
public class GuiCombustionEngine extends GuiEngine {
|
||||
|
||||
public GuiCombustionEngine(InventoryPlayer inventoryplayer, TileEngine tileEngine)
|
||||
{
|
||||
super(new ContainerEngine(inventoryplayer, tileEngine));
|
||||
this.tileEngine = tileEngine;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer();
|
||||
String title = StringUtil.localize("tile.engineIron");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
@ -48,10 +46,11 @@ public class GuiCombustionEngine extends GuiBuildCraft {
|
|||
int k = (height - ySize) / 2;
|
||||
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
|
||||
|
||||
EngineIron engineIron = ((EngineIron) tileEngine.engine);
|
||||
TileEngine engine = (TileEngine)tile;
|
||||
EngineIron engineIron = ((EngineIron) engine.engine);
|
||||
|
||||
if (tileEngine.getScaledBurnTime(58) > 0)
|
||||
displayGauge(j, k, 19, 104, tileEngine.getScaledBurnTime(58), engineIron.liquidId);
|
||||
if (engine.getScaledBurnTime(58) > 0)
|
||||
displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engineIron.liquidId);
|
||||
|
||||
if (engineIron.getScaledCoolant(58) > 0)
|
||||
displayGauge(j, k, 19, 122, engineIron.getScaledCoolant(58), engineIron.coolantId);
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package net.minecraft.src.buildcraft.energy;
|
||||
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.buildcraft.core.BuildCraftContainer;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.buildcraft.core.utils.StringUtil;
|
||||
|
||||
public abstract class GuiEngine extends GuiBuildCraft {
|
||||
|
||||
protected class EngineLedger extends Ledger {
|
||||
|
||||
Engine engine;
|
||||
int headerColour = 0xe1c92f;
|
||||
int subheaderColour = 0xaaafb8;
|
||||
int textColour = 0x000000;
|
||||
|
||||
public EngineLedger(Engine engine) {
|
||||
this.engine = engine;
|
||||
maxHeight = 94;
|
||||
overlayColor = 0xd46c1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
|
||||
// Draw background
|
||||
drawBackground(x, y);
|
||||
|
||||
// Draw icon
|
||||
drawIcon(DefaultProps.TEXTURE_ICONS, 0, x + 3, y + 4);
|
||||
|
||||
if(!isFullyOpened())
|
||||
return;
|
||||
|
||||
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.energy"), x + 22, y + 8, headerColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.currentOutput") + ":", x + 22, y + 20, subheaderColour);
|
||||
fontRenderer.drawString(engine.getCurrentOutput() + " MJ/t", x + 22, y + 32, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
|
||||
fontRenderer.drawString(engine.getEnergyStored() + " MJ", x + 22, y + 56, textColour);
|
||||
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.heat") + ":", x + 22, y + 68, subheaderColour);
|
||||
fontRenderer.drawString((double)((double)engine.getHeat() / (double)10) + " °C", x + 22, y + 80, textColour);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return engine.getCurrentOutput() + " MJ/t";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public GuiEngine(BuildCraftContainer container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initLedgers(IInventory inventory) {
|
||||
super.initLedgers(inventory);
|
||||
ledgerManager.add(new EngineLedger(((TileEngine)tile).engine));
|
||||
}
|
||||
|
||||
}
|
|
@ -16,17 +16,15 @@ import net.minecraft.src.buildcraft.core.utils.StringUtil;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiSteamEngine extends GuiBuildCraft {
|
||||
|
||||
private TileEngine tileEngine;
|
||||
public class GuiSteamEngine extends GuiEngine {
|
||||
|
||||
public GuiSteamEngine(InventoryPlayer inventoryplayer, TileEngine tileEngine) {
|
||||
super(new ContainerEngine(inventoryplayer, tileEngine));
|
||||
this.tileEngine = tileEngine;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
super.drawGuiContainerForegroundLayer();
|
||||
String title = StringUtil.localize("tile.engineStone");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
@ -42,8 +40,9 @@ public class GuiSteamEngine extends GuiBuildCraft {
|
|||
int k = (height - ySize) / 2;
|
||||
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
|
||||
|
||||
if (tileEngine.getScaledBurnTime(12) > 0) {
|
||||
int l = tileEngine.getScaledBurnTime(12);
|
||||
TileEngine engine = (TileEngine)tile;
|
||||
if (engine.getScaledBurnTime(12) > 0) {
|
||||
int l = engine.getScaledBurnTime(12);
|
||||
|
||||
drawTexturedModalRect(j + 80, (k + 24 + 12) - l, 176, 12 - l, 14,
|
||||
l + 2);
|
||||
|
|
|
@ -7,6 +7,10 @@ gui.inventory=Inventory
|
|||
gui.lock=Lock
|
||||
gui.needed=Needed
|
||||
gui.unlock=Unlock
|
||||
gui.energy=Energy
|
||||
gui.currentOutput=Current Output
|
||||
gui.stored=Stored
|
||||
gui.heat=Heat
|
||||
item.bucketFuel=Fuel Bucket
|
||||
item.bucketOil=Oil Bucket
|
||||
item.woodenGearItem=Wood Gear
|
||||
|
|
|
@ -25,7 +25,7 @@ class ContainerBlueprintLibrary extends BuildCraftContainer {
|
|||
TileBlueprintLibrary library;
|
||||
|
||||
public ContainerBlueprintLibrary (EntityPlayer player, TileBlueprintLibrary library) {
|
||||
super (0);
|
||||
super (library);
|
||||
this.playerInventory = player.inventory;
|
||||
this.library = library;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class CraftingBuilder extends BuildCraftContainer {
|
|||
TileBuilder builder;
|
||||
|
||||
public CraftingBuilder (IInventory playerInventory, TileBuilder builder) {
|
||||
super (builder.getSizeInventory());
|
||||
super (builder);
|
||||
this.playerIInventory = playerInventory;
|
||||
this.builder = builder;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class CraftingFiller extends BuildCraftContainer {
|
|||
IInventory fillerInventory;
|
||||
|
||||
public CraftingFiller (IInventory playerInventory, IInventory fillerInventory) {
|
||||
super (fillerInventory.getSizeInventory());
|
||||
super (fillerInventory);
|
||||
this.playerIInventory = playerInventory;
|
||||
this.fillerInventory = fillerInventory;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class CraftingTemplateRoot extends BuildCraftContainer {
|
|||
int computingTime = 0;
|
||||
|
||||
public CraftingTemplateRoot (IInventory playerInventory, TileArchitect template) {
|
||||
super (template.getSizeInventory());
|
||||
super (template);
|
||||
this.playerIInventory = playerInventory;
|
||||
this.template = template;
|
||||
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Slot;
|
||||
|
||||
public abstract class BuildCraftContainer extends Container {
|
||||
|
||||
private int inventorySize;
|
||||
public IInventory inventory;
|
||||
|
||||
public BuildCraftContainer (int inventorySize) {
|
||||
this.inventorySize = inventorySize;
|
||||
public BuildCraftContainer (IInventory inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,12 +31,12 @@ public abstract class BuildCraftContainer extends Container {
|
|||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
if(i < inventorySize)
|
||||
if(i < inventory.getSizeInventory())
|
||||
{
|
||||
if(!mergeItemStack(itemstack1, inventorySize, inventorySlots.size(), true))
|
||||
if(!mergeItemStack(itemstack1, inventory.getSizeInventory(), inventorySlots.size(), true))
|
||||
return null;
|
||||
} else
|
||||
if(!mergeItemStack(itemstack1, 0, inventorySize, false))
|
||||
if(!mergeItemStack(itemstack1, 0, inventory.getSizeInventory(), false))
|
||||
return null;
|
||||
if(itemstack1.stackSize == 0)
|
||||
slot.putStack(null);
|
||||
|
|
|
@ -17,6 +17,8 @@ public class DefaultProps {
|
|||
public static String NET_CHANNEL_NAME = "BC";
|
||||
public static int NETWORK_UPDATE_RANGE = 128;
|
||||
|
||||
public static String TEXTURE_ICONS = "/net/minecraft/src/buildcraft/core/gui/icons.png";
|
||||
|
||||
public static int WOODEN_GEAR_ID = 3800;
|
||||
public static int STONE_GEAR_ID = 3801;
|
||||
public static int IRON_GEAR_ID = 3802;
|
||||
|
|
BIN
common/net/minecraft/src/buildcraft/core/gui/icons.png
Normal file
BIN
common/net/minecraft/src/buildcraft/core/gui/icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -0,0 +1,12 @@
|
|||
package net.minecraft.src.buildcraft.core.utils;
|
||||
|
||||
public class SessionVars {
|
||||
private static Class openedLedger;
|
||||
|
||||
public static void setOpenedLedger(Class ledgerClass) {
|
||||
openedLedger = ledgerClass;
|
||||
}
|
||||
public static Class getOpenedLedger() {
|
||||
return openedLedger;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ public class ContainerEngineRoot extends BuildCraftContainer
|
|||
|
||||
public ContainerEngineRoot(InventoryPlayer inventoryplayer,
|
||||
TileEngine tileEngine) {
|
||||
super (tileEngine.getSizeInventory());
|
||||
super (tileEngine);
|
||||
|
||||
engine = tileEngine;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public abstract class Engine {
|
|||
|
||||
public int maxEnergy;
|
||||
|
||||
protected int currentOutput = 0;
|
||||
public @TileNetworkData float progress;
|
||||
public @TileNetworkData Orientations orientation;
|
||||
public int energy;
|
||||
|
@ -155,4 +156,8 @@ public abstract class Engine {
|
|||
return true;
|
||||
}
|
||||
|
||||
public int getHeat() { return 0; }
|
||||
public int getEnergyStored() { return energy; }
|
||||
public int getCurrentOutput() { return currentOutput; }
|
||||
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ public class EngineIron extends Engine {
|
|||
|
||||
@Override
|
||||
public void burn () {
|
||||
currentOutput = 0;
|
||||
IronEngineFuel currentFuel = BuildCraftAPI.ironEngineFuel.get(liquidId);
|
||||
|
||||
if (currentFuel == null) {
|
||||
|
@ -104,6 +105,7 @@ public class EngineIron extends Engine {
|
|||
burnTime = currentFuel.totalBurningTime / BuildCraftAPI.BUCKET_VOLUME;
|
||||
}
|
||||
|
||||
currentOutput = currentFuel.powerPerCycle;
|
||||
addEnergy(currentFuel.powerPerCycle);
|
||||
heat += currentFuel.powerPerCycle;
|
||||
}
|
||||
|
@ -277,15 +279,24 @@ public class EngineIron extends Engine {
|
|||
public void getGUINetworkData(int i, int j) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
liquidQty = j;
|
||||
energy = j;
|
||||
break;
|
||||
case 1:
|
||||
liquidId = j;
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 2:
|
||||
coolantQty = j;
|
||||
heat = j;
|
||||
break;
|
||||
case 3:
|
||||
liquidQty = j;
|
||||
break;
|
||||
case 4:
|
||||
liquidId = j;
|
||||
break;
|
||||
case 5:
|
||||
coolantQty = j;
|
||||
break;
|
||||
case 6:
|
||||
coolantId = j;
|
||||
break;
|
||||
}
|
||||
|
@ -294,10 +305,13 @@ public class EngineIron extends Engine {
|
|||
@Override
|
||||
public void sendGUINetworkData(ContainerEngine containerEngine,
|
||||
ICrafting iCrafting) {
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, liquidQty);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, liquidId);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, coolantQty);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, coolantId);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, heat);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, liquidQty);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 4, liquidId);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 5, coolantQty);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 6, coolantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -311,4 +325,6 @@ public class EngineIron extends Engine {
|
|||
public boolean isActive() {
|
||||
return penatlyCooling <= 0;
|
||||
}
|
||||
|
||||
@Override public int getHeat() { return heat; }
|
||||
}
|
||||
|
|
|
@ -68,8 +68,10 @@ public class EngineStone extends Engine {
|
|||
|
||||
@Override
|
||||
public void burn () {
|
||||
currentOutput = 0;
|
||||
if(burnTime > 0) {
|
||||
burnTime--;
|
||||
currentOutput = 1;
|
||||
addEnergy(1);
|
||||
}
|
||||
|
||||
|
@ -136,17 +138,30 @@ public class EngineStone extends Engine {
|
|||
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
if (i == 0) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
energy = j;
|
||||
break;
|
||||
case 1:
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 2:
|
||||
burnTime = j;
|
||||
} else if (i == 1) {
|
||||
break;
|
||||
case 3:
|
||||
totalBurnTime = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(ContainerEngine containerEngine,
|
||||
ICrafting iCrafting) {
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, burnTime);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, totalBurnTime);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, burnTime);
|
||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, totalBurnTime);
|
||||
}
|
||||
|
||||
@Override public int getHeat() { return energy; }
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ContainerAutoWorkbench extends BuildCraftContainer {
|
|||
}
|
||||
|
||||
public ContainerAutoWorkbench(InventoryPlayer inventoryplayer, TileAutoWorkbench tile) {
|
||||
super (3);
|
||||
super(tile);
|
||||
|
||||
craftResult = new InventoryCraftResult();
|
||||
this.tile = tile;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class ContainerHopper extends BuildCraftContainer {
|
|||
TileHopper hopper;
|
||||
|
||||
public ContainerHopper(InventoryPlayer inventory, TileHopper tile) {
|
||||
super(tile.getSizeInventory());
|
||||
super(tile);
|
||||
playerIInventory = inventory;
|
||||
hopper = tile;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ContainerRefinery extends BuildCraftContainer {
|
|||
TileRefinery refinery;
|
||||
|
||||
public ContainerRefinery(InventoryPlayer inventory, TileRefinery refinery) {
|
||||
super(3);
|
||||
super(refinery);
|
||||
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k1 = 0; k1 < 9; k1++) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class ContainerAssemblyTable extends BuildCraftContainer {
|
|||
boolean networkSynchronized = false;
|
||||
|
||||
public ContainerAssemblyTable(IInventory playerInventory, TileAssemblyTable table) {
|
||||
super(table.getSizeInventory());
|
||||
super(table);
|
||||
this.playerIInventory = playerInventory;
|
||||
|
||||
for (int l = 0; l < 4; l++) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class CraftingDiamondPipe extends BuildCraftContainer {
|
|||
IInventory filterIInventory;
|
||||
|
||||
public CraftingDiamondPipe (IInventory playerInventory, IInventory filterInventory) {
|
||||
super (filterInventory.getSizeInventory());
|
||||
super (filterInventory);
|
||||
this.playerIInventory = playerInventory;
|
||||
this.filterIInventory = filterInventory;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class CraftingGateInterface extends BuildCraftContainer {
|
|||
private boolean isNetInitialized = false;
|
||||
|
||||
public CraftingGateInterface(IInventory playerInventory, Pipe pipe) {
|
||||
super(pipe.container.getSizeInventory());
|
||||
super(pipe.container);
|
||||
this.playerIInventory = playerInventory;
|
||||
|
||||
for (int l = 0; l < 3; l++)
|
||||
|
|
Loading…
Reference in a new issue