diff options
author | Technus <daniel112092@gmail.com> | 2017-05-11 20:59:16 +0200 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-05-11 20:59:16 +0200 |
commit | 6c7e83ab3d7cf420fbcc93aa27aca0123c47307c (patch) | |
tree | 83df286a9e5a1bbda5e2a0dc6462cc55e0bc5e77 /src/main/java/com | |
parent | a779da457ab9b63cc5dc19d0ac1bc13d8945d709 (diff) | |
download | GT5-Unofficial-6c7e83ab3d7cf420fbcc93aa27aca0123c47307c.tar.gz GT5-Unofficial-6c7e83ab3d7cf420fbcc93aa27aca0123c47307c.tar.bz2 GT5-Unofficial-6c7e83ab3d7cf420fbcc93aa27aca0123c47307c.zip |
Sum work on structures
Diffstat (limited to 'src/main/java/com')
15 files changed, 496 insertions, 82 deletions
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 a31fe71772..c7a346803b 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -186,6 +186,7 @@ public class MachineLoader implements Runnable { Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EM_dequantizer(15322, "multimachine.em.emtomatter", "Matter Dequantizer").getStackForm(1L)); Machine_Multi_Scanner.set(new GT_MetaTileEntity_EM_scanner(15330, "multimachine.em.scanner", "Elemental Scanner").getStackForm(1L)); + Machine_Multi_Research.set(new GT_MetaTileEntity_EM_research(15331, "multimachine.em.research", "Research station").getStackForm(1L)); Machine_Multi_Collider.set(new GT_MetaTileEntity_EM_collider(15340, "multimachine.em.collider", "Matter Collider").getStackForm(1L)); @@ -207,15 +208,16 @@ public class MachineLoader implements Runnable { // =================================================================================================== // Hatches // =================================================================================================== - Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.08", "Parametrizer", 7).getStackForm(1L)); + Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.07", "Parametrizer", 7).getStackForm(1L)); - Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15430, "hatch.certain.tier.08", "Uncertainty Resolver", 7).getStackForm(1L)); + Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15430, "hatch.certain.tier.07", "Uncertainty Resolver", 7).getStackForm(1L)); UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15431, "hatch.certain.tier.10", "Uncertainty Resolver X", 10).getStackForm(1L)); - dataIn_Hatch.set(new GT_MetaTileEntity_Hatch_InputData(15440, "hatch.datain.tier.08", "Optical Slave Connector", 8).getStackForm(1L)); - dataOut_Hatch.set(new GT_MetaTileEntity_Hatch_OutputData(15441, "hatch.dataout.tier.08", "Optical Master Connector", 8).getStackForm(1L)); + dataIn_Hatch.set(new GT_MetaTileEntity_Hatch_InputData(15440, "hatch.datain.tier.07", "Optical Slave Connector", 7).getStackForm(1L)); + dataOut_Hatch.set(new GT_MetaTileEntity_Hatch_OutputData(15441, "hatch.dataout.tier.07", "Optical Master Connector", 7).getStackForm(1L)); rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450,"hatch.rack.tier.08","Computer Rack",8,"4 Slot Rack").getStackForm(1L)); + holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451,"hatch.holder.tier.09","Object Holder",8,"For Research Station").getStackForm(1L)); // =================================================================================================== // Pipes 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 ef1837e328..53220e0d61 100644 --- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.elementalMatter.definitions.*; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_computer; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_research; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; /** @@ -40,6 +41,7 @@ public class RecipeLoader implements Runnable { GT_MetaTileEntity_MultiblockBase_EM.run(); GT_MetaTileEntity_Hatch_Rack.run(); GT_MetaTileEntity_EM_computer.run(); + GT_MetaTileEntity_EM_research.run(); GT_MetaTileEntity_EM_quantizer.run(); } } 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 929e277ac0..03105efbb8 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -12,7 +12,7 @@ import static gregtech.api.enums.GT_Values.W; public enum CustomItemList implements IItemContainer { Machine_DebugWriter, - EMpipe,DATApipe,rack_Hatch, + EMpipe,DATApipe,rack_Hatch,holder_Hatch, eM_dynamomulti4_UV, eM_dynamomulti16_UV, eM_dynamomulti64_UV, eM_dynamomulti4_UHV, eM_dynamomulti16_UHV, eM_dynamomulti64_UHV, eM_dynamomulti4_UEV, eM_dynamomulti16_UEV, eM_dynamomulti64_UEV, @@ -34,7 +34,7 @@ public enum CustomItemList implements IItemContainer { Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Infuser, Machine_Multi_Switch, Machine_Multi_BHG, Machine_Multi_Annihilation, Machine_Multi_Decay, - Machine_Multi_EMmachine, Machine_Multi_Stabilizer, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner; + Machine_Multi_EMmachine, Machine_Multi_Stabilizer, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner, Machine_Multi_Research; private ItemStack mStack = null; diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index 76d9c15fa7..0938a85eee 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -43,7 +43,7 @@ public class GT_Block_CasingsTT GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Containment Field Generator"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Molecular Coil"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Collider Hollow Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Hollow Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Spacetime Altering Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Teleportation Casing"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java new file mode 100644 index 0000000000..e5f00eb2e5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -0,0 +1,143 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Holder; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Rack; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Holder; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Rack; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +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 java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.CommonValues.multiCheckAt; +import static com.github.technus.tectech.Util.getUniqueIdentifier; + +/** + * Created by Tec on 03.04.2017. + */ +public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch implements machineTT { + private static Textures.BlockIcons.CustomIcon EM_H; + private static Textures.BlockIcons.CustomIcon EM_H_ACTIVE; + + public GT_MetaTileEntity_Hatch_Holder(int aID, String aName, String aNameRegional, int aTier, String descr) { + super(aID, aName, aNameRegional, aTier, 1, descr); + } + + public GT_MetaTileEntity_Hatch_Holder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 1, aDescription, aTextures); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + EM_H_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/EM_HOLDER_ACTIVE"); + EM_H = new Textures.BlockIcons.CustomIcon("iconsets/EM_HOLDER"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_H_ACTIVE)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_H)}; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_Holder(mName,mTier,mDescription,mTextures); + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing>=2; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == aBaseMetaTileEntity.getFrontFacing(); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == aBaseMetaTileEntity.getFrontFacing(); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Holder(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder Hatch"); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + //if(aBaseMetaTileEntity.isActive()) + // aPlayer.addChatComponentMessage(new ChatComponentText("It is still active...")); + //else if(heat>0) + // aPlayer.addChatComponentMessage(new ChatComponentText("It is still warm...")); + //else + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + //@Override + //public void onRemoval() { + // if(mInventory!=null && (heat>0 || (getBaseMetaTileEntity()!=null && getBaseMetaTileEntity().isActive()))) + // for(int i=0;i<mInventory.length;i++) + // mInventory[i]=null; + //} + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.tecMark, + mDescription, + EnumChatFormatting.AQUA + "Advanced Holding Mechanism!" + }; + } +} + + diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java index 05139c8319..c6b4361321 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java @@ -21,8 +21,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import java.util.HashMap; import java.util.Map; -import java.util.TreeMap; import static com.github.technus.tectech.CommonValues.multiCheckAt; import static com.github.technus.tectech.Util.getUniqueIdentifier; @@ -35,7 +35,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem private static Textures.BlockIcons.CustomIcon EM_R_ACTIVE; public int heat=0; private float overClock =1, overVolt =1; - private static Map<String,component> componentBinds=new TreeMap<>(); + private static Map<String,component> componentBinds=new HashMap<>(); public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier, String descr) { super(aID, aName, aNameRegional, aTier, 4, descr); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java new file mode 100644 index 0000000000..72da3d6b34 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java @@ -0,0 +1,71 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +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.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +/** + * Created by Tec on 09.04.2017. + */ +public class GT_Container_Holder extends GT_ContainerMetaTile_Machine { + public GT_Container_Holder(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 39)); + } + + public int getSlotCount() { + return 1; + } + + public int getShiftClickSlotCount() { + return 1; + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if(mActive!=0) return null; + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer aPlayer, int aSlotIndex) { + if(mActive!=0) return null; + return super.transferStackInSlot(aPlayer, aSlotIndex); + } + + @Override + public boolean canDragIntoSlot(Slot par1Slot) { + if(mActive!=0) return false; + return super.canDragIntoSlot(par1Slot); + } + + @Override + public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) { + if(mActive!=0) return; + super.putStacksInSlots(par1ArrayOfItemStack); + } + + @Override + protected boolean mergeItemStack(ItemStack aStack, int aStartIndex, int aSlotCount, boolean par4) { + if(mActive!=0) return false; + return super.mergeItemStack(aStack, aStartIndex, aSlotCount, par4); + } + + @Override + public void putStackInSlot(int par1, ItemStack par2ItemStack) { + if(mActive!=0) return; + super.putStackInSlot(par1, par2ItemStack); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java new file mode 100644 index 0000000000..a13e180edb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java @@ -0,0 +1,32 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * Created by Tec on 09.04.2017. + */ +public class GT_GUIContainer_Holder extends GT_GUIContainerMetaTile_Machine { + private final String mName; + + public GT_GUIContainer_Holder(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new GT_Container_Holder(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/holder.png"); + this.mName = aName; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(this.mName, 8, 4, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + 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_Holder)mContainer).mActive==1) + drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); + } + } +} 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 6b79b9fe9b..30bdbc8609 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 @@ -7,19 +7,31 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT; + /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase_EM { + //region structure private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind + {"0C0","A ","A + ","A ","0C0",}, + {"00000","00000","00000","00000","00000",}, + {"0C0","A!!!","A!0!","A!!!","0C0",}, + {"00000","01110","01110","01110","00000",}, + {"0\"\"\"0","\"111\"","\"111\"","\"111\"","0\"\"\"0",}, + {"00000","01110","01110","01110","00000",}, + {"0C0","A!!!","A!0!","A!!!","0C0",}, + {"00000","00000","00000","00000","00000",}, + {"0C0","A ","A ","A ","0C0",}, }; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4,8}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList","addElementalToMachineList","addElementalMufflerToMachineList"}; + private static final byte[] casingTextures = new byte[]{textureOffset,textureOffset+4,textureOffset+4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0,4,4}; + //endregion public GT_MetaTileEntity_EM_decay(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -35,7 +47,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; + return EM_StructureCheckAdvanced(shape,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,2,2,0); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 3ee24344bf..e01e3e364d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -21,16 +21,19 @@ import static gregtech.api.GregTech_API.mEUtoRF; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM { - //use multi A energy inputs, use less power the longer it runs + //region Structure private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind + {" ","000","1+1","000"," ",}, + {" ","010","111","010"," ",}, + {" ","000","111","000"," ",}, }; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{7,4}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList"}; + private static final byte[] casingTextures = new byte[]{textureOffset}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0}; + //endregion public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -42,34 +45,18 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa minRepairStatus=(byte) getIdealStatus(); } + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing>=2; + } + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_infuser(this.mName); } @Override public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != sBlockCasingsTT || iGregTechTileEntity.getMetaIDOffset(xDir, yDir, zDir) != 6) - return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 99)) && - (!addEnergyIOToMachineList(tTileEntity, 99))) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { - return false; - } - } - } - } - } - } - return true; + return EM_StructureCheckAdvanced(shape,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,0); } @Override 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 18e0e98241..7ad4b57ab8 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 @@ -7,16 +7,34 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; 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 net.minecraftforge.common.util.ForgeDirection; +import static com.github.technus.tectech.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT; import static gregtech.api.enums.GT_Values.V; /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM { + //region Structure + //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {" "," + "," ",}, + {"000","000","000",}, + {"!!!","!0!","!!!",}, + {"!!!","!!!","!!!",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList","addElementalToMachineList"}; + private static final byte[] casingTextures = new byte[]{textureOffset,textureOffset+4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0,4}; + //endregion + public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -31,30 +49,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlassBlock.INSTANCE) return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, textureOffset+4)) && - (!addElementalInputToMachineList(tTileEntity, textureOffset+4)) && - (!addElementalOutputToMachineList(tTileEntity, textureOffset+4)) && - (!addMufflerToMachineList(tTileEntity, textureOffset+4)) && - (!addEnergyIOToMachineList(tTileEntity, textureOffset+4))) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 4) { - return false; - } - } - } - } - } - } - return true; + return EM_StructureCheckAdvanced(shape,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,1,0); } @Override 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 new file mode 100644 index 0000000000..aa0d9d3a64 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -0,0 +1,145 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; +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.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; + +import static com.github.technus.tectech.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM { + private final ArrayList<GT_MetaTileEntity_Hatch_Holder> eHolders=new ArrayList<>(); + + //region structure + private static final String[][] shape = new String[][]{ + {E,"000",E,E,E,"000",E,}, + {"A0","010","A1","A!","A1","010","A0",}, + {"A0","010",E,E,E,"010","A0",}, + {"000","010",E,E,E,"010","000",}, + {"000","212","010","0+0","010","212","000",}, + {"000","212","111","111","111","212","000",}, + {"000","222"," "," "," ","222","000",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{1,3,2}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList","addHolderToMachineList"}; + private static final byte[] casingTextures = new byte[]{textureOffset+3,textureOffset+3}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; + private static final byte[] blockMetaFallback = new byte[]{3,0}; + //endregion + + public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_research(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_research(this.mName); + } + + @Override + public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + for(GT_MetaTileEntity_Hatch_Holder rack:eHolders) + if (isValidMetaTileEntity(rack)) + rack.getBaseMetaTileEntity().setActive(false); + eHolders.clear(); + + if(!EM_StructureCheckAdvanced(shape,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,3,4)) return false; + + for(GT_MetaTileEntity_Hatch_Holder rack:eHolders) + if (isValidMetaTileEntity(rack)) + rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); + return eHolders.size() == 1; + } + + @Override + public boolean EM_checkRecipe(ItemStack itemStack) { + //for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { + // r.getBaseMetaTileEntity().setActive(true); + //}//Look in Computer code + return false; + } + + @Override + protected void EM_extraExplosions() { + for (MetaTileEntity tTileEntity : eHolders) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing>=2; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[textureOffset+3], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[textureOffset+3]}; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.tecMark, + "Philosophers didn't even...", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "dream about it!" + }; + } + + + @Override + public void onRemoval() { + super.onRemoval(); + for(GT_MetaTileEntity_Hatch_Holder r:eHolders) + r.getBaseMetaTileEntity().setActive(false); + } + + @Override + protected void EM_stopMachine() { + for(GT_MetaTileEntity_Hatch_Holder r:eHolders) + r.getBaseMetaTileEntity().setActive(false); + } + + //NEW METHOD + public final boolean addHolderToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Holder) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eHolders.add((GT_MetaTileEntity_Hatch_Holder) aMetaTileEntity); + } + return false; + } + + public static void run(){ + try { + adderMethodMap.put("addHolderToMachineList", GT_MetaTileEntity_EM_research.class.getMethod("addHolderToMachineList", 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_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index f070434ad3..326f52e88f 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 @@ -1,25 +1,42 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; 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.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT; + /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM { + + //region structure private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind + {" "," 222 "," 2+2 "," 222 "," ",}, + {"00000","00000","00000","00000","00000",}, + {"00100","01110","11111","01110","00100",}, + {"01110","1C1","1C1","1C1","01110",}, + {"01110","1C1","1C1","1C1","01110",}, + {"01110","1C1","1C1","1C1","01110",}, + {"00100","01110","11\"11","01110","00100",}, + {"!!!!!","!000!","!0#0!","!000!","!!!!!",}, }; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE,sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4,0,0}; + private static final String[] addingMethods = new String[]{ + "addClassicToMachineList", + "addElementalMufflerToMachineList", + "addElementalOutputToMachineList", + "addElementalInputToMachineList"}; + private static final byte[] casingTextures = new byte[]{textureOffset,textureOffset+4,textureOffset+4,textureOffset+4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0,4,4,4}; + //endregion public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -35,7 +52,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; + if (!EM_StructureCheckAdvanced(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) + return false; + return eInputHatches.size() != 1 || eOutputHatches.size() != 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 4987ed60cc..783590d64c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -35,8 +35,8 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; import java.util.Map; -import java.util.TreeMap; import static com.github.technus.tectech.CommonValues.*; import static com.github.technus.tectech.Util.StructureChecker; @@ -48,7 +48,7 @@ import static gregtech.api.enums.GT_Values.VN; * Created by danie_000 on 27.10.2016. */ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements machineTT { - protected final static Map<String,Method> adderMethodMap =new TreeMap<>(); + protected final static Map<String,Method> adderMethodMap =new HashMap<>(); public static Method adderMethod; protected cElementalInstanceStackMap[] outputEM = new cElementalInstanceStackMap[0]; @@ -132,7 +132,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //BUT NEEDED WHEN - machine blocks are not touching each other ot they don't implement IMachineBlockUpdateable (ex. air) protected boolean EM_cyclicUpdate(){ return mUpdate<=-1000;//set to false to disable cyclic update - //default is once per 50s; + //default is once per 50s; mUpdate is decremented every tick } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo new file mode 100644 index 0000000000..e8732c11f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -0,0 +1,6 @@ +microwave grinder +research station +forcefields +colorizer -> aka colorable 'bloodmoon' in a box +gravity wells/entity accelerators +reverse expand ore processing by scanning ores XD
\ No newline at end of file |