aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/container
diff options
context:
space:
mode:
authorChristina Berchtold <kekzdealer@gmail.com>2019-06-09 23:41:14 +0200
committerChristina Berchtold <kekzdealer@gmail.com>2019-06-09 23:41:14 +0200
commite806e19f3b42df2759231880afff02648908239f (patch)
tree1cba8a919ee261f2f03f1f6f1aac381017d0544a /src/main/java/container
parent133b330fecda75943ab3b1e379a08e3b9ba37fc3 (diff)
downloadGT5-Unofficial-e806e19f3b42df2759231880afff02648908239f.tar.gz
GT5-Unofficial-e806e19f3b42df2759231880afff02648908239f.tar.bz2
GT5-Unofficial-e806e19f3b42df2759231880afff02648908239f.zip
gradle building and recipes. SOFC fully functional. Probably first release :)
Diffstat (limited to 'src/main/java/container')
-rw-r--r--src/main/java/container/Container_ModularNuclearReactor.java70
-rw-r--r--src/main/java/container/GUIContainer_ModularNuclearReactor.java53
2 files changed, 123 insertions, 0 deletions
diff --git a/src/main/java/container/Container_ModularNuclearReactor.java b/src/main/java/container/Container_ModularNuclearReactor.java
new file mode 100644
index 0000000000..41b686c901
--- /dev/null
+++ b/src/main/java/container/Container_ModularNuclearReactor.java
@@ -0,0 +1,70 @@
+package container;
+
+import gregtech.api.gui.GT_Container_MultiMachine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import reactor.ButtonSlot;
+import tileentities.GTMTE_ModularNuclearReactor;
+
+public class Container_ModularNuclearReactor extends GT_Container_MultiMachine {
+
+ private final GTMTE_ModularNuclearReactor REACTOR_TILE;
+ private final IInventory PLAYER_INVENTORY;
+
+ private int nextSlotID = 0;
+ private final Slot[] REACTOR_SLOTS = new Slot[54];
+ private final Slot SLOT_CONFIGURATION;
+ private final Slot BUTTON_EU_MODE;
+ private final Slot BUTTON_FLUID_MODE;
+ private final Slot BUTTON_CONDITION;
+ private final Slot BUTTON_CONFIGURE;
+ private final Slot BUTTON_RESET;
+
+
+ public Container_ModularNuclearReactor(InventoryPlayer inventoryPlayer, IGregTechTileEntity reactorTile) {
+
+ super(inventoryPlayer, reactorTile);
+
+ this.REACTOR_TILE = (GTMTE_ModularNuclearReactor) reactorTile;
+ this.PLAYER_INVENTORY = inventoryPlayer;
+
+ // Add the reactor chamber
+ for(int x = 0; x < 9; x++) {
+ for(int y = 0; y < 6; y++){
+ REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(PLAYER_INVENTORY, getNextSlotID(), (16 + 67 * x), (16 + 67 * y)));
+ }
+ }
+ // Add the configuration slot
+ SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+
+ // Add buttons (they're also slots)
+ BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+ BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+ BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+ BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+ BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+
+ }
+
+ private int getNextSlotID() {
+ nextSlotID++;
+ return nextSlotID - 1;
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer p_75145_1_) {
+ return true;
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (REACTOR_TILE.getBaseMetaTileEntity().isServerSide() == false) {
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/container/GUIContainer_ModularNuclearReactor.java b/src/main/java/container/GUIContainer_ModularNuclearReactor.java
new file mode 100644
index 0000000000..58a9ff6caf
--- /dev/null
+++ b/src/main/java/container/GUIContainer_ModularNuclearReactor.java
@@ -0,0 +1,53 @@
+package container;
+
+import org.lwjgl.opengl.GL11;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import kekztech.KekzCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+
+public class GUIContainer_ModularNuclearReactor extends GT_GUIContainerMetaTile_Machine {
+
+ private final String resourceName;
+ private final ResourceLocation texture;
+
+ public GUIContainer_ModularNuclearReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity,
+ String aName, String aTextureFile) {
+
+ super(new Container_ModularNuclearReactor(aInventoryPlayer, aTileEntity), aTextureFile);
+
+ this.resourceName = aTextureFile;
+ this.texture = new ResourceLocation(KekzCore.MODID, "textures/gui/" + resourceName);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initGui() {
+ super.initGui();
+
+ // The parameters of GuiButton are (id, x, y, width, height, text)
+ super.buttonList.add(new GuiButton(1, 100, 200, 100, 20, "Hello"));
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ final int x = (super.width - super.xSize);
+ final int y = (super.height - super.ySize);
+
+ super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+
+ }
+
+}