diff options
author | Tec <daniel112092@gmail.com> | 2018-03-18 20:33:33 +0100 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2018-03-18 20:33:33 +0100 |
commit | a2c735ad47f3128d8b5d6009f39da0993683a402 (patch) | |
tree | abcdc0924cee1911ac47813b318d587064786c84 /src | |
parent | 8e64ebc4b26ca0e8981d2aeaf0b5c3d00617447c (diff) | |
download | GT5-Unofficial-a2c735ad47f3128d8b5d6009f39da0993683a402.tar.gz GT5-Unofficial-a2c735ad47f3128d8b5d6009f39da0993683a402.tar.bz2 GT5-Unofficial-a2c735ad47f3128d8b5d6009f39da0993683a402.zip |
data stick/orb reader
Diffstat (limited to 'src')
26 files changed, 1023 insertions, 143 deletions
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_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 index e07bcda2dc..c66aa08c7f 100644 --- 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 @@ -30,7 +30,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture 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 { +public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { private final ArrayList<GT_MetaTileEntity_Hatch_OutputDataAccess> eStacksDataOutputs = new ArrayList<>(); private final ArrayList<GT_MetaTileEntity_Hatch_DataAccess> eDataAccessHatches = new ArrayList<>(); @@ -53,11 +53,11 @@ public class GT_MEtaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB }; //endregion - public GT_MEtaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { + public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_MEtaTileEntity_EM_dataBank(String aName) { + public GT_MetaTileEntity_EM_dataBank(String aName) { super(aName); } @@ -71,7 +71,7 @@ public class GT_MEtaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MEtaTileEntity_EM_dataBank(mName); + return new GT_MetaTileEntity_EM_dataBank(mName); } @Override @@ -165,7 +165,7 @@ public class GT_MEtaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public static void run(){ try { - adderMethodMap.put("addDataBankHatchToMachineList", GT_MEtaTileEntity_EM_dataBank.class.getMethod("addDataBankHatchToMachineList", IGregTechTileEntity.class, int.class)); + 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 @@ -35,16 +35,30 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } @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()) { @@ -131,6 +145,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){ - hoveringText(((GT_MetaTileEntity_MultiblockBase_EM) mte).getFullLedDescriptionIn(hatch,param), u-su-1, v-11, fontRendererObj); + if(((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[hatch + (10*param)]==STATUS_UNUSED){ + return; + } + hoveringText(((GT_MetaTileEntity_MultiblockBase_EM) mte).getFullLedDescriptionIn(hatch,param), renderPosX, renderPosY, fontRendererObj); return; }else if(y>=v && y<v+sv){ - hoveringText(((GT_MetaTileEntity_MultiblockBase_EM) mte).getFullLedDescriptionOut(hatch,param), u-su-1, v+sv-11, fontRendererObj); + if(((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[hatch + (10*param)]==STATUS_UNUSED){ + return; + } + hoveringText(((GT_MetaTileEntity_MultiblockBase_EM) mte).getFullLedDescriptionOut(hatch,param), renderPosX, renderPosY, fontRendererObj); return; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 1c208f704e..6dfc35b1a5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -104,7 +104,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt final byte[] eParamsInStatus = new byte[20];//LED status for I final byte[] eParamsOutStatus = new byte[20];//LED status for O - public static final byte STATUS_UNUSED = 0, + public static final byte STATUS_UNUSED =7, STATUS_NEUTRAL = 0, STATUS_TOO_LOW = 1, STATUS_LOW = 2, STATUS_WRONG = 3, STATUS_OK = 4, STATUS_TOO_HIGH = 5, STATUS_HIGH = 6; @@ -453,7 +453,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ public ArrayList<String> getFullLedDescriptionIn(int hatchNo, int paramID){ ArrayList<String> list=new ArrayList<>(); - list.add("ID" + hatchNo + ":" + paramID + ":I"); + list.add(EnumChatFormatting.WHITE+"ID: " + + EnumChatFormatting.AQUA+hatchNo + + EnumChatFormatting.YELLOW+ ":" + + EnumChatFormatting.AQUA+paramID + + EnumChatFormatting.YELLOW+ ":"+ + EnumChatFormatting.AQUA+"I"); return list; } @@ -465,7 +470,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ public ArrayList<String> getFullLedDescriptionOut(int hatchNo, int paramID){ ArrayList<String> list=new ArrayList<>(); - list.add("ID" + hatchNo + ":" + paramID + ":O"); + list.add(EnumChatFormatting.WHITE+"ID: " + + EnumChatFormatting.AQUA+hatchNo + + EnumChatFormatting.YELLOW+ ":" + + EnumChatFormatting.AQUA+paramID + + EnumChatFormatting.YELLOW+ ":"+ + EnumChatFormatting.AQUA+"O"); return list; } @@ -728,7 +738,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { hatch_elemental.id = -1; } - for (GT_MetaTileEntity_Hatch_OutputData hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { hatch_data.id = -1; hatch_data.q = null; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 1c4a1381be..01d62b96ba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -7,6 +7,7 @@ import com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtom import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -19,6 +20,8 @@ import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour { private final float radius, maxRPM, maxRCF, maxForce, maxCapacity; private final byte tier; + private final static String[] DESCRIPTION_I =new String[]{"RPM Input","Fraction Count Input"}; + private final static String[] DESCRIPTION_O =new String[]{"RPM Setting","RCF Setting","Radius [mm]","Max RPM","Max Force [eV/c^2 * m/s]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; private static final double[/*tier+5*/][/*outputHatches+2*/] MIXING_FACTORS =new double[][]{ {.45,.85,.95,1,1,}, @@ -43,6 +46,20 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour } @Override + protected void getFullLedDescriptionIn(ArrayList<String> baseDescr, int hatchNo, int paramID) { + if(hatchNo==0) { + baseDescr.add(DESCRIPTION_I[(hatchNo << 1) + paramID]); + } + } + + @Override + protected void getFullLedDescriptionOut(ArrayList<String> baseDescr, int hatchNo, int paramID) { + if(hatchNo<=2) { + baseDescr.add(DESCRIPTION_O[(hatchNo<<1)+paramID]); + } + } + + @Override public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { boolean check=true; @@ -51,6 +68,15 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour te.setParameterOut(2, 0, maxForce * 9.80665);// (eV/c^2 * m/s) te.setParameterOut(2, 1, maxCapacity);// eV/c^2 + for(int i=4;i<=9;i++) { + te.setStatusOfParameterOut(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + te.setStatusOfParameterOut(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + } + for(int i=1;i<=3;i++) { + te.setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + te.setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + } + double RPM = parametersToCheckAndFix[0]; if (RPM > maxRPM) { te.setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 662d674c64..79d39120bc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -7,6 +7,8 @@ import com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtom import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import java.util.ArrayList; + import static com.github.technus.tectech.Util.V; /** @@ -20,6 +22,8 @@ public class Behaviour_ElectromagneticSeparator extends GT_MetaTileEntity_EM_mac private final float maxCapacity; private final long maxCharge; private final int offsetMax; + private final static String[] DESCRIPTION_I =new String[]{"Full Precision Input [e/3]","Minimal Precision Input [e/3]","Offset Input [e/3]",null}; + private final static String[] DESCRIPTION_O =new String[]{"Full Precision Limit [e/3]","Minimal Precision Limit [e/3]","Offset Limit [e/3]",null,"Max Charge [e/3]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; @@ -65,17 +69,48 @@ public class Behaviour_ElectromagneticSeparator extends GT_MetaTileEntity_EM_mac } @Override + protected void getFullLedDescriptionIn(ArrayList<String> baseDescr, int hatchNo, int paramID) { + if(hatchNo<=1) { + String desc=DESCRIPTION_I[(hatchNo << 1) + paramID]; + if(desc!=null){ + baseDescr.add(desc); + } + } + } + + @Override + protected void getFullLedDescriptionOut(ArrayList<String> baseDescr, int hatchNo, int paramID) { + if(hatchNo<=3){ + String desc=DESCRIPTION_O[(hatchNo<<1)+paramID]; + if(desc!=null){ + baseDescr.add(desc); + } + } + } + + @Override public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { boolean check=true; te.setParameterOut(0,0,precisionFull); te.setParameterOut(0,1,precisionMinimal); te.setParameterOut(1,0,offsetMax); + te.setStatusOfParameterOut(1,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); te.setParameterOut(2,0,maxCharge); te.setParameterOut(2,1,maxCapacity); te.setParameterOut(3,0,V[tier]); te.setParameterOut(3,1,ticks); + for(int i=4;i<=9;i++) { + te.setStatusOfParameterOut(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + te.setStatusOfParameterOut(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + } + te.setStatusOfParameterIn(1, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + for(int i=2;i<=3;i++) { + te.setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + te.setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + } + double full=parametersToCheckAndFix[0]; if(Double.isInfinite(full) && full>0) { te.setStatusOfParameterIn(0,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index eb8b7f2a90..ff67263eab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if(aBaseMetaTileEntity.isClientSide() && (aTick & 0x2)==0){ - currentBehaviour = GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])); + currentBehaviour=GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])); if(aBaseMetaTileEntity.isActive()){ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX*2+aBaseMetaTileEntity.getXCoord(); int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY*2+aBaseMetaTileEntity.getYCoord(); @@ -107,18 +107,27 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir,yDir,zDir,xDir,yDir,zDir); } } - if(aBaseMetaTileEntity.isServerSide() && (aTick & 0xf)==0){ - currentBehaviour = GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])); - if (currentBehaviour == null) { - setStatusOfParameterIn(0,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(0,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(1,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(1,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(2,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(2,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(3,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(3,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - } + } + + private boolean setCurrentBehaviour(Behaviour newBehaviour){ + boolean changed=currentBehaviour!=newBehaviour; + if(changed){ + setDefaultParametersAndStatuses(); + } + currentBehaviour=newBehaviour; + return changed; + } + + private void setDefaultParametersAndStatuses() { + for (int i = 0; i <= 3; i++) { + setStatusOfParameterIn(i, 0, STATUS_NEUTRAL); + setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); + } + for (int i = 0; i <= 9; i++) { + setStatusOfParameterOut(i, 0, STATUS_NEUTRAL); + setStatusOfParameterOut(i, 1, STATUS_NEUTRAL); + setParameterOut(i, 0, 0); + setParameterOut(i, 1, 0); } } @@ -130,21 +139,20 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { - currentBehaviour = GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(itemStack)); - //TecTech.Logger.info("Looking for "+new Util.TT_ItemStack(itemStack).toString()); - if (currentBehaviour == null) { - setStatusOfParameterIn(0,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(0,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(1,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(1,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(2,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(2,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(3,0,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); - setStatusOfParameterIn(3,1,GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(itemStack))); + if(currentBehaviour==null){ return false; } //mux input - double[] parameters = new double[]{getParameterIn(0, 0), getParameterIn(0, 1), getParameterIn(1, 0), getParameterIn(1, 1), getParameterIn(2, 0), getParameterIn(2, 1), getParameterIn(3, 0), getParameterIn(3, 1)}; + double[] parameters = new double[]{ + getParameterIn(0, 0), + getParameterIn(0, 1), + getParameterIn(1, 0), + getParameterIn(1, 1), + getParameterIn(2, 0), + getParameterIn(2, 1), + getParameterIn(3, 0), + getParameterIn(3, 1)}; if (!currentBehaviour.setAndCheckParametersOutAndStatuses(this, parameters)) { return false; } @@ -214,7 +222,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void outputAfterRecipe_EM() { - if (outputEM == null) return; + if (setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])))) { + return; + } cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; int pointer = getParameterInInt(7, 0) - 1; if (pointer >= 0 && pointer < eOutputHatches.size()) { @@ -338,6 +348,21 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } } + setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1]))); + if (currentBehaviour == null) { + setDefaultParametersAndStatuses(); + } else { + double[] parameters = new double[]{ + getParameterIn(0, 0), + getParameterIn(0, 1), + getParameterIn(1, 0), + getParameterIn(1, 1), + getParameterIn(2, 0), + getParameterIn(2, 1), + getParameterIn(3, 0), + getParameterIn(3, 1)}; + currentBehaviour.setAndCheckParametersOutAndStatuses(this,parameters); + } } private static final HashMap<Util.TT_ItemStack, Behaviour> map = new HashMap<>(); @@ -350,19 +375,49 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa public static abstract class Behaviour { public Behaviour(){} + /** + * handle parameters pre recipe, and cyclically + * this shouldn't write to input parameters! only to the provided array and/or output parameters + * @param te this + * @param parametersToCheckAndFix array of 6 parameters to pass to the process method (can be modified) + * this allows to pass different numbers if u want to employ automatic parameter correction here + * @return return true if machine can start with current parameters, false if not + */ public abstract boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix); + /** + * do recipe handling + * @param inputs from muxed inputs + * @param checkedAndFixedParameters array passed from previous method! + * @return null if recipe should not start, control object to set machine state and start recipe + */ public abstract MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters); + /** + * get input param description, only for 4 first hatches + * @param baseDescr + * @param hatchNo + * @param paramID + */ protected void getFullLedDescriptionIn(ArrayList<String> baseDescr, int hatchNo, int paramID){} + /** + * get output param description + * @param baseDescr + * @param hatchNo + * @param paramID + */ protected void getFullLedDescriptionOut(ArrayList<String> baseDescr, int hatchNo, int paramID){} } @Override public ArrayList<String> getFullLedDescriptionIn(int hatchNo, int paramID) { ArrayList<String> base=super.getFullLedDescriptionIn(hatchNo, paramID); - if(currentBehaviour!=null){ + if(hatchNo>=7){ + base.add("Output mux "+((hatchNo-7)*2+paramID+1)); + }else if(hatchNo>=4){ + base.add("Input mux "+((hatchNo-4)*2+paramID+1)); + }else if(currentBehaviour!=null){ currentBehaviour.getFullLedDescriptionIn(base,hatchNo,paramID); } return base; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java new file mode 100644 index 0000000000..b2e1ec43a9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java @@ -0,0 +1,314 @@ +package com.github.technus.tectech.thing.metaTileEntity.single; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DataReader; +import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DataReader; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.Util.V; +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by Tec on 23.03.2017. + */ +public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine { + private static final HashMap<Util.TT_ItemStack,ArrayList<DataRender>> RENDER_REGISTRY =new HashMap<>(); + private static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; + + public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { + super(aID,aName,aNameRegional,aTier,1,"Reads Data Sticks and Orbs",1,1,"dataReader.png",""); + } + + public GT_MetaTileEntity_DataReader(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName,aTier,1,aDescription,aTextures,1,1,"dataReader.png",""); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_DataReader(mName, mTier, mDescription, mTextures); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + READER_ONLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/READER_ONLINE")); + READER_OFFLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/READER_OFFLINE")); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if(aBaseMetaTileEntity.getWorld()==null){ + if(aSide==aFacing){ + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + } + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + } + if(aSide==mMainFacing){ + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + }else if(aSide==aFacing){ + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return null; + } + + @Override + public int checkRecipe() { + if(getOutputAt(0)!=null){ + return DID_NOT_FIND_RECIPE; + } + ItemStack input=getInputAt(0); + ArrayList<DataRender> renders=getRenders(new Util.TT_ItemStack(input)); + for(DataRender render:renders){ + if(render.canRender(input,mTier)){ + mOutputItems[0]=input.copy(); + input.stackSize-=1; + calculateOverclockedNess(render.getReadingEUt(),render.getReadingTime()); + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + return FOUND_AND_SUCCESSFULLY_USED_RECIPE; + } + } + return DID_NOT_FIND_RECIPE; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + aBaseMetaTileEntity.setActive(getOutputAt(0)!=null || mMaxProgresstime>0); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_DataReader(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_DataReader(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_GENERAL, mDescription, + EnumChatFormatting.BLUE + "Power it up and", + EnumChatFormatting.BLUE + "Put the data storage in" + }; + } + + @Override + public boolean isElectric() { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide!=getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide!=getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public long maxEUInput() { + return V[mTier]; + } + + @Override + public long maxEUStore() { + return maxEUInput()*16L; + } + + @Override + public long getMinimumStoredEU() { + return maxEUInput()*4L; + } + + public static void addDataRender(Util.TT_ItemStack stack,DataRender render){ + ArrayList<DataRender> renders=RENDER_REGISTRY.get(stack); + if(renders==null){ + RENDER_REGISTRY.put(stack,renders=new ArrayList<>()); + } + render.loadResources(); + renders.add(render); + } + + public static ArrayList<DataRender> getRenders(Util.TT_ItemStack stack){ + return RENDER_REGISTRY.get(stack); + } + + public interface DataRender{ + @SideOnly(Side.CLIENT) + void loadResources(); + @SideOnly(Side.CLIENT) + void initRecipe(ItemStack itemStack); + @SideOnly(Side.CLIENT) + void renderTooltips(ItemStack itemStack,int mouseX,int mouseY,GT_GUIContainer_DataReader gui); + @SideOnly(Side.CLIENT) + void renderForeground(ItemStack itemStack,int mouseX,int mouseY,GT_GUIContainer_DataReader gui, FontRenderer font); + @SideOnly(Side.CLIENT) + void renderBackgroundOverlay(ItemStack itemStack, int mouseX, int mouseY, int X, int Y, GT_GUIContainer_DataReader gui); + boolean canRender(ItemStack itemStack, byte tier); + int getReadingEUt(); + int getReadingTime(); + } + + public static void run(){ + addDataRender(new Util.TT_ItemStack(ItemList.Tool_DataStick.get(1)),new DataRender() { + @SideOnly(Side.CLIENT) + private ResourceLocation bg; + @SideOnly(Side.CLIENT) + private HashMap<GT_Slot_Holo,ItemStack> slots; + private HashMap<GT_Slot_Holo,ItemStack[]> slots2; + + @Override + @SideOnly(Side.CLIENT) + public void loadResources() { + bg =new ResourceLocation(MODID+":textures/gui/assLineRender.png"); + } + + @Override + public void initRecipe(ItemStack itemStack) { + slots=new HashMap<>(); + slots2=new HashMap<>(); + + slots.put(new GT_Slot_Holo(null,0,143,55,false,false,1),ItemList.Tool_DataStick.getWithName(1,"Research data")); + ItemStack output=ItemStack.loadItemStackFromNBT(itemStack.stackTagCompound.getCompoundTag("output")); + if(output!=null){ + slots.put(new GT_Slot_Holo(null,0,143,19,false,false,64),output); + } + + for (int i = 0; i < 16; i++) { + ArrayList<ItemStack> array=new ArrayList<>(); + ItemStack input=ItemStack.loadItemStackFromNBT(itemStack.stackTagCompound.getCompoundTag(Integer.toString(i))); + if(input!=null){ + array.add(input); + } + for (int k = 0; k < itemStack.stackTagCompound.getInteger("a"+i); k++) { + input=ItemStack.loadItemStackFromNBT(itemStack.stackTagCompound.getCompoundTag("a" + i + ":" + k)); + if(input!=null){ + array.add(input); + } + } + if(array.size()>0){ + slots2.put(new GT_Slot_Holo(null,0,17+(i&0x3)*18,19+(i>>2)*18,false,false,64), + array.toArray(new ItemStack[0])); + } + } + for (int i = 0; i < 4; i++) { + FluidStack fs=FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("f"+i)); + if(fs!=null){ + slots.put(new GT_Slot_Holo(null,0,107,19+i*18,false,false,1), + GT_Utility.getFluidDisplayStack(fs, true)); + } + } + } + + @Override + public void renderTooltips(ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui) { + for(Map.Entry<GT_Slot_Holo,ItemStack> entry:slots.entrySet()){ + gui.renderTooltipSimple(mouseX, mouseY, entry.getKey(),entry.getValue()); + } + int time=(int)(System.currentTimeMillis()/2000); + for(Map.Entry<GT_Slot_Holo,ItemStack[]> entry:slots2.entrySet()){ + gui.renderTooltipSimple(mouseX, mouseY, entry.getKey(),entry.getValue()[time%entry.getValue().length]); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void renderForeground(ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui, FontRenderer font) { + int time=itemStack.stackTagCompound.getInteger("time"); + int EUt=itemStack.stackTagCompound.getInteger("eu"); + font.drawString("Assembly Line Recipe", 7, 8, 0x80a0ff); + font.drawString(GT_Utility.trans("152","Total: ") + ((long)time * EUt) + " EU",7,93, 0x80a0ff); + font.drawString(GT_Utility.trans("153","Usage: ") + EUt + " EU/t",7,103, 0x80a0ff); + font.drawString(GT_Utility.trans("154","Voltage: ") + EUt + " EU",7,113, 0x80a0ff); + font.drawString(GT_Utility.trans("155","Amperage: ") + 1 ,7,123, 0x80a0ff); + font.drawString( GT_Utility.trans("158","Time: ")+String.format("%.2f " + GT_Utility.trans("161"," secs"), 0.05F * time), 7,133, 0x80a0ff); + + for(Map.Entry<GT_Slot_Holo,ItemStack> entry:slots.entrySet()){ + gui.renderItemSimple(entry.getKey(),entry.getValue()); + } + time=(int)(System.currentTimeMillis()/2000); + for(Map.Entry<GT_Slot_Holo,ItemStack[]> entry:slots2.entrySet()){ + gui.renderItemSimple(entry.getKey(),entry.getValue()[time%entry.getValue().length]); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void renderBackgroundOverlay(ItemStack itemStack, int mouseX, int mouseY, int X, int Y, GT_GUIContainer_DataReader gui) { + //176/83 + gui.mc.getTextureManager().bindTexture(bg); + gui.drawTexturedModalRect(X,Y,0,0,176, 151); + } + + @Override + public boolean canRender(ItemStack itemStack,byte tier) { + NBTTagCompound nbtTagCompound=itemStack.stackTagCompound; + if(nbtTagCompound!=null && nbtTagCompound.hasKey("output")){ + return true; + } + return false; + } + + @Override + public int getReadingEUt() { + return (int)V[4]; + } + + @Override + public int getReadingTime() { + return 128; + } + }); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java index 80048e4bb9..04cac4cfe1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java @@ -93,7 +93,7 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public boolean isSimpleMachine() { - return false; + return true; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java new file mode 100644 index 0000000000..983ee2580e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java @@ -0,0 +1,100 @@ +package com.github.technus.tectech.thing.metaTileEntity.single.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_Container_BasicTank; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; + +public class GT_Container_DataReader extends GT_Container_BasicTank { + public boolean mStuttering = false; + + public GT_Container_DataReader(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + //this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 0, 8, 63, false, true, 1)); + //this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 0, 26, 63, false, true, 1)); + //this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 107, 63)); + + int tStartIndex = ((GT_MetaTileEntity_BasicMachine)this.mTileEntity.getMetaTileEntity()).getInputSlot(); + this.addSlotToContainer(new Slot(this.mTileEntity, tStartIndex, 53, 153)); + + tStartIndex = ((GT_MetaTileEntity_BasicMachine)this.mTileEntity.getMetaTileEntity()).getOutputSlot(); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, tStartIndex, 107, 153)); + + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 17, 153)); + //this.addSlotToContainer(new Slot(this.mTileEntity, 3, 125, 63)); + //this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex, 53, 63)); + } + + @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, 174 + i * 18)); + } + } + + for(i = 0; i < 9; ++i) { + this.addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 232)); + } + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { + this.mStuttering = ((GT_MetaTileEntity_BasicMachine)this.mTileEntity.getMetaTileEntity()).mStuttering; + + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 102, this.mStuttering ? 1 : 0); + } + + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch(par1) { + case 102: + this.mStuttering = par2 != 0; + } + + } + + @Override + public int getSlotStartIndex() { + return 0; + } + + @Override + public int getShiftClickStartIndex() { + return 0; + } + + @Override + public int getSlotCount() { + return 3; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java new file mode 100644 index 0000000000..1b9c2f384c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java @@ -0,0 +1,265 @@ +package com.github.technus.tectech.thing.metaTileEntity.single.gui; + +import com.github.technus.tectech.Util; +import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine { + public final String mName; + public final String mNEI; + public final byte mProgressBarDirection; + public final byte mProgressBarAmount; + private ItemStack stack=null; + + public GT_GUIContainer_DataReader(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, String aNEI) { + this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); + } + + public GT_GUIContainer_DataReader(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) { + super(new GT_Container_DataReader(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/basicmachines/" + aTextureFile); + this.mProgressBarDirection = aProgressBarDirection; + this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); + this.mName = aName; + this.mNEI = aNEI; + ySize = 256; + } + + @Override + 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_DataReader) { + GT_MetaTileEntity_DataReader reader = (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); + renderDataTooltips(mouseX,mouseY,reader.mTier); + } + } + } + + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + if (mContainer != null) { + if (mContainer.mTileEntity != null && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DataReader) { + GT_MetaTileEntity_DataReader reader = (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); + if (renderDataFG(mouseX, mouseY, reader.mTier)) { + return; + } + } + } + fontRendererObj.drawString(mName, 7, 8, 0xfafaff); + } + + protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) { + super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + if (((GT_Container_DataReader) this.mContainer).mStuttering) { + this.drawTexturedModalRect(x + 127, y + 152, 176, 54, 18, 18); + } + + if (this.mContainer.mMaxProgressTime > 0) { + int tSize = this.mProgressBarDirection < 2 ? 20 : 18; + int tProgress = Math.max(1, Math.min(tSize * this.mProgressBarAmount, (this.mContainer.mProgressTime > 0 ? 1 : 0) + this.mContainer.mProgressTime * tSize * this.mProgressBarAmount / this.mContainer.mMaxProgressTime)) % (tSize + 1); + switch (this.mProgressBarDirection) { + case 0: + this.drawTexturedModalRect(x + 78, y + 152, 176, 0, tProgress, 18); + break; + case 1: + this.drawTexturedModalRect(x + 78 + 20 - tProgress, y + 152, 196 - tProgress, 0, tProgress, 18); + break; + case 2: + this.drawTexturedModalRect(x + 78, y + 152, 176, 0, 20, tProgress); + break; + case 3: + this.drawTexturedModalRect(x + 78, y + 152 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + break; + case 4: + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 78, y + 152, 176, 0, tProgress, 18); + break; + case 5: + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 78 + 20 - tProgress, y + 152, 196 - tProgress, 0, tProgress, 18); + break; + case 6: + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 78, y + 152, 176, 0, 20, tProgress); + break; + case 7: + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 78, y + 152 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + } + } + } + if (mContainer != null) { + if (mContainer.mTileEntity != null && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DataReader) { + GT_MetaTileEntity_DataReader reader = (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); + renderDataBG(reader.getStackInSlot(reader.getOutputSlot()), mouseX, mouseY, x, y, reader.mTier); + } + } + } + + private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) { + if (thing != null) { + ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(thing)); + for (GT_MetaTileEntity_DataReader.DataRender render : renders) { + if (render.canRender(thing, mTier)) { + if (!GT_Utility.areStacksEqual(stack, thing, false)) { + render.initRecipe(thing); + } + render.renderBackgroundOverlay(thing, mouseX, mouseY, x, y, this); + break; + } + } + } + stack=thing; + } + + private boolean renderDataFG(int mouseX, int mouseY, byte mTier) { + if(stack==null){ + return false; + } + ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(stack)); + for (GT_MetaTileEntity_DataReader.DataRender render : renders) { + if (render.canRender(stack, mTier)) { + render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); + return true; + } + } + return false; + } + + private boolean renderDataTooltips(int mouseX, int mouseY, byte mTier) { + if(stack==null){ + return false; + } + ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(stack)); + for (GT_MetaTileEntity_DataReader.DataRender render : renders) { + if (render.canRender(stack, mTier)) { + render.renderTooltips(stack, mouseX, mouseY, this); + return true; + } + } + return false; + } + + public void renderItemSimple(GT_Slot_Holo slot, ItemStack itemStack) { + int x = slot.xDisplayPosition; + int y = slot.yDisplayPosition; + this.zLevel = 100.0F; + itemRender.zLevel = 100.0F; + + if (itemStack == null) { + IIcon iicon = slot.getBackgroundIconIndex(); + + if (iicon != null) { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this. + this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture); + this.drawTexturedModelRectFromIcon(x, y, iicon, 16, 16); + GL11.glDisable(GL11.GL_BLEND); // Forge: And clean that up + GL11.glEnable(GL11.GL_LIGHTING); + } + } + GL11.glEnable(GL11.GL_DEPTH_TEST); + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemStack, x, y); + itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemStack, x, y); + + itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + } + + public void renderTooltipSimple(int mouseX, int mouseY, GT_Slot_Holo slot, ItemStack itemStack) { + int x = slot.xDisplayPosition + (width - xSize) / 2; + int y = slot.yDisplayPosition + (height - ySize) / 2; + if (mouseX >= x && mouseY >= y && mouseX <= x+16 && mouseY <= y+16 ) { + List strings=itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if(strings.size()>0){ + strings.set(0,itemStack.getRarity().rarityColor+(String)strings.get(0)); + } + hoveringText(strings, mouseX, mouseY, fontRendererObj); + } + } + + private void hoveringText(List strings, int x, int y, FontRenderer font) { + if (!strings.isEmpty()) { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + //RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + int k = 0; + + for (Object aP_146283_1_ : strings) { + String s = (String) aP_146283_1_; + int l = font.getStringWidth(s); + + if (l > k) { + k = l; + } + } + + int x2 = x + 12; + int y2 = y - 12; + int i1 = 8; + + if (strings.size() > 1) { + i1 += 2 + (strings.size() - 1) * 10; + } + + if (x2 + k > this.width) { + x2 -= 28 + k; + } + + if (y2 + i1 + 6 > this.height) { + y2 = this.height - i1 - 6; + } + + //this.zLevel = 300.0F; + //itemRender.zLevel = 300.0F; + int j1 = 0xf0001040;//bg + this.drawGradientRect(x2 - 3, y2 - 4, x2 + k + 3, y2 - 3, j1, j1); + this.drawGradientRect(x2 - 3, y2 + i1 + 3, x2 + k + 3, y2 + i1 + 4, j1, j1); + this.drawGradientRect(x2 - 3, y2 - 3, x2 + k + 3, y2 + i1 + 3, j1, j1); + this.drawGradientRect(x2 - 4, y2 - 3, x2 - 3, y2 + i1 + 3, j1, j1); + this.drawGradientRect(x2 + k + 3, y2 - 3, x2 + k + 4, y2 + i1 + 3, j1, j1); + int k1 = 0x500040ff;//border bright + int l1 = (k1 & 0xfefefe) >> 1 | k1 & 0xff000000;//border dark??? + this.drawGradientRect(x2 - 3, y2 - 3 + 1, x2 - 3 + 1, y2 + i1 + 3 - 1, k1, l1); + this.drawGradientRect(x2 + k + 2, y2 - 3 + 1, x2 + k + 3, y2 + i1 + 3 - 1, k1, l1); + this.drawGradientRect(x2 - 3, y2 - 3, x2 + k + 3, y2 - 3 + 1, k1, k1); + this.drawGradientRect(x2 - 3, y2 + i1 + 2, x2 + k + 3, y2 + i1 + 3, l1, l1); + + for (int i2 = 0; i2 < strings.size(); ++i2) { + String s1 = (String) strings.get(i2); + font.drawStringWithShadow(s1, x2, y2, -1); + + if (i2 == 0) { + y2 += 2; + } + + y2 += 10; + } + + //this.zLevel = 0.0F; + //itemRender.zLevel = 0.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + //RenderHelper.enableStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png Binary files differnew file mode 100644 index 0000000000..ee04fde165 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_OFFLINE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":8 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png Binary files differnew file mode 100644 index 0000000000..cfb2f8aaa7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/READER_ONLINE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":8 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/gui/basicmachines/dataReader.png b/src/main/resources/assets/gregtech/textures/gui/basicmachines/dataReader.png Binary files differnew file mode 100644 index 0000000000..57a9b85ce9 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/basicmachines/dataReader.png diff --git a/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png Binary files differindex 95aa09beae..e67f96e34e 100644 --- a/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png +++ b/src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.png diff --git a/src/main/resources/assets/tectech/textures/gui/assLineRender.png b/src/main/resources/assets/tectech/textures/gui/assLineRender.png Binary files differnew file mode 100644 index 0000000000..cc1cd35a7d --- /dev/null +++ b/src/main/resources/assets/tectech/textures/gui/assLineRender.png |