From a2c735ad47f3128d8b5d6009f39da0993683a402 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 18 Mar 2018 20:33:33 +0100 Subject: data stick/orb reader --- .../dreamcraft/DreamCraftRecipeLoader.java | 37 ++- .../technus/tectech/loader/MachineLoader.java | 10 +- .../technus/tectech/loader/RecipeLoader.java | 15 + .../technus/tectech/thing/CustomItemList.java | 2 +- .../tectech/thing/item/gui/ScanDisplayScreen.java | 22 +- .../multi/GT_MEtaTileEntity_EM_dataBank.java | 175 ------------ .../multi/GT_MetaTileEntity_EM_computer.java | 2 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 175 ++++++++++++ .../multi/GT_MetaTileEntity_EM_junction.java | 6 +- .../multi/GT_MetaTileEntity_EM_switch.java | 4 +- .../multi/base/GT_Container_MultiMachineEM.java | 35 ++- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 144 ++++++---- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 18 +- .../multi/em_machine/Behaviour_Centrifuge.java | 26 ++ .../Behaviour_ElectromagneticSeparator.java | 35 +++ .../em_machine/GT_MetaTileEntity_EM_machine.java | 109 +++++-- .../single/GT_MetaTileEntity_DataReader.java | 314 +++++++++++++++++++++ .../single/GT_MetaTileEntity_OwnerDetector.java | 2 +- .../single/gui/GT_Container_DataReader.java | 100 +++++++ .../single/gui/GT_GUIContainer_DataReader.java | 265 +++++++++++++++++ 20 files changed, 1183 insertions(+), 313 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MEtaTileEntity_EM_dataBank.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 6bc58ffe62..9b3986bec4 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -20,34 +20,31 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; +import static com.github.technus.tectech.loader.RecipeLoader.getOrDefault; + /** * Created by Tec on 06.08.2017. */ public class DreamCraftRecipeLoader implements Runnable { //region reflect a bit - private Materials getOrDefault(String name,Materials def){ - Materials mat=Materials.get(name); - return mat == Materials._NULL || mat == null ? def : mat; - } - - private static final Class customItemList; - private static final Method addAssemblerRecipe; + private static final Class CUSTOM_ITEM_LIST; + private static final Method ADD_ASSEMBLER_RECIPE; static { try { - customItemList = Class.forName("com.dreammaster.gthandler.CustomItemList"); - addAssemblerRecipe = GT_Values.RA.getClass().getMethod("addAssemblerRecipe", ItemStack[].class, FluidStack.class, ItemStack.class, int.class, int.class, boolean.class); + CUSTOM_ITEM_LIST = Class.forName("com.dreammaster.gthandler.CustomItemList"); + ADD_ASSEMBLER_RECIPE = GT_Values.RA.getClass().getMethod("addAssemblerRecipe", ItemStack[].class, FluidStack.class, ItemStack.class, int.class, int.class, boolean.class); } catch (Exception e) { throw new Error(e); } } private IItemContainer getItemContainer(String name) { - return (IItemContainer) Enum.valueOf(customItemList, name); + return (IItemContainer) Enum.valueOf(CUSTOM_ITEM_LIST, name); } private static void addAssemblerRecipeWithCleanroom(ItemStack[] items, FluidStack fluid, ItemStack output, int time, int eut) { try { - addAssemblerRecipe.invoke(GT_Values.RA, items, fluid, output, time, eut, true); + ADD_ASSEMBLER_RECIPE.invoke(GT_Values.RA, items, fluid, output, time, eut, true); } catch (Exception e) { throw new Error(e); } @@ -99,7 +96,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 2), GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 16), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Copper, 16), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 1) + GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorIV",Materials.Superconductor), 1) }, Materials.SolderingAlloy.getMolten(1296), CustomItemList.eM_Computer_Vent.get(1), 100, 1920); //Advanced Computer Casing addAssemblerRecipeWithCleanroom(new ItemStack[]{ @@ -107,7 +104,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 64), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4) + GT_OreDictUnificator.get(OrePrefixes.wireGt02, getOrDefault("SuperconductorLuV",Materials.Superconductor), 4) }, Materials.Iridium.getMolten(1296), CustomItemList.eM_Computer_Bus.get(1), 200, 122880); //Molecular Casing @@ -169,9 +166,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_dynamomulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium",Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_dynamomulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_dynamomulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium",Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_dynamomulti64_UEV.get(1), 400, 2000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamomulti4_UIV.get(1), 100, 8000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_dynamomulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamomulti16_UIV.get(1), 200, 8000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamomulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamomulti64_UIV.get(1), 400, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamomulti4_UIV.get(1), 100, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_dynamomulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamomulti16_UIV.get(1), 200, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamomulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamomulti64_UIV.get(1), 400, 8000000); //Energy Hatches UV-UIV GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_energymulti4_UV.get(1), 100, 122880); @@ -186,9 +183,9 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energymulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium",Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_energymulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energymulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium",Materials.Neutronium),6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_energymulti64_UEV.get(1), 400, 2000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energymulti4_UIV.get(1), 100, 8000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_energymulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energymulti16_UIV.get(1), 200, 8000000); - //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_energymulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energymulti64_UIV.get(1), 400, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energymulti4_UIV.get(1), 100, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_energymulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energymulti16_UIV.get(1), 200, 8000000); + //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_energymulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energymulti64_UIV.get(1), 400, 8000000); //Data Input addAssemblerRecipeWithCleanroom(new ItemStack[]{ @@ -287,7 +284,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ getItemContainer("WetTransformer_ZPM_LuV").get(1), getItemContainer("HighEnergyFlowCircuit").get(1), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorLuV",Materials.Superconductor), 16), ItemList.valueOf("Circuit_Chip_UHPIC").get(2), }, Materials.TungstenSteel.getMolten(576), CustomItemList.Machine_Multi_Transformer.get(1), 400, 30720); diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index cf162d465e..502268c888 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -8,6 +8,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEnt import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; +import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPowerGenerator; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugStructureWriter; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_OwnerDetector; @@ -230,7 +231,7 @@ public class MachineLoader implements Runnable { Machine_Multi_Switch.set(new GT_MetaTileEntity_EM_switch(15310, "multimachine.em.switch", "Network Switch With QoS").getStackForm(1L)); Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(15311, "multimachine.em.computer", "Quantum Computer").getStackForm(1L)); Machine_Multi_Microwave.set(new GT_MetaTileEntity_TM_microwave(15312, "multimachine.tm.microwave", "Microwave Grinder").getStackForm(1L)); - Machine_Multi_DataBank.set(new GT_MEtaTileEntity_EM_dataBank(15313, "multimachine.em.databank", "Data Bank").getStackForm(1L)); + Machine_Multi_DataBank.set(new GT_MetaTileEntity_EM_dataBank(15313, "multimachine.em.databank", "Data Bank").getStackForm(1L)); Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(15320, "multimachine.em.junction", "Matter Junction").getStackForm(1L)); Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantizer(15321, "multimachine.em.mattertoem", "Matter Quantizer").getStackForm(1L)); @@ -289,7 +290,8 @@ public class MachineLoader implements Runnable { // Single Blocks // =================================================================================================== - Machine_OwnerDetector.set(new GT_MetaTileEntity_OwnerDetector(15480, "machine.tt.ownerdetector", "Owner detector", 15).getStackForm(1L)); + Machine_OwnerDetector.set(new GT_MetaTileEntity_OwnerDetector(15480, "machine.tt.ownerdetector", "Owner detector", 3).getStackForm(1L)); + Machine_DataReader.set(new GT_MetaTileEntity_DataReader(15481, "machine.tt.datareader", "Data Reader", 5).getStackForm(1L)); // =================================================================================================== // Debug Stuff @@ -306,6 +308,8 @@ public class MachineLoader implements Runnable { GT_MetaTileEntity_Hatch_Rack.run(); GT_MetaTileEntity_EM_computer.run(); GT_MetaTileEntity_EM_research.run(); - GT_MEtaTileEntity_EM_dataBank.run(); + GT_MetaTileEntity_EM_dataBank.run(); + + GT_MetaTileEntity_DataReader.run(); } } diff --git a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java index 9d39bbda27..76f789db7f 100644 --- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java @@ -23,6 +23,11 @@ import static gregtech.api.enums.GT_Values.RA; * Created by danie_000 on 16.11.2016. */ public class RecipeLoader implements Runnable { + public static Materials getOrDefault(String name,Materials def){ + Materials mat=Materials.get(name); + return mat == Materials._NULL || mat == null ? def : mat; + } + @Override public void run() { dAtomDefinition.setTransformation(); @@ -62,6 +67,16 @@ public class RecipeLoader implements Runnable { 'G', OrePrefixes.plate.get(Materials.Glass), 'E', OrePrefixes.gem.get(Materials.EnderPearl)}); + //Data reader + GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_DataReader.get(1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"BdB","GES","PwP", + 'B', OrePrefixes.screw.get(Materials.Iridium), + 'P', OrePrefixes.plate.get(Materials.Iridium), + 'G', ItemList.Cover_Screen, + 'S', ItemList.Sensor_IV, + 'E', ItemList.Hull_IV}); + if (Loader.isModLoaded("dreamcraft")) { new DreamCraftRecipeLoader().run();//init recipes for GTNH version } else { diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index fb34e68925..ea42bc015a 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; import static gregtech.api.enums.GT_Values.W; public enum CustomItemList implements IItemContainer { - Machine_OwnerDetector, + Machine_OwnerDetector,Machine_DataReader, Machine_DebugWriter,Machine_DebugGenny, EMpipe, DATApipe, rack_Hatch, holder_Hatch, diff --git a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java index 3c8411639a..7fe2ad0e44 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java +++ b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.item.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; @@ -11,6 +10,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import static com.github.technus.tectech.auxiliary.Reference.MODID; import static org.lwjgl.opengl.GL11.*; /** @@ -23,15 +23,15 @@ public class ScanDisplayScreen extends GuiScreen { private final String[] lines; private int firstLine =0; - private static final ResourceLocation[] BACKGROUNDS =new ResourceLocation[]{new ResourceLocation("tectech:textures/gui/scanDisplayScreen1.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen2.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen3.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen4.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen5.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen6.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen7.png"), - new ResourceLocation("tectech:textures/gui/scanDisplayScreen8.png")}; - private static final ResourceLocation ITEM =new ResourceLocation("tectech:textures/gui/scanDisplayItem.png"); + private static final ResourceLocation[] BACKGROUNDS =new ResourceLocation[]{new ResourceLocation(MODID+":textures/gui/scanDisplayScreen1.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen2.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen3.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen4.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen5.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen6.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen7.png"), + new ResourceLocation(MODID+":textures/gui/scanDisplayScreen8.png")}; + private static final ResourceLocation ITEM =new ResourceLocation(MODID+"::textures/gui/scanDisplayItem.png"); public ScanDisplayScreen(EntityPlayer player){ lines=ElementalDefinitionScanStorage_EM.getLines(player.getHeldItem()); @@ -149,7 +149,7 @@ public class ScanDisplayScreen extends GuiScreen { @Override public void func_146113_a(SoundHandler soundHandler) { - soundHandler.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(Reference.MODID+":fx_click"), 1.0F)); + soundHandler.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(MODID+":fx_click"), 1.0F)); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MEtaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MEtaTileEntity_EM_dataBank.java deleted file mode 100644 index e07bcda2dc..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MEtaTileEntity_EM_dataBank.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.auxiliary.Reference; -import com.github.technus.tectech.auxiliary.TecTechConfig; -import com.github.technus.tectech.dataFramework.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataAccess; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataAccess; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; - -import java.util.ArrayList; - -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.Util.V; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; - -public class GT_MEtaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - private final ArrayList eStacksDataOutputs = new ArrayList<>(); - private final ArrayList eDataAccessHatches = new ArrayList<>(); - - //region Structure - private static final String[][] shape = new String[][]{ - {"0 0","0 . 0","0 0",}, - {"0!!!0","01110","0!!!0",}, - {"0!!!0","0!!!0","0!!!0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2,1}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList","addDataBankHatchToMachineList"}; - private static final short[] casingTextures = new short[]{textureOffset,textureOffset+1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0,1}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or high power casing", - "2 - Data Access/Data Bank Master Hatches or computer casing", - }; - //endregion - - public GT_MEtaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MEtaTileEntity_EM_dataBank(String aName) { - super(aName); - } - - public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_hi_freq"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ - return activitySound; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MEtaTileEntity_EM_dataBank(mName); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - eDataAccessHatches.clear(); - eStacksDataOutputs.clear(); - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,2, 1, 0, getBaseMetaTileEntity(),this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) { - mEUt = -(int) V[7]; - eAmpereFlow = 1 + (eStacksDataOutputs.size() >> 2) + eDataAccessHatches.size(); - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - return true; - } - return false; - } - - @Override - public void outputAfterRecipe_EM() { - ArrayList stacks=new ArrayList<>(); - for(GT_MetaTileEntity_Hatch_DataAccess dataAccess:eDataAccessHatches){ - int count=dataAccess.getSizeInventory(); - for(int i=0;i0){ - ItemStack[] arr=stacks.toArray(new ItemStack[0]); - for(GT_MetaTileEntity_Hatch_OutputDataAccess hatch:eStacksDataOutputs){ - hatch.q=new InventoryDataPacket(arr); - } - }else{ - for(GT_MetaTileEntity_Hatch_OutputDataAccess hatch:eStacksDataOutputs){ - hatch.q=null; - } - } - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Remote assembly data delivery", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Apply directly to the forehead" - }; - } - - //NEW METHOD - public final boolean addDataBankHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputDataAccess) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eStacksDataOutputs.add((GT_MetaTileEntity_Hatch_OutputDataAccess) aMetaTileEntity); - }else if(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess && !(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputDataAccess)){ - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); - } - return false; - } - - public static void run(){ - try { - adderMethodMap.put("addDataBankHatchToMachineList", GT_MEtaTileEntity_EM_dataBank.class.getMethod("addDataBankHatchToMachineList", IGregTechTileEntity.class, int.class)); - } catch (NoSuchMethodException e) { - if (TecTechConfig.DEBUG_MODE) { - e.printStackTrace(); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index e9a9cfd074..8bda25cb6e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -252,7 +252,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } if (!machineBusy) { - setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else if (eAvailableData <= 0) { setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); } else { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java new file mode 100644 index 0000000000..c66aa08c7f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -0,0 +1,175 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.auxiliary.Reference; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.dataFramework.InventoryDataPacket; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataAccess; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataAccess; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; + +import java.util.ArrayList; + +import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.Util.V; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; + +public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private final ArrayList eStacksDataOutputs = new ArrayList<>(); + private final ArrayList eDataAccessHatches = new ArrayList<>(); + + //region Structure + private static final String[][] shape = new String[][]{ + {"0 0","0 . 0","0 0",}, + {"0!!!0","01110","0!!!0",}, + {"0!!!0","0!!!0","0!!!0",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{2,1}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList","addDataBankHatchToMachineList"}; + private static final short[] casingTextures = new short[]{textureOffset,textureOffset+1}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0,1}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or high power casing", + "2 - Data Access/Data Bank Master Hatches or computer casing", + }; + //endregion + + public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_dataBank(String aName) { + super(aName); + } + + public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_hi_freq"); + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound(){ + return activitySound; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_dataBank(mName); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + eDataAccessHatches.clear(); + eStacksDataOutputs.clear(); + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta,2, 1, 0, getBaseMetaTileEntity(),this,hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) { + mEUt = -(int) V[7]; + eAmpereFlow = 1 + (eStacksDataOutputs.size() >> 2) + eDataAccessHatches.size(); + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + return true; + } + return false; + } + + @Override + public void outputAfterRecipe_EM() { + ArrayList stacks=new ArrayList<>(); + for(GT_MetaTileEntity_Hatch_DataAccess dataAccess:eDataAccessHatches){ + int count=dataAccess.getSizeInventory(); + for(int i=0;i0){ + ItemStack[] arr=stacks.toArray(new ItemStack[0]); + for(GT_MetaTileEntity_Hatch_OutputDataAccess hatch:eStacksDataOutputs){ + hatch.q=new InventoryDataPacket(arr); + } + }else{ + for(GT_MetaTileEntity_Hatch_OutputDataAccess hatch:eStacksDataOutputs){ + hatch.q=null; + } + } + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Remote assembly data delivery", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Apply directly to the forehead" + }; + } + + //NEW METHOD + public final boolean addDataBankHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputDataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eStacksDataOutputs.add((GT_MetaTileEntity_Hatch_OutputDataAccess) aMetaTileEntity); + }else if(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess && !(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputDataAccess)){ + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; + } + + public static void run(){ + try { + adderMethodMap.put("addDataBankHatchToMachineList", GT_MetaTileEntity_EM_dataBank.class.getMethod("addDataBankHatchToMachineList", IGregTechTileEntity.class, int.class)); + } catch (NoSuchMethodException e) { + if (TecTechConfig.DEBUG_MODE) { + e.printStackTrace(); + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 03649f190e..f6324c04d6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -85,13 +85,13 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB src = getParameterIn(i, 0); if (src <= 0) { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else if (src > eInputHatches.size()) { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); - setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else if (Double.isNaN(src)) { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); - setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); dest = getParameterIn(i, 1); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 7b3a1d13b0..7fa34d0afa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -183,10 +183,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas weight = getParameterIn(i, 0); if (weight < 0) { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else if (Double.isNaN(weight)) { setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); - setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_NEUTRAL); } else { setStatusOfParameterIn(i, 0, weight==0?STATUS_LOW:GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); dest = getParameterIn(i, 1); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index b0b8a5a070..91b2635001 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -34,17 +34,31 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; } + @Override + protected void bindPlayerInventory(InventoryPlayer aInventoryPlayer) { + int i; + for(i = 0; i < 3; ++i) { + for(int j = 0; j < 9; ++j) { + this.addSlotToContainer(new Slot(aInventoryPlayer, j + i * 9 + 9, 8 + j * 18, 110 + i * 18)); + } + } + + for(i = 0; i < 9; ++i) { + this.addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 168)); + } + } + @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 152, -21)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, -2, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 15, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 32, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 174, 116, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 174, 132, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 174, 148, false, false, 1)); + addSlotToContainer(new Slot(mTileEntity, 1, 174, 168)); } @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) { + if (aSlotIndex < 0 || aSlotIndex > 2) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); @@ -52,7 +66,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { GT_MetaTileEntity_MultiblockBase_EM mte = (GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity(); IGregTechTileEntity base = mte.getBaseMetaTileEntity(); switch (aSlotIndex) { - case 1: + case 0: if(ePowerPassButton) { TecTech.proxy.playSound(base,"fx_click"); mte.ePowerPass ^= true; @@ -65,13 +79,13 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } } break; - case 2: + case 1: if(eSafeVoidButton) { TecTech.proxy.playSound(base,"fx_click"); mte.eSafeVoid ^= true; } break; - case 3: + case 2: if(allowedToWorkButton) { TecTech.proxy.playSound(base,"fx_click"); if (mte.getBaseMetaTileEntity().isAllowedToWork()) { @@ -130,6 +144,11 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } } + @Override + public int getSlotStartIndex() { + return 3; + } + @Override public int getSlotCount() { return 1; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 8c9dab2c2e..40285cc5e7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -1,10 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; +import gregtech.api.GregTech_API; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.client.gui.FontRenderer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemDye; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -28,60 +30,70 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach ePowerPassButton=enablePowerPass; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; + ySize= 192; + xSize = 198; } public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mName = aName; ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; + ySize= 192; + xSize = 198; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, -18, 16448255); + public void drawScreen(int mouseX, int mouseY, float par3) { + super.drawScreen(mouseX, mouseY, par3); + if (mContainer != null) { + if (mContainer.mTileEntity != null && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_MultiblockBase_EM) { + LEDtooltips(mouseX, mouseY); + } + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + fontRendererObj.drawString(mName, 7, 8, 16448255); if (mContainer != null) { if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 1) != 0) { - fontRendererObj.drawString("Pipe is loose.", 10, -10, 16448255); + fontRendererObj.drawString("Pipe is loose.", 7, 16, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 2) != 0) { - fontRendererObj.drawString("Screws are loose.", 10, -2, 16448255); + fontRendererObj.drawString("Screws are loose.", 7, 24, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 4) != 0) { - fontRendererObj.drawString("Something is stuck.", 10, 6, 16448255); + fontRendererObj.drawString("Something is stuck.", 7, 32, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 8) != 0) { - fontRendererObj.drawString("Plating is dented.", 10, 14, 16448255); + fontRendererObj.drawString("Plating is dented.", 7, 40, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 16) != 0) { - fontRendererObj.drawString("Circuitry burned out.", 10, 22, 16448255); + fontRendererObj.drawString("Circuitry burned out.", 7, 48, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 32) != 0) { - fontRendererObj.drawString("That doesn't belong there.", 10, 30, 16448255); + fontRendererObj.drawString("That doesn't belong there.", 7, 56, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 64) != 0) { - fontRendererObj.drawString("Incomplete Structure.", 10, 38, 16448255); + fontRendererObj.drawString("Incomplete Structure.", 7, 64, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 128) != 0) { - fontRendererObj.drawString("Too Uncertain.", 10, 46, 16448255); + fontRendererObj.drawString("Too Uncertain.", 7, 72, 16448255); } if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 256) != 0) { - fontRendererObj.drawString("Invalid Parameters.", 10, 54, 16448255); + fontRendererObj.drawString("Invalid Parameters.", 7, 80, 16448255); } if (((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode == 0) { if (((GT_Container_MultiMachineEM) mContainer).mActive == 0) { - fontRendererObj.drawString("Soft Hammer or press Button", 10, -10, 16448255); - fontRendererObj.drawString("to (re-)start the Machine", 10, -2, 16448255); - fontRendererObj.drawString("if it doesn't start.", 10, 6, 16448255); + fontRendererObj.drawString("Soft Hammer or press Button", 7, 16, 16448255); + fontRendererObj.drawString("to (re-)start the Machine", 7, 24, 16448255); + fontRendererObj.drawString("if it doesn't start.", 7, 32, 16448255); } else { - fontRendererObj.drawString("Running perfectly.", 10, -10, 16448255); + fontRendererObj.drawString("Running perfectly.", 7, 16, 16448255); } } - - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - LEDtooltips(par1-x, par2-y+26); } } @@ -90,101 +102,98 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach super.drawGuiContainerBackgroundLayer(par1, par2, par3); int x = (width - xSize) / 2; int y = (height - ySize) / 2; - y -= 26; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize + 26); + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); if (mContainer != null && ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus != null) { counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); - + x+= 173; if(!ePowerPassButton) { - drawTexturedModalRect(x + 151, y + 23, 215, 23, 18, 18); + drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); } else if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) { - drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); + drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); } if(!eSafeVoidButton) { - drawTexturedModalRect(x + 151, y + 41, 215, 41, 18, 18); + drawTexturedModalRect(x, y + 132, 231, 41, 18, 18); } else if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) { - drawTexturedModalRect(x + 151, y + 41, 183, 41, 18, 18); + drawTexturedModalRect(x, y + 132, 207, 41, 18, 18); } if(!allowedToWorkButton) { - drawTexturedModalRect(x + 151, y + 57, 215, 57, 18, 18); + drawTexturedModalRect(x, y + 147, 231, 57, 18, 18); } else if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) { - drawTexturedModalRect(x + 151, y + 57, 183, 57, 18, 18); + drawTexturedModalRect(x, y + 147, 207, 57, 18, 18); } - - x += 11; + x -= 162; y += 96; for (int i = 0; i < 20; ) { - byte b = (byte) (i >>> 1); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[b]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[b]); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[b + 10]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[b + 10]); + byte hatch = (byte) (i >>> 1); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[hatch]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[hatch]); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[hatch + 10]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[hatch + 10]); } - short rU = 183, Vs = 77; - x += 140; - y -= 19; + short rU = 207, Vs = 77; + x += 162; byte state = ((GT_Container_MultiMachineEM) mContainer).eCertainStatus; switch (((GT_Container_MultiMachineEM) mContainer).eCertainMode) { case 1://ooo oxo ooo drawTexturedModalRect(x + 6, y + 6, - rU + (state == 0 ? 38 : 6), + rU + (state == 0 ? 30 : 6), Vs + 6, 6, 6); break; case 2://ooo xox ooo drawTexturedModalRect(x, y + 6, - rU + ((state & 1) == 0 ? 32 : 0), + rU + ((state & 1) == 0 ? 24 : 0), Vs + 6, 6, 6); drawTexturedModalRect(x + 12, y + 6, - rU + ((state & 2) == 0 ? 44 : 12), + rU + ((state & 2) == 0 ? 36 : 12), Vs + 6, 6, 6); break; case 3://oxo xox oxo drawTexturedModalRect(x + 6, y, - rU + ((state & 1) == 0 ? 38 : 6), + rU + ((state & 1) == 0 ? 30 : 6), Vs, 6, 6); drawTexturedModalRect(x, y + 6, - rU + ((state & 2) == 0 ? 32 : 0), + rU + ((state & 2) == 0 ? 24 : 0), Vs + 6, 6, 6); drawTexturedModalRect(x + 12, y + 6, - rU + ((state & 4) == 0 ? 44 : 12), + rU + ((state & 4) == 0 ? 36 : 12), Vs + 6, 6, 6); drawTexturedModalRect(x + 6, y + 12, - rU + ((state & 8) == 0 ? 38 : 6), + rU + ((state & 8) == 0 ? 30 : 6), Vs + 12, 6, 6); break; case 4://xox ooo xox drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 32 : 0), + rU + ((state & 1) == 0 ? 24 : 0), Vs, 6, 6); drawTexturedModalRect(x + 12, y, - rU + ((state & 2) == 0 ? 44 : 12), + rU + ((state & 2) == 0 ? 36 : 12), Vs, 6, 6); drawTexturedModalRect(x, y + 12, - rU + ((state & 4) == 0 ? 32 : 0), + rU + ((state & 4) == 0 ? 24 : 0), Vs + 12, 6, 6); drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 8) == 0 ? 44 : 12), + rU + ((state & 8) == 0 ? 36 : 12), Vs + 12, 6, 6); break; case 5://xox oxo xox drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 32 : 0), + rU + ((state & 1) == 0 ? 24 : 0), Vs, 6, 6); drawTexturedModalRect(x + 12, y, - rU + ((state & 2) == 0 ? 44 : 12), + rU + ((state & 2) == 0 ? 36 : 12), Vs, 6, 6); drawTexturedModalRect(x + 6, y + 6, - rU + ((state & 4) == 0 ? 38 : 6), + rU + ((state & 4) == 0 ? 30 : 6), Vs + 6, 6, 6); drawTexturedModalRect(x, y + 12, - rU + ((state & 8) == 0 ? 32 : 0), + rU + ((state & 8) == 0 ? 24 : 0), Vs + 12, 6, 6); drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 16) == 0 ? 44 : 12), + rU + ((state & 16) == 0 ? 36 : 12), Vs + 12, 6, 6); break; } @@ -221,10 +230,25 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach case STATUS_HIGH:// too high drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); break; + case STATUS_UNUSED: + if (GregTech_API.sColoredGUI && this.mContainer.mTileEntity != null) { + int tColor = this.mContainer.mTileEntity.getColorization() & 15; + if (tColor < ItemDye.field_150922_c.length) { + tColor = ItemDye.field_150922_c[tColor]; + GL11.glColor4f((float)(tColor >> 16 & 255) / 255.0F, (float)(tColor >> 8 & 255) / 255.0F, (float)(tColor & 255) / 255.0F, 1.0F); + } + } + drawTexturedModalRect(x + su * i, y + sv * j, 212, 96, su+2, sv+2); + GL11.glColor4f(1f, 1f, 1f, 1f); + break; } } - private void LEDtooltips(float x,float y){ + private void LEDtooltips(int x,int y){ + int renderPosX=x; + int renderPosY=y; + x-= (width - xSize) / 2; + y-= (height - ySize) / 2; //drawHoveringText(Arrays.asList(""+x,""+y), -1, -11, fontRendererObj); if(mContainer.mTileEntity!=null){ IMetaTileEntity mte=mContainer.mTileEntity.getMetaTileEntity(); @@ -236,10 +260,16 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach for(int param=0;param<2;param++){ if(x<(u+=su)){ if(y=v && y