diff options
author | kekzdealer <kekzdealer@gmail.com> | 2019-10-12 00:51:41 +0200 |
---|---|---|
committer | kekzdealer <kekzdealer@gmail.com> | 2019-10-12 00:51:41 +0200 |
commit | 8dab80ff200998cdee40144c9855443cd17f366d (patch) | |
tree | df4194255c4c3fc4b757b9a4f0265d26253b7873 | |
parent | 95ae4bcb0146fbccb6eaf0f0b3477050b8dde533 (diff) | |
download | GT5-Unofficial-8dab80ff200998cdee40144c9855443cd17f366d.tar.gz GT5-Unofficial-8dab80ff200998cdee40144c9855443cd17f366d.tar.bz2 GT5-Unofficial-8dab80ff200998cdee40144c9855443cd17f366d.zip |
Made working UI base for nuclear reactor
21 files changed, 138 insertions, 82 deletions
diff --git a/.gradle/4.4.1/fileHashes/fileHashes.bin b/.gradle/4.4.1/fileHashes/fileHashes.bin Binary files differindex dde1de976c..df50340313 100644 --- a/.gradle/4.4.1/fileHashes/fileHashes.bin +++ b/.gradle/4.4.1/fileHashes/fileHashes.bin diff --git a/.gradle/4.4.1/fileHashes/fileHashes.lock b/.gradle/4.4.1/fileHashes/fileHashes.lock Binary files differindex e38ad2694c..d7836c92bd 100644 --- a/.gradle/4.4.1/fileHashes/fileHashes.lock +++ b/.gradle/4.4.1/fileHashes/fileHashes.lock diff --git a/.gradle/4.4.1/taskHistory/taskHistory.bin b/.gradle/4.4.1/taskHistory/taskHistory.bin Binary files differindex 6c54c2cf09..34a8331011 100644 --- a/.gradle/4.4.1/taskHistory/taskHistory.bin +++ b/.gradle/4.4.1/taskHistory/taskHistory.bin diff --git a/.gradle/4.4.1/taskHistory/taskHistory.lock b/.gradle/4.4.1/taskHistory/taskHistory.lock Binary files differindex 2af254906c..24302872e2 100644 --- a/.gradle/4.4.1/taskHistory/taskHistory.lock +++ b/.gradle/4.4.1/taskHistory/taskHistory.lock diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock Binary files differindex 889f5acb66..1d27583b6a 100644 --- a/.gradle/buildOutputCleanup/buildOutputCleanup.lock +++ b/.gradle/buildOutputCleanup/buildOutputCleanup.lock diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin Binary files differindex d481035b39..ce1c3042e7 100644 --- a/.gradle/buildOutputCleanup/outputFiles.bin +++ b/.gradle/buildOutputCleanup/outputFiles.bin diff --git a/build.gradle b/build.gradle index 65bd7a58cc..c21e277497 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'forge' sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = "0.1.2" +version = "0.2" group= "kekztech" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "kekztech" diff --git a/config/IC2.ini b/config/IC2.ini index 34e97e643d..8ee6f2aeb1 100644 --- a/config/IC2.ini +++ b/config/IC2.ini @@ -1,5 +1,5 @@ ; ic2 general config -; created Oct 11, 2019 2:18:17 AM +; created Oct 11, 2019 8:59:00 PM ;--- [worldgen] diff --git a/config/splash.properties b/config/splash.properties index 966b9ae3b6..6aa5aeb3bd 100644 --- a/config/splash.properties +++ b/config/splash.properties @@ -1,5 +1,5 @@ #Splash screen properties -#Fri Oct 11 02:18:09 CEST 2019 +#Fri Oct 11 20:58:50 CEST 2019 logoTexture=textures/gui/title/mojang.png background=0xFFFFFF font=0x0 diff --git a/logs/2019-10-11-1.log.gz b/logs/2019-10-11-1.log.gz Binary files differindex 127f46923d..ed173d1446 100644 --- a/logs/2019-10-11-1.log.gz +++ b/logs/2019-10-11-1.log.gz diff --git a/logs/2019-10-11-2.log.gz b/logs/2019-10-11-2.log.gz Binary files differnew file mode 100644 index 0000000000..60cda6f922 --- /dev/null +++ b/logs/2019-10-11-2.log.gz diff --git a/logs/2019-10-11-3.log.gz b/logs/2019-10-11-3.log.gz Binary files differnew file mode 100644 index 0000000000..3f29af8deb --- /dev/null +++ b/logs/2019-10-11-3.log.gz diff --git a/logs/2019-10-11-4.log.gz b/logs/2019-10-11-4.log.gz Binary files differnew file mode 100644 index 0000000000..72bb001b8b --- /dev/null +++ b/logs/2019-10-11-4.log.gz diff --git a/logs/2019-10-11-5.log.gz b/logs/2019-10-11-5.log.gz Binary files differnew file mode 100644 index 0000000000..592e858649 --- /dev/null +++ b/logs/2019-10-11-5.log.gz diff --git a/logs/2019-10-11-6.log.gz b/logs/2019-10-11-6.log.gz Binary files differnew file mode 100644 index 0000000000..a1db13a08e --- /dev/null +++ b/logs/2019-10-11-6.log.gz diff --git a/logs/2019-10-11-7.log.gz b/logs/2019-10-11-7.log.gz Binary files differnew file mode 100644 index 0000000000..4553998d3a --- /dev/null +++ b/logs/2019-10-11-7.log.gz diff --git a/src/main/java/config/ConfigIO.java b/src/main/java/config/ConfigIO.java new file mode 100644 index 0000000000..4898c9b58d --- /dev/null +++ b/src/main/java/config/ConfigIO.java @@ -0,0 +1,49 @@ +package config; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; + +public class ConfigIO { + + private static final String CONFIG_PATH = "main/java/config/config.properties"; + private static final int CONFIG_SIZE = 0; + + private static Properties config; + + private ConfigIO() { + + } + + public static void load() { + config = new Properties(); + try { + config.load(new FileInputStream(CONFIG_PATH)); + } catch (IOException e) { + throw new IllegalStateException("Failed to load KekzTech config!"); + } + if(config.size() != CONFIG_SIZE) { + throw new IllegalStateException("KekzTech config is not expected size!"); + } + } + + @SuppressWarnings("unchecked") + public <T> T get(String key, T valueType) { + if(config.size() != CONFIG_SIZE) { + throw new IllegalStateException("Tried to access config without loading it first"); + } + return (T) config.get((Object) key); + } + + public static void saveConfig() { + try { + config = (config == null) ? new Properties() : config; + config.setProperty("key", "value"); + config.store(new FileOutputStream(CONFIG_PATH), "Welcome to KekzTech's config file :)"); + } catch (IOException e) { + System.err.println("Failed to save changes to KekzTech config. Settings may be lost."); + } + } + +} diff --git a/src/main/java/container/Container_ModularNuclearReactor.java b/src/main/java/container/Container_ModularNuclearReactor.java index a8fdd5f25a..ec6270d705 100644 --- a/src/main/java/container/Container_ModularNuclearReactor.java +++ b/src/main/java/container/Container_ModularNuclearReactor.java @@ -1,19 +1,14 @@ 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.Container;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
import reactor.ButtonSlot;
-import tileentities.GTMTE_ModularNuclearReactor;
-public class Container_ModularNuclearReactor extends GT_Container_MultiMachine {
+public class Container_ModularNuclearReactor extends Container {
- 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;
@@ -24,28 +19,23 @@ public class Container_ModularNuclearReactor extends GT_Container_MultiMachine { 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;
-
+ public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) {
+
// 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)));
+ REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y)));
}
}
// Add the configuration slot
- SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(PLAYER_INVENTORY, getNextSlotID(), 0, 0));
+ SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, 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));
+ BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
+ BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
+ BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
+ BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
+ BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
}
@@ -54,17 +44,44 @@ public class Container_ModularNuclearReactor extends GT_Container_MultiMachine { return nextSlotID - 1;
}
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw)
+ {
+ ItemStack stack = null;
+ Slot slot = (Slot)inventorySlots.get(slotRaw);
+
+ if (slot != null && slot.getHasStack())
+ {
+ ItemStack stackInSlot = slot.getStack();
+ stack = stackInSlot.copy();
+
+ if (slotRaw < 3 * 9)
+ {
+ if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true))
+ {
+ return null;
+ }
+ }
+ else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false))
+ {
+ return null;
+ }
+
+ if (stackInSlot.stackSize == 0)
+ {
+ slot.putStack((ItemStack)null);
+ }
+ else
+ {
+ slot.onSlotChanged();
+ }
+ }
+ return stack;
+ }
+
@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 index 9bea52badc..1333799a78 100644 --- a/src/main/java/container/GUIContainer_ModularNuclearReactor.java +++ b/src/main/java/container/GUIContainer_ModularNuclearReactor.java @@ -2,52 +2,42 @@ 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.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
-public class GUIContainer_ModularNuclearReactor extends GT_GUIContainerMetaTile_Machine {
+public class GUIContainer_ModularNuclearReactor extends GuiContainer {
- 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) {
-
- }
+ private ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ReaktorGUI_background.png");
+
+ private InventoryPlayer inventory;
+ private IGregTechTileEntity te;
+
+ public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player)
+ {
+ super(new Container_ModularNuclearReactor(te, player));
+ inventory = player.inventory;
+ this.te = te;
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
+ {
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ drawTexturedModalRect(100, 100, 0, 0, 300, 200);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2)
+ {
+
+ }
}
diff --git a/src/main/java/kekztech/KekzCore.java b/src/main/java/kekztech/KekzCore.java index 94aea7adc2..113f1a77c8 100644 --- a/src/main/java/kekztech/KekzCore.java +++ b/src/main/java/kekztech/KekzCore.java @@ -39,8 +39,9 @@ import util.Util; *
*/
@Mod(modid = KekzCore.MODID, name = KekzCore.NAME, version = KekzCore.VERSION,
- dependencies = "required-after:IC2; "
- + "required-after:gregtech"
+ dependencies =
+ "required-after:IC2; "
+ + "required-after:gregtech;"
)
public class KekzCore {
@@ -71,8 +72,8 @@ public class KekzCore { Block_TFFTStorageFieldBlockT2.getInstance().registerBlock();
Block_TFFTStorageFieldBlockT3.getInstance().registerBlock();
Block_TFFTStorageFieldBlockT4.getInstance().registerBlock();
-
Block_TFFTMultiHatch.getInstance().registerBlock();
+ // Register TileEntities
GameRegistry.registerTileEntity(TE_TFFTMultiHatch.class, "kekztech_tfftmultihatch_tile");
}
@@ -217,7 +218,7 @@ public class KekzCore { GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 25),
GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.RoseGold, 64),
GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Thorium, 12),
- ItemList.Field_Generator_HV.get(1L, (Object[]) null),
+ ItemList.Field_Generator_HV.get(1L, (Object[]) null)
};
GT_Values.RA.addAssemblerRecipe(
tfftmultihatch,
diff --git a/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java index 6e19ab8ae3..e247e2fb56 100644 --- a/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java +++ b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java @@ -1,8 +1,8 @@ package tileentities;
+import container.GUIContainer_ModularNuclearReactor;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -65,11 +65,10 @@ public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBas // TODO: Opening UI crashes server. Controller isn't craftable right now.
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
- "MultiblockDisplay.png");
- // In case someone ignores the warning...
- /*return new GUIContainer_ModularNuclearReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ /*return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
"MultiblockDisplay.png");*/
+ // In case someone ignores the warning...
+ return new GUIContainer_ModularNuclearReactor(aBaseMetaTileEntity, aPlayerInventory.player);
}
@Override
|