From 7095b1d12cd9cb58086d3ea1ec352bb1f01cc557 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 24 Dec 2017 07:43:10 +0100 Subject: Backbone of EM machine --- .../dreamcraft/DreamCraftRecipeLoader.java | 6 + .../definitions/dComplexAspectDefinition.java | 2 +- .../core/templates/cElementalPrimitive.java | 2 +- .../definitions/complex/atom/dAtomDefinition.java | 2 +- .../complex/hadron/dHadronDefinition.java | 2 +- .../technus/tectech/loader/BloodyRecipeLoader.java | 6 + .../technus/tectech/loader/MachineLoader.java | 13 +- .../technus/tectech/loader/RecipeLoader.java | 2 + .../technus/tectech/recipe/TT_recipeAdder.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../GT_MetaTileEntity_Hatch_MufflerElemental.java | 229 -------------------- .../GT_MetaTileEntity_Hatch_OverflowElemental.java | 232 +++++++++++++++++++++ .../multi/GT_MetaTileEntity_EM_machine.java | 143 ------------- .../multi/GT_MetaTileEntity_EM_research.java | 2 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 2 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 85 ++++---- .../multi/base/MultiblockControl.java | 24 ++- .../multi/em_machine/Behaviour_Centrifuge.java | 24 +++ .../multi/em_machine/Behaviour_Electrolyzer.java | 24 +++ .../Behaviour_ElectromagneticSeparator.java | 24 +++ .../multi/em_machine/Behaviour_Mixer.java | 24 +++ .../multi/em_machine/Behaviour_PrecisionLaser.java | 24 +++ .../multi/em_machine/Behaviour_Recycler.java | 24 +++ .../em_machine/GT_MetaTileEntity_EM_machine.java | 179 ++++++++++++++++ 24 files changed, 648 insertions(+), 437 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Mixer.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 7bf0b43cb6..78eb0746c3 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -407,5 +407,11 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), }, CustomItemList.Machine_Multi_Infuser.get(1), 8000, 2000000); //endregion + + register_machine_EM_behaviours(); + } + + private void register_machine_EM_behaviours(){ + } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java index 31158572a8..3084abb1f2 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java @@ -242,7 +242,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme //lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) - lines.add("CHARGE = "+getCharge()/3f+" eV"); + lines.add("CHARGE = "+getCharge()/3f+" e"); if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) lines.add(getColor()<0?"COLORLESS":"CARRIES COLOR"); if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java index d0b99dba1d..724181e4f7 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java @@ -187,7 +187,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) - lines.add("CHARGE = "+getCharge()/3f+" eV"); + lines.add("CHARGE = "+getCharge()/3f+" e"); if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) lines.add(getColor()<0?"COLORLESS":"CARRIES COLOR"); if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java index a54986073c..6b929d66ce 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java @@ -1424,7 +1424,7 @@ public final class dAtomDefinition extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) - lines.add("CHARGE = "+getCharge()/3f+" eV"); + lines.add("CHARGE = "+getCharge()/3f+" e"); if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) lines.add(getColor()<0?"COLORLESS":"CARRIES COLOR"); if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java index 55c2e7ccf9..8c7f8deb30 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java @@ -403,7 +403,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) - lines.add("CHARGE = "+getCharge()/3f+" eV"); + lines.add("CHARGE = "+getCharge()/3f+" e"); if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) lines.add(getColor()<0?"COLORLESS":"CARRIES COLOR"); if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) diff --git a/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java index 52c584d788..37e7cc41df 100644 --- a/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java @@ -355,5 +355,11 @@ public class BloodyRecipeLoader implements Runnable { Materials.Osmiridium.getMolten(1296), }, CustomItemList.Machine_Multi_Scanner.get(1), 24000, 500000); //endregion + + register_machine_EM_behaviours(); + } + + private void register_machine_EM_behaviours(){ + } } 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 ef77bb2111..787096e6b6 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPowerGenerator; @@ -65,22 +66,22 @@ public class MachineLoader implements Runnable { // eM Waste OUT // =================================================================================================== - eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); - eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); - eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); - eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); - eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); - eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); // =================================================================================================== 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 1723506d6f..360604e7b8 100644 --- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java @@ -34,5 +34,7 @@ public class RecipeLoader implements Runnable { if (Loader.isModLoaded("dreamcraft")) new DreamCraftRecipeLoader().run();//init recipes for GTNH version else new BloodyRecipeLoader().run();//init recipes for NON-GTNH version + + } } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 6324854082..629cc28dec 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -6,7 +6,7 @@ import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefiniti import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_Recipe; import gregtech.common.GT_RecipeAdder; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 7faa067177..ec580f3668 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -116,12 +116,12 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } else { if (deathDelay == 1) { IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); - if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) + if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); - if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) + if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 1); - if (tGTTileEntity != null && (tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) { - GT_MetaTileEntity_Hatch_MufflerElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_MufflerElemental) tGTTileEntity.getMetaTileEntity(); + if (tGTTileEntity != null && (tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) { + GT_MetaTileEntity_Hatch_OverflowElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_OverflowElemental) tGTTileEntity.getMetaTileEntity(); if (aMetaTileEntity.addOverflowMatter(overflowMatter)) { if (TecTech.ModConfig.BOOM_ENABLE) tGTTileEntity.doExplosion(V[14]); else diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java deleted file mode 100644 index 2d1400ecf4..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -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.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.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.EnumSkyBlock; -import net.minecraftforge.common.util.ForgeDirection; - -import static com.github.technus.tectech.CommonValues.DISPERSE_AT; -import static com.github.technus.tectech.Util.V; -import static com.github.technus.tectech.loader.MainLoader.elementalPollution; -import static gregtech.api.enums.Dyes.MACHINE_METAL; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; - -/** - * Created by danie_000 on 12.12.2016. - */ -public class GT_MetaTileEntity_Hatch_MufflerElemental extends GT_MetaTileEntity_Hatch { - private static Textures.BlockIcons.CustomIcon EM_T_SIDES; - private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; - private static Textures.BlockIcons.CustomIcon MufflerEM; - private static Textures.BlockIcons.CustomIcon MufflerEMidle; - private float overflowMatter = 0f; - public final float overflowMax; - private final float overflowDisperse; - private final int eTier; - - public GT_MetaTileEntity_Hatch_MufflerElemental(int aID, String aName, String aNameRegional, int aTier, float max) { - super(aID, aName, aNameRegional, aTier, 0, "Disposes excess elemental Matter"); - overflowMatter = max / 2; - overflowMax = max; - overflowDisperse = overflowMax / (float) (30 - aTier); - eTier=aTier; - } - - //public GT_MetaTileEntity_Hatch_MufflerElemental(String aName, int aTier, float max, String aDescription, ITexture[][][] aTextures) { - // super(aName, aTier, 0, aDescription, aTextures); - // overflowMatter = max / 2; - // overflowMax = max; - // overflowDisperse = overflowMax / (float) (30 - aTier); - // eTier=aTier; - //} - - public GT_MetaTileEntity_Hatch_MufflerElemental(String aName, int aTier, int eTier, float max, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - overflowMatter = max / 2; - overflowMax = max; - overflowDisperse = overflowMax / (float) (30 - aTier); - this.eTier=eTier; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - 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"); - MufflerEM = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM"); - MufflerEMidle = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM_IDLE"); - } - - @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(MufflerEM)}; - } - - @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(MufflerEMidle)}; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - mDescription, - "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", - "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", - "DO NOT OBSTRUCT THE OUTPUT!" - }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_MufflerElemental(mName, mTier, eTier, overflowMax, mDescription, mTextures); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setFloat("overflowMatter", overflowMatter); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - overflowMatter = aNBT.getFloat("overflowMatter"); - } - - @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 void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && (aTick % 20) == DISPERSE_AT) { - if (aBaseMetaTileEntity.isActive()) { - overflowMatter -= overflowDisperse; - if (overflowMatter < 0) { - overflowMatter = 0; - aBaseMetaTileEntity.setActive(false); - aBaseMetaTileEntity.setLightValue((byte) 0); - aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); - } - vapePollution(aBaseMetaTileEntity); - } else { - if (overflowMatter > 0) { - aBaseMetaTileEntity.setActive(true); - aBaseMetaTileEntity.setLightValue((byte) 15); - aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); - } - } - } else if (aBaseMetaTileEntity.isClientSide() && getBaseMetaTileEntity().isActive()) { - TecTech.proxy.em_particle(getBaseMetaTileEntity(), getBaseMetaTileEntity().getFrontFacing()); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - //DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) - } - - private void vapePollution(IGregTechTileEntity mte){ - float xPos=mte.getXCoord()+0.5f; - float yPos=mte.getYCoord()+0.5f; - float zPos=mte.getZCoord()+0.5f; - - int xDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetX; - int yDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetY; - int zDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetZ; - - AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(xPos-.5+xDirShift,yPos-.5+yDirShift,zPos-.5+zDirShift,xPos+.5+xDirShift,yPos+1.5+yDirShift,zPos+.5+zDirShift); - for (Object entity : mte.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, aabb)) { - float damagingFactor = (float)Math.log(overflowDisperse); - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.confusion.id,1,(int)(damagingFactor*20))); - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id,2,(int)(damagingFactor*15))); - ((EntityLivingBase) entity).attackEntityFrom(elementalPollution, damagingFactor); - } - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[]{ - "Contained mass:", - EnumChatFormatting.RED + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", - "Mass Disposal speed: " + EnumChatFormatting.BLUE + Double.toString(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" - }; - } - - @Override - public void onRemoval() { - if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) - if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[15]); - else - TecTech.proxy.broadcast("Muffler BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } - - //Return - Should Explode - public boolean addOverflowMatter(float matter){ - overflowMatter+=matter; - return overflowMatter > overflowMax; - } - - public float getOverflowMatter() { - return overflowMatter; - } - - //Return - Should Explode - public boolean setOverflowMatter(float overflowMatter) { - this.overflowMatter = overflowMatter; - return overflowMatter > overflowMax; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java new file mode 100644 index 0000000000..d468474d2f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -0,0 +1,232 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.TecTech; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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.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.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.EnumSkyBlock; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.CommonValues.DISPERSE_AT; +import static com.github.technus.tectech.Util.V; +import static com.github.technus.tectech.loader.MainLoader.elementalPollution; +import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; + +/** + * Created by danie_000 on 12.12.2016. + */ +public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity_Hatch { + private static Textures.BlockIcons.CustomIcon EM_T_SIDES; + private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; + private static Textures.BlockIcons.CustomIcon MufflerEM; + private static Textures.BlockIcons.CustomIcon MufflerEMidle; + private float overflowMatter = 0f; + public final float overflowMax; + private final float overflowDisperse; + private final int eTier; + + public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, float max) { + super(aID, aName, aNameRegional, aTier, 0, "Disposes excess elemental Matter"); + overflowMatter = max / 2; + overflowMax = max; + overflowDisperse = overflowMax / (float) (30 - aTier); + eTier=aTier; + } + + //public GT_MetaTileEntity_Hatch_MufflerElemental(String aName, int aTier, float max, String aDescription, ITexture[][][] aTextures) { + // super(aName, aTier, 0, aDescription, aTextures); + // overflowMatter = max / 2; + // overflowMax = max; + // overflowDisperse = overflowMax / (float) (30 - aTier); + // eTier=aTier; + //} + + public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, int eTier, float max, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + overflowMatter = max / 2; + overflowMax = max; + overflowDisperse = overflowMax / (float) (30 - aTier); + this.eTier=eTier; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + 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"); + MufflerEM = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM"); + MufflerEMidle = new Textures.BlockIcons.CustomIcon("iconsets/MUFFLER_EM_IDLE"); + } + + @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(MufflerEM)}; + } + + @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(MufflerEMidle)}; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + mDescription, + "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", + "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", + "DO NOT OBSTRUCT THE OUTPUT!" + }; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_OverflowElemental(mName, mTier, eTier, overflowMax, mDescription, mTextures); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setFloat("overflowMatter", overflowMatter); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + overflowMatter = aNBT.getFloat("overflowMatter"); + } + + @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 void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && (aTick % 20) == DISPERSE_AT) { + if (aBaseMetaTileEntity.isActive()) { + if (overflowMatter > overflowDisperse) { + //todo add full dose of dispersed pollution (reduced by tier, or make recycler machine only capable of reduction?) + overflowMatter -= overflowDisperse; + } else { + //todo add partial dose of dispersed pollution (reduced by tier, or make recycler machine only capable of reduction?) + overflowMatter = 0; + aBaseMetaTileEntity.setActive(false); + aBaseMetaTileEntity.setLightValue((byte) 0); + aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); + } + vapePollution(aBaseMetaTileEntity); + } else { + if (overflowMatter > 0) { + aBaseMetaTileEntity.setActive(true); + aBaseMetaTileEntity.setLightValue((byte) 15); + aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); + } + } + } else if (aBaseMetaTileEntity.isClientSide() && getBaseMetaTileEntity().isActive()) { + TecTech.proxy.em_particle(getBaseMetaTileEntity(), getBaseMetaTileEntity().getFrontFacing()); + } + super.onPostTick(aBaseMetaTileEntity, aTick); + //DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) + } + + private void vapePollution(IGregTechTileEntity mte){ + float xPos=mte.getXCoord()+0.5f; + float yPos=mte.getYCoord()+0.5f; + float zPos=mte.getZCoord()+0.5f; + + int xDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetX; + int yDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetY; + int zDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetZ; + + AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(xPos-.5+xDirShift,yPos-.5+yDirShift,zPos-.5+zDirShift,xPos+.5+xDirShift,yPos+1.5+yDirShift,zPos+.5+zDirShift); + for (Object entity : mte.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, aabb)) { + float damagingFactor = (float)Math.log(overflowDisperse); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.confusion.id,1,(int)(damagingFactor*20))); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id,2,(int)(damagingFactor*15))); + ((EntityLivingBase) entity).attackEntityFrom(elementalPollution, damagingFactor); + } + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + return new String[]{ + "Contained mass:", + EnumChatFormatting.RED + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", + EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", + "Mass Disposal speed: " + EnumChatFormatting.BLUE + Double.toString(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + }; + } + + @Override + public void onRemoval() { + if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) + if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[15]); + else + TecTech.proxy.broadcast("Muffler BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + } + + //Return - Should Explode + public boolean addOverflowMatter(float matter){ + overflowMatter+=matter; + return overflowMatter > overflowMax; + } + + public float getOverflowMatter() { + return overflowMatter; + } + + //Return - Should Explode + public boolean setOverflowMatter(float overflowMatter) { + this.overflowMatter = overflowMatter; + return overflowMatter > overflowMax; + } +} 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 deleted file mode 100644 index 68e6c6f4c9..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.common.blocks.GT_Block_Machines; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import java.util.HashMap; - -import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public final static String machine="EM Machinery"; - - //region structure - private static final String[][] shape = new String[][]{ - {"B0","A ","0 - 0","A ","B0",}, - {"A000","00000","00.00","00000","A000",}, - {"A121","1C1","2C2","1C1","A121",}, - {"A131","1C1","3C3","1C1","A131",}, - {"A121","1C1","2C2","1C1","A121",}, - {"A000","00000","00A00","00000","A000",}, - {"B0","A!!!","0!\"!0","A!!!","B0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList", "addElementalInputToMachineList"}; - private static final short[] casingTextures = new short[]{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}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Hatches or Molecular Casing", - "2 - Elemental Input Hatch", - }; - //endregion - - public GT_MetaTileEntity_EM_machine(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_machine(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_machine(this.mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1) - && eInputHatches.size()==1 && iGregTechTileEntity.getBlockAtSideAndDistance(iGregTechTileEntity.getBackFacing(),5) instanceof GT_Block_Machines; - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilder(shape, blockType, blockMeta,2, 2, 1, getBaseMetaTileEntity(),hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Processing quantum matter since...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." - }; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - Behaviour currentBehaviour=map.get(new GT_ItemStack(itemStack)); - if(currentBehaviour==null) return false; - //mux input - double[] parameters=new double[]{getParameterIn(0,0),getParameterIn(0,1),getParameterIn(1,0),getParameterIn(1,1), - getParameterIn(2,0),getParameterIn(2,1),getParameterIn(3,0),getParameterIn(3,1)}; - if(!currentBehaviour.setAndCheckParametersOutAndStatuses(this,parameters))return false; - cElementalInstanceStackMap[] handles=new cElementalInstanceStackMap[3]; - MultiblockControl control=currentBehaviour.process(handles,parameters); - if(control==null) return false; - //update other pare - outputEM=control.getValues(); - mEUt=control.getEUT(); - eAmpereFlow=control.getAmperage(); - mMaxProgresstime=control.getMaxProgressTime(); - eRequiredData=control.getRequiredData(); - mEfficiencyIncrease=control.getEffIncrease(); - return true; - } - - @Override - protected void parametersLoadDefault_EM() {//default 1 to 1 routing table - setParameterPairIn_ClearOut(4,false,1,1);//I - setParameterPairIn_ClearOut(5,false,2,2);//I - setParameterPairIn_ClearOut(6,false,3,3);//I - setParameterPairIn_ClearOut(7,false,1,1);//O - setParameterPairIn_ClearOut(8,false,2,2);//O - setParameterPairIn_ClearOut(9,false,3,3);//O - } - - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - //update routing - } - - @Override - public void outputAfterRecipe_EM() { - //mux output - //output - } - - private static final HashMap map=new HashMap<>(); - public abstract class Behaviour { - public Behaviour(ItemStack... keyItems){ - for(ItemStack is:keyItems){ - map.put(new GT_ItemStack(is.getItem(),1,is.getItemDamage()),this); - } - } - - public abstract boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parameters); - public abstract MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] parameters); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index b82bd55428..bc0db49be4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -36,7 +36,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine.machine; +import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; import static gregtech.api.enums.GT_Values.E; /** diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index 91c638fce9..f54fd46555 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 @@ -36,7 +36,7 @@ import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine.machine; +import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; /** * Created by danie_000 on 17.12.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 22f4179290..b151678e5a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -58,7 +58,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected ArrayList eInputHatches = new ArrayList<>(); protected ArrayList eOutputHatches = new ArrayList<>(); - protected ArrayList eMufflerHatches = new ArrayList<>(); + protected ArrayList eMufflerHatches = new ArrayList<>(); protected ArrayList eParamHatches = new ArrayList<>(); protected ArrayList eUncertainHatches = new ArrayList<>(); protected ArrayList eEnergyMulti = new ArrayList<>(); @@ -158,8 +158,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return 0; } - public int getPollutionPerTick_EM(ItemStack itemStack) { - return 0; + public float getExcessMassPerTick_EM(ItemStack itemStack) { + return 0f; } //helper method so i don't have to set that params to nothing at all times @@ -172,7 +172,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (eMufflerHatches.size() < 1) explodeMultiblock(); else { mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } } @@ -210,7 +210,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (eMufflerHatches.size() < 1) explodeMultiblock(); else { mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } } @@ -472,12 +472,17 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } public final int getParameterInInt(int hatchNo, int paramID){ + if(bParamsAreFloats[hatchNo]) return (int)Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); return iParamsIn[hatchNo+10*paramID]; } - public final float getParameterInFloat(int hatchNo, int paramID){ - return Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); - } + //public final int getParameterInIntRaw(int hatchNo, int paramID){ + // return iParamsIn[hatchNo+10*paramID]; + //} + + //public final float getParameterInFloatRaw(int hatchNo, int paramID){ + // return Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); + //} public final void setParameterOut(int hatchNo, int paramID, double value){ if(bParamsAreFloats[hatchNo]) { @@ -487,32 +492,24 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } - public final boolean setParameterOutInt(int hatchNo, int paramID, int value){ - if(bParamsAreFloats[hatchNo]) return false; - iParamsOut[hatchNo+10*paramID]=value; - return true; - } - - public final boolean setParameterOutFloat(int hatchNo, int paramID, float value){ - if(bParamsAreFloats[hatchNo]) { - iParamsOut[hatchNo + 10 * paramID] = Float.floatToIntBits(value); - return true; - } - return false; - } + //public final boolean setParameterOutInt(int hatchNo, int paramID, int value){ + // if(bParamsAreFloats[hatchNo]) return false; + // iParamsOut[hatchNo+10*paramID]=value; + // return true; + //} - public final byte getStatusOfParameterIn(int hatchNo, int paramID){ - return eParamsInStatus[hatchNo+10*paramID]; - } + //public final boolean setParameterOutFloat(int hatchNo, int paramID, float value){ + // if(bParamsAreFloats[hatchNo]) { + // iParamsOut[hatchNo + 10 * paramID] = Float.floatToIntBits(value); + // return true; + // } + // return false; + //} public final void setStatusOfParameterIn(int hatchNo, int paramID, byte status){ eParamsInStatus[hatchNo+10*paramID]=status; } - public final byte getStatusOfParameterOut(int hatchNo, int paramID){ - return eParamsOutStatus[hatchNo+10*paramID]; - } - public final void setStatusOfParameterOut(int hatchNo, int paramID, byte status){ eParamsOutStatus[hatchNo+10*paramID]=status; } @@ -699,7 +696,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } else if (MOVE_AT == Tick && eSafeVoid) { - for (GT_MetaTileEntity_Hatch_MufflerElemental voider : eMufflerHatches) { + for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { if (voider.overflowMax < voider.getOverflowMatter()) continue; float remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { @@ -773,8 +770,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start if (onRunningTick(mInventory[1])) {//Compute EU + cleanMassEM_EM(getExcessMassPerTick_EM(mInventory[1])); if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) stopMachine(); - if (!polluteEnvironment_EM(getPollutionPerTick_EM(mInventory[1]))) stopMachine(); if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && RECIPE_AT == Tick) {//progress increase and done hatchesStatusUpdate_EM(); @@ -838,10 +835,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } - public boolean polluteEnvironment_EM(int aPollutionLevel) { - return true; //TODO - } - @Deprecated public final int getAmountOfOutputs() { throw new NoSuchMethodError("Deprecated Do not use"); @@ -1126,7 +1119,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mass > 0) { if (eMufflerHatches.size() < 1) explodeMultiblock(); mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } } @@ -1137,7 +1130,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mass > 0) { if (eMufflerHatches.size() < 1) explodeMultiblock(); mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } } @@ -1151,7 +1144,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mass > 0) { if (eMufflerHatches.size() < 1) explodeMultiblock(); mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } } @@ -1165,7 +1158,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mass > 0) { if (eMufflerHatches.size() < 1) explodeMultiblock(); mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) + for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) if (dump.addOverflowMatter(mass)) explodeMultiblock(); } outputEM = null; @@ -1331,8 +1324,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) + return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) @@ -1393,8 +1386,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) + return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); return false; } @@ -1413,9 +1406,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (aTileEntity == null) return false; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); + return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); } return false; } @@ -1429,9 +1422,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); + return eMufflerHatches.add((GT_MetaTileEntity_Hatch_OverflowElemental) aMetaTileEntity); } return false; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java index bc5e1b387b..daa5c7568b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java @@ -5,17 +5,29 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; */ public class MultiblockControl{ - private final int[] controls; + private final int[] controls=new int[7]; private final T[] values; public MultiblockControl(T[] values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime){ this.values = values; - controls=new int[5]; controls[0]=EUt; controls[1]=amperes; controls[2]=requiredData; controls[3]=effIncrease; controls[4]=maxProgressTime; + controls[5]=0; + controls[6]=Float.floatToIntBits(0); + } + + public MultiblockControl(T[] values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, float excessMass){ + this.values = values; + controls[0]=EUt; + controls[1]=amperes; + controls[2]=requiredData; + controls[3]=effIncrease; + controls[4]=maxProgressTime; + controls[5]=pollutionToAdd; + controls[6]=Float.floatToIntBits(excessMass); } public T[] getValues() { @@ -41,4 +53,12 @@ public class MultiblockControl{ public int getMaxProgressTime(){ return controls[4]; } + + public int getPollutionToAdd(){ + return controls[5]; + } + + public float getExcessMass(){ + return Float.intBitsToFloat(controls[6]); + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java new file mode 100644 index 0000000000..91ef19744b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -0,0 +1,24 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; + +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; + +/** + * Created by danie_000 on 24.12.2017. + */ +public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour { + final int tier; + public Behaviour_Centrifuge(int tier){ + this.tier=tier; + } + + @Override + public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parameters) { + return false; + } + + @Override + public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] parameters) { + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java new file mode 100644 index 0000000000..c6b9306b94 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -0,0 +1,24 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; + +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; + +/** + * Created by danie_000 on 24.12.2017. + */ +public class Behaviour_Electrolyzer extends GT_MetaTileEntity_EM_machine.Behaviour { + final int tier; + public Behaviour_Electrolyzer(int tier){ + this.tier=tier; + } + + @Override + public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parameters) { + return false; + } + + @Override + public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] parameters) { + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java new file mode 100644 index 0000000000..7a2ed9ffcf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -0,0 +1,24 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; + +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; + +/** + * Created by danie_000 on 24.12.2017. + */ +public class Behaviour_ElectromagneticSeparator extends GT_MetaTileEntity_EM_machine.Behaviour { + final int tier; + public Behaviour_ElectromagneticSeparator(int tier){ + this.tier=tier; + } + + @Override + public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parameters) { + return false; + } + + @Override + public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] parameters) { + return null; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Mixer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Mixer.java new file mode 100644 index 0000000000..29d9c4a081 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Mixer.java @@ -0,0 +1,24 @@ +package com.github.technus.tecte