diff options
36 files changed, 582 insertions, 169 deletions
diff --git a/build.properties b/build.properties index f77bc158d5..86db1215b7 100644 --- a/build.properties +++ b/build.properties @@ -11,4 +11,4 @@ cofhcore.version=[1.7.10]3.0.3-303-dev cofhlib.cf=2246/918 cofhlib.version=[1.7.10]1.0.3-175-dev -yamcore.version=0.5.70
\ No newline at end of file +yamcore.version=0.5.73
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index a2879c16d8..b373ef3ec9 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack; import java.util.List; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore") + + "required-after:YAMCore@[0.5.73,);" + "required-after:gregtech;" + "after:CoFHCore") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) diff --git a/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java index 21824b4579..d149e37da5 100644 --- a/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java +++ b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; +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 static com.github.technus.tectech.thing.CustomItemList.*; @@ -175,10 +176,10 @@ public class GT_Loader_Machines implements Runnable { // =================================================================================================== Machine_Multi_Transformer.set(new GT_MetaTileEntity_EM_transformer(12160, "multimachine.em.transformer", "Active Transformer").getStackForm(1L)); - Machine_Multi_Infuser.set(new GT_MetaTileEntity_EM_infuser(12161,"multimachine.em.infuser","Energy infuser").getStackForm(1)); + Machine_Multi_Infuser.set(new GT_MetaTileEntity_EM_infuser(12161,"multimachine.em.infuser","Energy Infuser").getStackForm(1)); Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantizer(12162, "multimachine.em.mattertoem", "Matter Quantizer").getStackForm(1L)); Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EM_dequantizer(12163, "multimachine.em.emtomatter", "Matter Dequantizer").getStackForm(1L)); - Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(12164, "multimachine.em.junction", "Matter junction").getStackForm(1L)); + Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(12164, "multimachine.em.junction", "Matter Junction").getStackForm(1L)); Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EM_machine(12165, "multimachine.em.processing", "Quantum Processing Machine").getStackForm(1L)); Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafter(12166, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); Machine_Multi_Collider.set(new GT_MetaTileEntity_EM_collider(12167, "multimachine.em.collider", "Matter Collider").getStackForm(1L)); @@ -186,18 +187,21 @@ public class GT_Loader_Machines implements Runnable { Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EM_wormhole(12169, "multimachine.em.wormhole", "Wormhole").getStackForm(1L)); Machine_Multi_Stabilizer.set(new GT_MetaTileEntity_EM_stabilizer(12170, "multimachine.em.stabilizer", "Elemental Stabilizer").getStackForm(1L)); Machine_Multi_Scanner.set(new GT_MetaTileEntity_EM_scanner(12171, "multimachine.em.scanner", "Elemental Scanner").getStackForm(1L)); - Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(12172, "multimachine.em.computer", "Quantum computer").getStackForm(1L)); + Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(12172, "multimachine.em.computer", "Quantum Computer").getStackForm(1L)); // =================================================================================================== // Hatches EM // =================================================================================================== - Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12180, "hatch.param.tier.06", "Parametrizer for machines", 6).getStackForm(1L)); - Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12181, "hatch.certain.tier.06", "Uncertainty resolver", 6).getStackForm(1L)); - UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12182, "hatch.certain.tier.10", "Uncertainty resolver X", 10).getStackForm(1L)); + Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12180, "hatch.param.tier.08", "Parametrizer", 8).getStackForm(1L)); + Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12181, "hatch.certain.tier.08", "Uncertainty Resolver", 10).getStackForm(1L)); + UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12182, "hatch.certain.tier.10", "Uncertainty Resolver X", 10).getStackForm(1L)); + dataIn_Hatch.set(new GT_MetaTileEntity_Hatch_InputData(12183, "hatch.datain.tier.08", "Optical Host Connector", 8).getStackForm(1L)); + dataOut_Hatch.set(new GT_MetaTileEntity_Hatch_OutputData(12184, "hatch.dataout.tier.08", "Optical Server Connector", 8).getStackForm(1L)); // =================================================================================================== // EM pipe // =================================================================================================== - EMpipe.set(new GT_MetaTileEntity_Pipe_EM(12199, "pipe.elementalmatter", "Quantum tunnel").getStackForm(1L)); + EMpipe.set(new GT_MetaTileEntity_Pipe_EM(12200, "pipe.elementalmatter", "Quantum Tunnel").getStackForm(1L)); + DATApipe.set(new GT_MetaTileEntity_Pipe_Data(12201, "pipe.datastream", "Optical Fiber Cable").getStackForm(1L)); } } 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 e40b478325..0de21e30a0 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 { - EMpipe, + EMpipe,DATApipe, 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, @@ -27,7 +27,7 @@ public enum CustomItemList implements IItemContainer { eM_in_UV, eM_in_UHV, eM_in_UEV, eM_in_UIV, eM_in_UMV, eM_in_UXV, eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV, eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV, - Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, + Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, eM_Casing, eM_Field, eM_Field_Casing, eM_Coil, eM_Tele, eM_TimeSpaceWarp, debugBlock, Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java new file mode 100644 index 0000000000..ea4c7f0e2b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java @@ -0,0 +1,152 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.thing.metaTileEntity.pipe.iConnectsToDataPipe; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +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.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +import static com.github.technus.tectech.elementalMatter.commonValues.moveAt; +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +/** + * Created by danie_000 on 11.12.2016. + */ +public abstract class GT_MetaTileEntity_Hatch_DataConnector extends GT_MetaTileEntity_Hatch implements iConnectsToDataPipe, machineTT { + private static Textures.BlockIcons.CustomIcon EM_D_SIDES; + private static Textures.BlockIcons.CustomIcon EM_D_ACTIVE; + private static Textures.BlockIcons.CustomIcon EM_D_CONN; + + public short id = -1; + public int data = 0; + public byte timeout=3; + + public GT_MetaTileEntity_Hatch_DataConnector(int aID, String aName, String aNameRegional, int aTier, String descr) { + super(aID, aName, aNameRegional, aTier, 0, descr); + } + + public GT_MetaTileEntity_Hatch_DataConnector(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + EM_D_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_D_ACTIVE"); + EM_D_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_D_SIDES"); + EM_D_CONN = new Textures.BlockIcons.CustomIcon("iconsets/EM_DATA_CONN"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_D_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(EM_D_CONN)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_D_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(EM_D_CONN)}; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setShort("eID", id); + aNBT.setInteger("eDATA",data); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + id = aNBT.getShort("eID"); + data=aNBT.getInteger("eDATA"); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (moveAt == aTick % 20) { + if(timeout>0) timeout--; + else data=0; + moveAround(aBaseMetaTileEntity); + getBaseMetaTileEntity().setActive(data>0); + } + } + } + + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + if (id > 0) return new String[]{ + "ID: "+ EnumChatFormatting.AQUA +id, + "Computation: "+ EnumChatFormatting.AQUA +data + }; + return new String[]{"Computation: "+ EnumChatFormatting.AQUA +data}; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + "High speed fibre optics connector.", + EnumChatFormatting.AQUA + "Must be painted to work" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 6fd6eaa403..212d14586e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity; +package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; @@ -6,7 +6,6 @@ import com.github.technus.tectech.elementalMatter.classes.tElementalException; import com.github.technus.tectech.elementalMatter.commonValues; import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; import com.github.technus.tectech.thing.machineTT; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_MufflerElemental; import com.github.technus.tectech.thing.metaTileEntity.pipe.iConnectsToEMpipe; import gregtech.api.enums.Dyes; import gregtech.api.enums.Textures; @@ -32,6 +31,7 @@ import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Mult public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, iConnectsToEMpipe, machineTT { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; + private static Textures.BlockIcons.CustomIcon EM_T_CONN; protected cElementalInstanceStackTree content = new cElementalInstanceStackTree(); //float lifeTimeMult=1f; @@ -53,16 +53,17 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta super.registerIcons(aBlockIconRegister); EM_T_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_ACTIVE"); EM_T_SIDES = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_EM_T_SIDES"); + EM_T_CONN = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE_CONN"); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(EM_T_CONN)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(EM_T_CONN)}; } @Override @@ -102,12 +103,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (overflowMatter <= 0) { deathDelay = 3; } else { - if (deathDelay == 2) { - if (TecTech.ModConfig.BOOM_ENABLE && TecTech.Rnd.nextInt(10) == 0) - aBaseMetaTileEntity.setOnFire(); - else - TecTech.proxy.broadcast("Container0 FIRE! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } else if (deathDelay == 1) { + if (deathDelay == 1) { IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); @@ -116,16 +112,18 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (tGTTileEntity != null && (tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) { GT_MetaTileEntity_Hatch_MufflerElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_MufflerElemental) tGTTileEntity.getMetaTileEntity(); aMetaTileEntity.overflowMatter += overflowMatter; + overflowMatter = 0F; + deathDelay=3;//needed in some cases like repetitive failures. Should be 4 since there is -- at end but meh... if (aMetaTileEntity.overflowMatter > aMetaTileEntity.overflowMax) { if (TecTech.ModConfig.BOOM_ENABLE) tGTTileEntity.doExplosion(V[14]); else TecTech.proxy.broadcast("Container1 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } else overflowMatter = 0F; + } } } else if (deathDelay < 1) { if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[14]); else - TecTech.proxy.broadcast("Container2 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + TecTech.proxy.broadcast("Container0 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); } deathDelay--; } @@ -136,8 +134,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } } - public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { - } + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) {} @Override public cElementalInstanceStackTree getContainerHandler() { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java new file mode 100644 index 0000000000..121f91b76a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_InputData extends GT_MetaTileEntity_Hatch_DataConnector { + public GT_MetaTileEntity_Hatch_InputData(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Data Input for Multiblocks"); + } + + public GT_MetaTileEntity_Hatch_InputData(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_InputData(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return false; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean canConnect(byte side) { + return isInputFacing(side); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java index 4cb7f22284..c0b825d12b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_Hatch_ElementalContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java new file mode 100644 index 0000000000..5bab844128 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java @@ -0,0 +1,71 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; +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.util.GT_Utility; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_OutputData extends GT_MetaTileEntity_Hatch_DataConnector { + public GT_MetaTileEntity_Hatch_OutputData(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Data Output for Multiblocks"); + } + + public GT_MetaTileEntity_Hatch_OutputData(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_OutputData(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return false; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean canConnect(byte side) { + return isInputFacing(side); + } + + @Override + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) {//TODO + byte color = getBaseMetaTileEntity().getColorization(); + if (color < 0) return; + byte front = aBaseMetaTileEntity.getFrontFacing(); + byte opposite = GT_Utility.getOppositeSide(getBaseMetaTileEntity().getFrontFacing()); + for (byte dist = 1; dist < 16; dist++) { + IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSideAndDistance(front, dist); + if (tGTTileEntity != null && tGTTileEntity.getColorization() == color) { + IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); + if (aMetaTileEntity != null) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputData && + opposite == aMetaTileEntity.getBaseMetaTileEntity().getFrontFacing()) { + return; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Pipe_Data) { + if (((GT_MetaTileEntity_Pipe_Data) aMetaTileEntity).connectionCount > 2) return; + } else return; + } else return; + } else return; + } + //trace optics all the way to the end, no branching splitting etc. + //Coloring requirement! + //set data to match this and timout to 3 + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java index c8e65b6451..221e00e514 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_Hatch_ElementalContainer; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index f139972dd0..1bbcb939e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -3,7 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index ca83d78e39..918c2041d6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; 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 224cd38926..822b7aed1c 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 @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; 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 index 52774a7d29..ea354a38d8 100644 --- 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 @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 5b4405ce4f..38f6e9e4a8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -3,7 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.item.ItemStack; 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 7cd9c590f3..984a2c2a67 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 @@ -3,14 +3,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; @@ -39,10 +36,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + minRepairStatus=(byte) getIdealStatus(); } public GT_MetaTileEntity_EM_infuser(String aName) { super(aName); + minRepairStatus=(byte) getIdealStatus(); } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { @@ -82,11 +81,9 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public boolean EM_checkRecipe(ItemStack itemStack) { - if (getBaseMetaTileEntity().isAllowedToWork() && getRepairStatus()==getIdealStatus() && itemStack!=null && itemStack.stackSize==1) { + if (getBaseMetaTileEntity().isAllowedToWork() && itemStack!=null && itemStack.stackSize==1) { Item ofThis=itemStack.getItem(); - if(itemStack.getItem() instanceof ISpecialElectricItem){ - doChargeItemStackSpecial((ISpecialElectricItem) ofThis,itemStack); - }else if(itemStack.getItem() instanceof IElectricItem){ + if(itemStack.getItem() instanceof IElectricItem){ doChargeItemStack((IElectricItem) ofThis,itemStack); }else if(TecTech.hasCOFH && itemStack.getItem() instanceof IEnergyContainerItem){ doChargeItemStackRF((IEnergyContainerItem) ofThis,itemStack); @@ -100,7 +97,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa eDismatleBoom=false; } eAmpereFlow = 0; - mEUt = 0; return ePowerPass; } @@ -132,24 +128,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } } - private void doChargeItemStackSpecial(ISpecialElectricItem item, ItemStack stack ) - { - try { - final IElectricItemManager manager=item.getManager(stack); - double euDiff=item.getMaxCharge(stack) - manager.getCharge(stack); - if(euDiff>0)this.setEUVar(this.getEUVar()-this.getEUVar()>>5); - this.setEUVar( - this.getEUVar()-(long)Math.ceil( - manager.charge(stack, - Math.min(euDiff,this.getEUVar()) - ,item.getTier(stack),true,false) - )); - } catch( Exception e ) { - if(TecTech.ModConfig.DEBUG_MODE) - e.printStackTrace(); - } - } - private void doChargeItemStackRF(IEnergyContainerItem item, ItemStack stack ) { try { 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 d4d00f5195..46ad5f74f2 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 @@ -3,7 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java index d20cdfc671..98a67f5c2d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 15535e8a20..706a8b7958 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -11,7 +11,6 @@ import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; 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 e20ff2d0bf..daa0894539 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,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index f108020e0e..52cc4abcb2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; 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 d7865f1e53..8c06ceb7e6 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 @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 843e8edbfc..f332a65de4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,7 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index dcb4a7a6fc..9fdd922c83 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity; +package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; @@ -56,12 +56,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public ArrayList<GT_MetaTileEntity_Hatch_Uncertainty> eUncertainHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_EnergyMulti> eEnergyMulti = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_DynamoMulti> eDynamoMulti = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_InputData> eInputData = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_OutputData> eOutputData = new ArrayList<>(); public final float[] eParamsIn = new float[20]; public final float[] eParamsOut = new float[20]; public final byte[] eParamsInStatus = new byte[20]; public final byte[] eParamsOutStatus = new byte[20]; - protected final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6; + public final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6; //TO ENABLE this change value in <init> to false and/or other than 0, can also be added in recipe check or whatever public boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismatleBoom = false; @@ -70,10 +72,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private long eMaxAmpereFlow = 0; private long maxEUinputMin = 0, maxEUinputMax = 0; public long eAmpereFlow = 1; + public long eRequiredData = 0; + protected long eAvailableData=0; //init param states in constructor, or implement it in checkrecipe/outputfunction - //METHODS TO OVERRIDE - this 3 below + checkMachine + //METHODS TO OVERRIDE //if you want to add checks that run periodically when machine works then make onRunningTick better //if you want to add checks that run periodically when machine is built then use check params @@ -81,17 +85,19 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public boolean EM_checkRecipe(ItemStack itemStack) { return false; } - //My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! + // My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! + // Set mEUt, Efficiencies, required computation, time, check input etc. - public void EM_checkParams() { - } - //update status of parameters in guis and "machine state" + public void EM_checkParams() {} + // update status of parameters in guis and "machine state" + // Called before check recipe, before outputting, and every second the machine is active - public void EM_outputFunction() { - } + public void EM_outputFunction() {} // based on "machine state" do output, - // this must move to output EM things and can also modify output items/fluids/EM, remaining EM is NOT overflowed. - //(Well it can be overflowed if machine didn't finished, soft-hammered/disabled/not enough EU) + // this must move to outputEM to EM output hatches + // and can also modify output items/fluids/EM, remaining EM is NOT overflowed. + // (Well it can be overflowed if machine didn't finished, soft-hammered/disabled/not enough EU) + // Setting available data processing //RATHER LEAVE ALONE Section @@ -146,6 +152,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setLong("eMaxEUmax", maxEUinputMax); aNBT.setLong("eRating", eAmpereFlow); aNBT.setLong("eMaxA", eMaxAmpereFlow); + aNBT.setLong("eDataR", eRequiredData); + aNBT.setLong("eDataA", eAvailableData); aNBT.setByte("eCertainM", eCertainMode); aNBT.setByte("eCertainS", eCertainStatus); aNBT.setByte("eMinRepair", minRepairStatus); @@ -194,6 +202,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt maxEUinputMax = aNBT.getLong("eMaxEUmax"); eAmpereFlow = aNBT.getLong("eRating"); eMaxAmpereFlow = aNBT.getLong("eMaxA"); + eRequiredData = aNBT.getLong("eDataR"); + eAvailableData = aNBT.getLong("eDataA"); eCertainMode = aNBT.getByte("eCertainM"); eCertainStatus = aNBT.getByte("eCertainS"); minRepairStatus = aNBT.getByte("eMinRepair"); @@ -284,6 +294,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; + + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) + if (isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) + if (isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) @@ -318,6 +334,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) + if (isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) + if (isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; + if (mEnergyHatches.size() > 0 || eEnergyMulti.size() > 0) { maxEUinputMin = V[15]; maxEUinputMax = V[0]; @@ -423,7 +446,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (getRepairStatus() >= minRepairStatus) {//S if (multiCheckAt == Tick) - paramsUpdate(); + hatchesStatusUpdate(); if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start if (onRunningTick(mInventory[1])) {//Compute EU @@ -431,7 +454,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt stopMachine(); if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && recipeAt == Tick) {//progress increase and done - paramsUpdate(); + hatchesStatusUpdate(); EM_outputFunction(); if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) @@ -455,7 +478,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); } updateSlots(); - } + }else hatchesStatusUpdate(); } } } else { @@ -465,7 +488,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); } updateSlots(); - } + }else hatchesStatusUpdate(); } } @@ -550,8 +573,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return super.getRepairStatus() + ((eCertainStatus == 0) ? 1 : 0) + (this.eParameters ? 1 : 0); } + private long getAvailableData() { + long result=0; + for(GT_MetaTileEntity_Hatch_InputData in:eInputData) + result+=in.data; + return result; + } + @Override public boolean onRunningTick(ItemStack aStack) { + if(eRequiredData>eAvailableData) return false; if (this.mEUt > 0) { this.EMaddEnergyOutput((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); return true; @@ -700,6 +731,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiencyIncrease = 0; getBaseMetaTileEntity().disableWorking(); + for(GT_MetaTileEntity_Hatch_OutputData data:eOutputData) + data.timeout = 0; + float mass = 0; if (outputEM == null) return; for (cElementalInstanceStackTree tree : outputEM) @@ -765,11 +799,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final boolean checkRecipe(ItemStack itemStack) {//do recipe checks, based on "machine content and state" - paramsUpdate(); + hatchesStatusUpdate(); return EM_checkRecipe(itemStack); } - private void paramsUpdate() { + private void hatchesStatusUpdate() { for (GT_MetaTileEntity_Hatch_Param param : eParamHatches) { int paramID = param.param; if (paramID < 0) continue; @@ -779,9 +813,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt param.input2f = eParamsOut[paramID + 10]; } EM_checkParams(); - for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) { + + eAvailableData=getAvailableData(); + for(GT_MetaTileEntity_Hatch_OutputData data:eOutputData) + data.timeout=3; + + for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) eCertainStatus = uncertainty.update(eCertainMode); - } } @Override @@ -824,6 +862,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (MetaTileEntity tTileEntity : eEnergyMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); for (MetaTileEntity tTileEntity : eUncertainHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); for (MetaTileEntity tTileEntity : eDynamoMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : eInputData) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : eOutputData) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); getBaseMetaTileEntity().doExplosion(V[15]); } @@ -862,6 +902,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputData) + return eInputData.add((GT_MetaTileEntity_Hatch_InputData) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputData) + return eOutputData.add((GT_MetaTileEntity_Hatch_OutputData) aMetaTileEntity); return false; } @@ -1101,6 +1145,22 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return false; } + //NEW METHOD + public final boolean addDataConnectorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputData) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eInputData.add((GT_MetaTileEntity_Hatch_InputData) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputData) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eOutputData.add((GT_MetaTileEntity_Hatch_OutputData) aMetaTileEntity); + } + return false; + } + @Override public String[] getInfoData() {//TODO Do it long storedEnergy = 0; @@ -1133,7 +1193,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, + "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET +" TFLOPS / "+EnumChatFormatting.YELLOW+eRequiredData+EnumChatFormatting.RESET+" TFLOPS" }; } @@ -1233,6 +1294,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt hatch_elemental.id = -1; for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) hatch_elemental.id = -1; + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + hatch_data.timeout=0; + hatch_data.id = -1; + } + for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) + hatch_data.id = -1; for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) hatch.getBaseMetaTileEntity().setActive(false); for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) @@ -1347,64 +1414,4 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return true; } - - /** - * finds a Recipe matching the aFluid and ItemStack Inputs. - * - * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs - * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param aFluids the Fluid Inputs - * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. - * @param aInputs the Item Inputs - * @return the Recipe it has found or null for no matching Recipe - */ - - //protected static GT_Recipe findRecipe(boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - // // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. - // // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. - // if (GregTech_API.sPostloadFinished) { - // if (mMinimalInputFluids > 0) { - // if (aFluids == null) return null; - // int tAmount = 0; - // for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; - // if (tAmount < mMinimalInputFluids) return null; - // } - // if (mMinimalInputItems > 0) { - // if (aInputs == null) return null; - // int tAmount = 0; - // for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - // if (tAmount < mMinimalInputItems) return null; - // } - // } - // // Unification happens here in case the Input isn't already unificated. - // if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); - // // Check the Recipe which has been used last time in order to not have to search for it again, if possible. - // if (aRecipe != null) - // if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; - // // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - // if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - // if (tStack != null) { - // Collection<GT_Recipe> - // tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // } - // // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - // if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - // if (aFluid != null) { - // Collection<GT_Recipe> - // tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // } - // // And nothing has been found. - // return null; - //} } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java index 3b3245e3a3..25ad29c33c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.gui; -import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java new file mode 100644 index 0000000000..bef132bab5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -0,0 +1,161 @@ +package com.github.technus.tectech.thing.metaTileEntity.pipe; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.machineTT; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IColoredTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +/** + * Created by Tec on 26.02.2017. + */ +public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements iConnectsToDataPipe, machineTT { + private static Textures.BlockIcons.CustomIcon EMpipe; + private static Textures.BlockIcons.CustomIcon EMcandy; + public byte connectionCount = 0; + + public GT_MetaTileEntity_Pipe_Data(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, 0); + } + + public GT_MetaTileEntity_Pipe_Data(String aName) { + super(aName, 0); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_MetaTileEntity_Pipe_Data(mName); + } + + @Override + public float getThickNess() { + return 0.375F; + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_DATA"); + EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_BAR"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[]{new GT_RenderedTexture(EMpipe), new GT_RenderedTexture(EMcandy, Dyes.getModulation(aColorIndex, MACHINE_METAL.getRGBA()))}; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + return false; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + return false; + } + + @Override + public void loadNBTData(NBTTagCompound nbtTagCompound) { + } + + @Override + public void saveNBTData(NBTTagCompound nbtTagCompound) { + } + + @Override + public boolean renderInside(byte b) { + return false; + } + + @Override + public byte getTileEntityBaseType() { + return 4; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Advanced data transmission", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Don't stare at the beam!", + EnumChatFormatting.AQUA + "Must be painted to work", + EnumChatFormatting.AQUA + "Do not cross,split or turn" + }; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); + } + + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + onPostTick(aBaseMetaTileEntity,31); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if ((aTick & 31) == 31) { + byte mOld = 0; + mConnections = 0; + connectionCount = 0; + if (aBaseMetaTileEntity.getColorization() < 0) return; + for (byte i = 0, j; i < 6; i++) { + j = GT_Utility.getOppositeSide(i); + //if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { + TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); + if (tTileEntity instanceof IColoredTileEntity) { + //if (aBaseMetaTileEntity.getColorization() >= 0) { + byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); + if (tColor != aBaseMetaTileEntity.getColorization()) continue; + //} + } + if (tTileEntity instanceof iConnectsToDataPipe && (((iConnectsToDataPipe) tTileEntity).canConnect(j))) { + mConnections |= (1 << i); + connectionCount++; + } + else if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToDataPipe) { + if (//((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || + ((iConnectsToDataPipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { + mConnections |= (1 << i); + connectionCount++; + } + } + //} + //else { + // mConnections |= (1 << i); + // if (mOld != mConnections) { + // connectionCount++; + // mOld = mConnections; + // } + //} + } + } + + } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + } + + @Override + public boolean canConnect(byte side) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java index 9a3a86163e..f457de8e0d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -90,7 +90,6 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec @Override public String[] getDescription() { - String tecMark; return new String[]{ commonValues.tecMark, "Quantum tunneling device.", @@ -106,16 +105,20 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec } @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + onPostTick(aBaseMetaTileEntity,31); + } + + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if ((aTick & 31) == 0) { - byte mOld = 0; + if ((aTick & 31) == 31) { mConnections = 0; connectionCount = 0; if (aBaseMetaTileEntity.getColorization() < 0) return; for (byte i = 0, j; i < 6; i++) { j = GT_Utility.getOppositeSide(i); - if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { + //if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if (tTileEntity instanceof IColoredTileEntity) { //if (aBaseMetaTileEntity.getColorization() >= 0) { @@ -125,30 +128,23 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec } if (tTileEntity instanceof iConnectsToEMpipe && (((iConnectsToEMpipe) tTileEntity).canConnect(j))) { mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } - continue; + connectionCount++; } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { - if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || + else if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { + if (//((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((iConnectsToEMpipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } + connectionCount++; } } - } else { - mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } - } - + //} + //else { + // mConnections |= (1 << i); + // if (mOld != mConnections) { + // connectionCount++; + // mOld = mConnections; + // } + //} } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToDataPipe.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToDataPipe.java new file mode 100644 index 0000000000..f78799e8c9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToDataPipe.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.pipe; + +/** + * Created by Tec on 26.02.2017. + */ +public interface iConnectsToDataPipe { + boolean canConnect(byte side); +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BAR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BAR.png Binary files differnew file mode 100644 index 0000000000..b555f62ec8 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_BAR.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA.png Binary files differnew file mode 100644 index 0000000000..c3b889dc79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA_CONN.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA_CONN.png Binary files differnew file mode 100644 index 0000000000..222b9329ea --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_DATA_CONN.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE_CONN.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE_CONN.png Binary files differnew file mode 100644 index 0000000000..8754166137 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_PIPE_CONN.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png Binary files differnew file mode 100644 index 0000000000..abfcf2b8f0 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..60af678259 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":4 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png Binary files differnew file mode 100644 index 0000000000..b50c1b7707 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png.mcmeta new file mode 100644 index 0000000000..97596ba817 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_EM_D_SIDES.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file |