From faabe32126c6d7a6b9c55c50905e1d99a2af43f3 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 27 Aug 2017 22:06:35 +0200 Subject: Texturing, gui rework --- .../technus/tectech/loader/MachineLoader.java | 2 +- .../technus/tectech/recipe/TT_recipeAdder.java | 6 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 26 +++++ .../multi/GT_MetaTileEntity_EM_computer.java | 14 +++ .../multi/GT_MetaTileEntity_EM_crafter.java | 83 ---------------- .../multi/GT_MetaTileEntity_EM_crafting.java | 109 +++++++++++++++++++++ .../multi/GT_MetaTileEntity_EM_decay.java | 26 +++++ .../multi/GT_MetaTileEntity_EM_research.java | 2 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 4 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 13 +++ .../multi/GT_MetaTileEntity_TM_microwave.java | 13 +++ .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 22 ++++- 12 files changed, 227 insertions(+), 93 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java (limited to 'src/main/java') 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 6b37db2cee..ebe8642d26 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -201,7 +201,7 @@ public class MachineLoader implements Runnable { Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EM_machine(15360, "multimachine.em.processing", "Quantum Processing Machine").getStackForm(1L)); - Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafter(15370, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); + Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafting(15370, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); Machine_Multi_Stabilizer.set(new GT_MetaTileEntity_EM_stabilizer(15380, "multimachine.em.stabilizer", "Elemental Stabilizer").getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index d1933f0ba4..51c9982752 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionSt import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import com.github.technus.tectech.thing.item.DefinitionContainer_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafter; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_Recipe; @@ -80,7 +80,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafter.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map.sCrafterRecipes.add(new TT_recipe.TT_assLineRecipe(false,aResearchItem,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; @@ -125,7 +125,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; ItemStack placeholder=new ItemStack(DefinitionContainer_EM.INSTANCE); DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); - GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+GT_MetaTileEntity_EM_crafter.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index ec6e4497cd..2ff9659b73 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -3,20 +3,30 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +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.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureBuilder; 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; /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + //region structure private static final String[][] shape = new String[][]{ {"\u0002","D000","C0 0","C0 . 0","C0 0","D000"}, @@ -56,6 +66,22 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl return new GT_MetaTileEntity_EM_annihilation(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @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][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); 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 df74ff604d..34a96c7810 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 @@ -9,6 +9,8 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; +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; @@ -17,6 +19,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -33,6 +36,9 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private final ArrayList eRacks = new ArrayList<>(); private int maxTemp = 0; @@ -70,6 +76,14 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return new GT_MetaTileEntity_EM_computer(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java deleted file mode 100644 index affcd442ee..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_crafter extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public final static String crafter="EM Crafting"; - //region structure - private static final String[][] shape = new String[][]{ - {"A000","0 0","0 . 0","0 0","A000",}, - {"00000","00000","00000","00000","00000",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"22222","22222","22122","22222","22222",}, - {"23432","33333","43134","33333","23432",}, - {"23332","33333","33533","33333","23332",}, - {"23432","33333","43134","33333","23432",}, - {"22222","22222","22122","22222","22222",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"00000","00000","00000","00000","00000",}, - {"A000","0 0","0 0","0 0","A000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Hatches or Molecular Casing", - }; - //endregion - - public GT_MetaTileEntity_EM_crafter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_crafter(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_crafter(this.mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilder(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.tecMark, - "The most precise way of making stuff.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java new file mode 100644 index 0000000000..79ece0f7be --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -0,0 +1,109 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +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.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.Util.StructureBuilder; +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; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + + public final static String crafter="EM Crafting"; + //region structure + private static final String[][] shape = new String[][]{ + {"A000","0 0","0 . 0","0 0","A000",}, + {"00000","00000","00000","00000","00000",}, + {"0C0","A!!!","A!1!","A!!!","0C0",}, + {"22222","22222","22122","22222","22222",}, + {"23432","33333","43134","33333","23432",}, + {"23332","33333","33533","33333","23332",}, + {"23432","33333","43134","33333","23432",}, + {"22222","22222","22122","22222","22222",}, + {"0C0","A!!!","A!1!","A!!!","0C0",}, + {"00000","00000","00000","00000","00000",}, + {"A000","0 0","0 0","0 0","A000",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or High Power Casing", + "2 - Elemental Hatches or Molecular Casing", + }; + //endregion + + public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_crafting(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_crafting(this.mName); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @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][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilder(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.tecMark, + "The most precise way of making stuff.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 679e0a280d..6802518fc5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -5,10 +5,16 @@ import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStac import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +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_Energy; +import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -16,12 +22,16 @@ import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.Util.VN; import static com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition.stableRawLifeTime; 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; /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + //region structure private static final String[][] shape = new String[][]{ {"0C0","A ","A . ","A ","0C0",}, @@ -59,6 +69,22 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new GT_MetaTileEntity_EM_decay(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @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][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index d481d5fd24..679e44ee8e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -34,7 +34,7 @@ import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; 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; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafter.crafter; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine.machine; import static gregtech.api.enums.GT_Values.E; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index e73a313619..0c79bf96fc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -151,7 +151,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else { eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); if (eRecipe != null) { - machineType = GT_MetaTileEntity_EM_crafter.crafter; + machineType = GT_MetaTileEntity_EM_crafting.crafter; } } } @@ -186,7 +186,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); if(eRecipe!=null) { scannerRecipe=eRecipe.scannerRecipe; - machineType=GT_MetaTileEntity_EM_crafter.crafter; + machineType= GT_MetaTileEntity_EM_crafting.crafter; objectResearched=new cElementalDefinitionStack(stackEM.definition,1); //cleanMassEM_EM(objectResearched.getMass()); researchEM.remove(objectResearched.definition); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 8d8b758103..afa09f57d9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -2,12 +2,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; 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.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -73,6 +76,16 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo StructureBuilder(shape, blockType, blockMeta,1, 1, 0, getBaseMetaTileEntity(),hintsOnly); } + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true,false,false); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png",true,false,false); + } + @Override public String[] getStructureDescription(int stackSize) { return description; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index a63f948bf1..95fbbd9d56 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -3,6 +3,8 @@ 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.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,6 +17,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -90,6 +93,16 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; } + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png", false, false, true); + } + @Override public boolean isFacingValid(byte aFacing) { return aFacing >= 2; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java index e1b4c2775c..98e60e4498 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java @@ -15,10 +15,20 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { String mName = ""; private static byte counter = 0; + public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mName = aName; + ePowerPassButton=enablePowerPass; + eSafeVoidButton=enableSafeVoid; + allowedToWorkButton=enablePowerButton; + } 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; } @Override @@ -68,13 +78,19 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); - if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) + if(!ePowerPassButton) + drawTexturedModalRect(x + 151, y + 23, 215, 23, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); - if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) + if(!eSafeVoidButton) + drawTexturedModalRect(x + 151, y + 41, 215, 41, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) drawTexturedModalRect(x + 151, y + 41, 183, 41, 18, 18); - if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) + if(!allowedToWorkButton) + drawTexturedModalRect(x + 151, y + 57, 215, 57, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) drawTexturedModalRect(x + 151, y + 57, 183, 57, 18, 18); x += 11; -- cgit