From 0f54c21cf22a80d11e0be843d3fd0cd42c7fc191 Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Sun, 29 Mar 2015 14:47:09 -0400 Subject: [PATCH] More work on logic adapter --- .../client/GeneratorsClientProxy.java | 6 ++- .../client/gui/GuiReactorLogicAdapter.java | 46 +++++++++++++++++++ .../generators/common/MekanismGenerators.java | 3 ++ .../TileEntityReactorLogicAdapter.java | 8 +++- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 src/main/java/mekanism/generators/client/gui/GuiReactorLogicAdapter.java diff --git a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java index 0fd3a8560..a20ec41f6 100644 --- a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java +++ b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java @@ -1,7 +1,5 @@ package mekanism.generators.client; -import mekanism.api.MekanismConfig.client; -import mekanism.common.Mekanism; import mekanism.generators.client.gui.GuiBioGenerator; import mekanism.generators.client.gui.GuiGasGenerator; import mekanism.generators.client.gui.GuiHeatGenerator; @@ -9,6 +7,7 @@ import mekanism.generators.client.gui.GuiNeutronCapture; import mekanism.generators.client.gui.GuiReactorController; import mekanism.generators.client.gui.GuiReactorFuel; import mekanism.generators.client.gui.GuiReactorHeat; +import mekanism.generators.client.gui.GuiReactorLogicAdapter; import mekanism.generators.client.gui.GuiReactorStats; import mekanism.generators.client.gui.GuiSolarGenerator; import mekanism.generators.client.gui.GuiWindTurbine; @@ -27,6 +26,7 @@ import mekanism.generators.common.tile.TileEntityHeatGenerator; import mekanism.generators.common.tile.TileEntitySolarGenerator; import mekanism.generators.common.tile.TileEntityWindTurbine; import mekanism.generators.common.tile.reactor.TileEntityReactorController; +import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; @@ -88,6 +88,8 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy return new GuiReactorStats(player.inventory, (TileEntityReactorController)tileEntity); case 14: return new GuiNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity); + case 15: + return new GuiReactorLogicAdapter(player.inventory, (TileEntityReactorLogicAdapter)tileEntity); } return null; diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorLogicAdapter.java b/src/main/java/mekanism/generators/client/gui/GuiReactorLogicAdapter.java new file mode 100644 index 000000000..f47801e56 --- /dev/null +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorLogicAdapter.java @@ -0,0 +1,46 @@ +package mekanism.generators.client.gui; + +import mekanism.client.gui.GuiMekanism; +import mekanism.common.inventory.container.ContainerNull; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; +import net.minecraft.entity.player.InventoryPlayer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiReactorLogicAdapter extends GuiMekanism +{ + public TileEntityReactorLogicAdapter tileEntity; + + public GuiReactorLogicAdapter(InventoryPlayer inventory, final TileEntityReactorLogicAdapter tentity) + { + super(new ContainerNull(inventory.player, tentity)); + + tileEntity = tentity; + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + fontRendererObj.drawString(tileEntity.getInventoryName(), 46, 6, 0x404040); + + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) + { + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiReactorLogicAdapter.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int guiWidth = (width - xSize) / 2; + int guiHeight = (height - ySize) / 2; + drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); + + super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); + } +} diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 0e67203a4..88aa2f2ef 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -146,6 +146,9 @@ public class MekanismGenerators implements IModule CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(GeneratorsBlocks.ReactorGlass, 2, 1), new Object[] { " I ", "ILI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.ReactorGlass, 1, 0), Character.valueOf('L'), "blockRedstone" })); + CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(GeneratorsBlocks.Reactor, 1, 4), new Object[] { + " R ", "RFR", " R ", Character.valueOf('R'), "dustRedstone", Character.valueOf('R'), new ItemStack(GeneratorsBlocks.Reactor, 1, 1) + })); FuelHandler.addGas(GasRegistry.getGas("ethene"), general.ETHENE_BURN_TIME, general.FROM_H2 + generators.bioGeneration * 2 * general.ETHENE_BURN_TIME); //1mB hydrogen + 2*bioFuel/tick*200ticks/100mB * 20x efficiency bonus } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java index 40ac35d01..72ccbd701 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java @@ -19,6 +19,12 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem public boolean activeCooled; + public TileEntityReactorLogicAdapter() + { + super(); + fullName = "ReactorLogicAdapter"; + } + @Override public boolean isFrame() { @@ -79,7 +85,7 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem } else if(type == 1) { - int index = dataStream.readInt(); + logicType = ReactorLogic.values()[dataStream.readInt()]; } return;