From 87d55337181db58328af35601d0d58405b9d591a Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 16 Dec 2017 20:50:23 +0100 Subject: Solidify base class of multiblocks --- .../compatibility/thaumcraft/EssentiaCompat.java | 2 +- .../thaumcraft/EssentiaCompatEnabled.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../technus/tectech/loader/MachineLoader.java | 1 + .../multi/GT_MetaTileEntity_EM_annihilation.java | 1 + .../multi/GT_MetaTileEntity_EM_bhg.java | 1 + .../multi/GT_MetaTileEntity_EM_collider.java | 1 + .../multi/GT_MetaTileEntity_EM_computer.java | 1 + .../multi/GT_MetaTileEntity_EM_crafting.java | 1 + .../multi/GT_MetaTileEntity_EM_decay.java | 1 + .../multi/GT_MetaTileEntity_EM_dequantizer.java | 1 + .../multi/GT_MetaTileEntity_EM_infuser.java | 5 +- .../multi/GT_MetaTileEntity_EM_junction.java | 1 + .../multi/GT_MetaTileEntity_EM_machine.java | 1 + .../multi/GT_MetaTileEntity_EM_quantizer.java | 1 + .../multi/GT_MetaTileEntity_EM_research.java | 1 + .../multi/GT_MetaTileEntity_EM_scanner.java | 1 + .../multi/GT_MetaTileEntity_EM_stabilizer.java | 1 + .../multi/GT_MetaTileEntity_EM_switch.java | 1 + .../multi/GT_MetaTileEntity_EM_transformer.java | 5 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 1 + .../multi/GT_MetaTileEntity_MultiblockBase_EM.java | 1677 -------------------- .../multi/GT_MetaTileEntity_TM_microwave.java | 7 +- .../multi/base/GT_Container_MultiMachineEM.java | 128 ++ .../multi/base/GT_GUIContainer_MultiMachineEM.java | 205 +++ .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 1675 +++++++++++++++++++ .../multi/gui/GT_Container_MultiMachineEM.java | 128 -- .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 205 --- 29 files changed, 2038 insertions(+), 2021 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java index f82c9e5225..fba6f1e6e9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft; import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; /** diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java index d55485dfe0..a66f51ff2d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java @@ -3,7 +3,7 @@ package com.github.technus.tectech.compatibility.thaumcraft; import com.github.technus.tectech.compatibility.thaumcraft.definitions.iElementalAspect; import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 666053ad1f..2162f81ab5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstance import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.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/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index e5bde00836..350b918ba8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -8,7 +8,7 @@ import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstance import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.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/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index ac224ad0b6..ef77bb2111 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; 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.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; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index 53554d7e97..f64e6c84d5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; 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 d059066b37..a4eb61ae65 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,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; 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 08bb0f08e3..2903b99759 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 @@ -5,6 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; 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 01d620db7e..32dbbb8ee4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -9,6 +9,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 8fb3e0df3a..b2942f8c1c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 66ba0d8433..a8473b7525 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMa import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; 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 0b3fdb5523..80e5d4aab2 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 @@ -9,6 +9,7 @@ import com.github.technus.tectech.elementalMatter.core.transformations.aOredictD import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.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_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 573cf8a5be..4115a93910 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 @@ -4,8 +4,9 @@ import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; 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 3d6b11bd79..28dbb61e83 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 @@ -4,6 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.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_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java index 533807984b..3c1986d635 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 @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.blocks.GT_Block_Machines; 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 fac96beee7..4f90191c07 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,6 +11,7 @@ import com.github.technus.tectech.elementalMatter.core.transformations.aOredictQ import com.github.technus.tectech.elementalMatter.core.transformations.bTransformationInfo; 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 gregtech.api.GregTech_API; 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_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index ada50c3094..382ab68609 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 @@ -6,6 +6,7 @@ import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; 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 65b2fbf855..e92753a897 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 @@ -9,6 +9,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.ItemList; 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_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index f59cc75b7c..c75453dc26 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 @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.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_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 6207dfe08a..059b7386ca 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.dataFramework.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.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_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 83a7415d02..4bb1e6de3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -2,8 +2,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; 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_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 518d1946f1..c410bb289c 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 @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java deleted file mode 100644 index a86bbb1a3a..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ /dev/null @@ -1,1677 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.Vec3pos; -import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.core.tElementalException; -import com.github.technus.tectech.thing.metaTileEntity.hatch.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Pollution; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import static com.github.technus.tectech.CommonValues.*; -import static com.github.technus.tectech.Util.*; -import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; - -/** - * Created by danie_000 on 27.10.2016. - */ -public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase { - protected final static Map adderMethodMap = new HashMap<>(); - public static Method adderMethod; - - protected cElementalInstanceStackMap[] outputEM; - - public final static ItemStack[] nothingI = new ItemStack[0]; - public final static FluidStack[] nothingF = new FluidStack[0]; - - protected static Textures.BlockIcons.CustomIcon ScreenOFF; - protected static Textures.BlockIcons.CustomIcon ScreenON; - - public ArrayList eInputHatches = new ArrayList<>(); - public ArrayList eOutputHatches = new ArrayList<>(); - public ArrayList eMufflerHatches = new ArrayList<>(); - public ArrayList eParamHatches = new ArrayList<>(); - public ArrayList eUncertainHatches = new ArrayList<>(); - public ArrayList eEnergyMulti = new ArrayList<>(); - public ArrayList eDynamoMulti = new ArrayList<>(); - public ArrayList eInputData = new ArrayList<>(); - public ArrayList eOutputData = new ArrayList<>(); - - // 0 and 10 are from first parametrizer - // 1 and 11 are from second etc... - - private final int[] iParamsIn = new int[20];//number I from parametrizers - private final int[] iParamsOut = new int[20];//number O to parametrizers - private final boolean[] bParamsAreFloats = new boolean[10]; - - public final byte[] eParamsInStatus = new byte[20];//LED status for I - public final byte[] eParamsOutStatus = new byte[20];//LED status for O - public final static byte STATUS_UNUSED = 0, - STATUS_TOO_LOW = 1, STATUS_LOW = 2, - STATUS_WRONG = 3, STATUS_OK = 4, - STATUS_TOO_HIGH = 5, STATUS_HIGH = 6; - // 0,2,4,6 - ok - // 1,3,5 - nok - - //TO ENABLE this change value in to false and/or other than 0, can also be added in recipe check or whatever - public boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismantleBoom = false; - public byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3; - - protected long eMaxAmpereFlow = 0;//don't modify! unless YOU REALLY HAVE TO - private long maxEUinputMin = 0, maxEUinputMax = 0; - - public long eAmpereFlow = 1; // analogue of EU/t but for amperes used (so eu/t is actually eu*A/t) USE ONLY POSITIVE NUMBERS! - - public long eRequiredData = 0; // data required to operate - protected long eAvailableData = 0; // data being available - - private boolean explodedThisTick=false; - - //init param states in constructor, or implement it in checkrecipe/outputfunction - - //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 - - public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { - return false; - } - // 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 updateParameters_EM(boolean busy) { - } - // update status of parameters in guis and "machine state" - // Called before check recipe, before outputting, and every second the machine is active - - public void outputAfterRecipe_EM() { - } - // based on "machine state" do output, - // 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 - - protected void hatchInit_EM() { - }//For extra types of hatches initiation, LOOK HOW IT IS CALLED! onPostTick - - protected void extraExplosions_EM() { - }//For that extra hatches explosions, and maybe some MOORE EXPLOSIONS - - //machine structure check - protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - //Get Available data, Override only on data producers should return mAvailableData that is set in check recipe - protected long getAvailableData_EM() { - long result = 0; - final Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); - for (GT_MetaTileEntity_Hatch_InputData in : eInputData) - if (in.q != null) result += in.q.computationIfNotContained(pos); - return result; - } - - //Extra hook on cyclic updates (not really needed for machines smaller than 1 chunk) - //BUT NEEDED WHEN - machine blocks are not touching each other ot they don't implement IMachineBlockUpdateable (ex. air) - protected boolean cyclicUpdate_EM() { - return mUpdate <= -1000;//set to false to disable cyclic update - //default is once per 50s; mUpdate is decremented every tick - } - - @Override - public int getPollutionPerTick(ItemStack itemStack) { - return 0; - } - - public int getPollutionPerTick_EM(ItemStack itemStack) { - return 0; - } - - //triggered if machine is not allowed to work after completing a recipe - protected void notAllowedToWork_stopMachine_EM(){ - stopMachine(); - } - - //Override if needed but usually call super method at start! - //On machine stop - NOT called when softhammered to offline state! - it SHOULD cause a full stop like power failure does - @Override - public void stopMachine() { - if (outputEM != null) { - float mass = 0; - for (cElementalInstanceStackMap tree : outputEM) - mass += tree.getMass(); - if (mass > 0) { - if (eMufflerHatches.size() < 1) explodeMultiblock(); - else { - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) - if (dump.addOverflowMatter(mass)) explodeMultiblock(); - } - } - outputEM = null; - } - - for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) - data.q = null; - - mOutputItems = null; - mOutputFluids = null; - mEfficiency = 0; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - getBaseMetaTileEntity().disableWorking(); - hatchesStatusUpdate_EM(); - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_GENERAL, - "Nothing special just override me." - }; - } - - //RATHER LEAVE ALONE Section - protected boolean areChunksAroundLoaded_EM(){ - if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ - IGregTechTileEntity base=getBaseMetaTileEntity(); - return base.getWorld().doChunksNearChunkExist(base.getXCoord(),base.getYCoord(),base.getZCoord(),3); - //todo check if it is actually checking if chunks are loaded - }else return false; - } - - public GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_MultiblockBase_EM(String aName) { - super(aName); - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png"); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CONTROLLER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_CONTROLLER_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; - } - - @Override - public byte getTileEntityBaseType() { - return 3; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - - aNBT.setLong("eMaxEUmin", maxEUinputMin); - 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); - aNBT.setBoolean("eParam", eParameters); - aNBT.setBoolean("ePass", ePowerPass); - aNBT.setBoolean("eVoid", eSafeVoid); - aNBT.setBoolean("eBoom", eDismantleBoom); - aNBT.setBoolean("eOK", mMachine); - - //Ensures compatibility - if (mOutputItems != null) { - aNBT.setInteger("mOutputItemsLength", mOutputItems.length); - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - } - - //Ensures compatibility - if (mOutputFluids != null) { - aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length); - for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - } - - if (outputEM != null) { - aNBT.setInteger("outputStackCount", outputEM.length); - NBTTagCompound output = new NBTTagCompound(); - for (int i = 0; i < outputEM.length; i++) - output.setTag(Integer.toString(i), outputEM[i].toNBT()); - aNBT.setTag("outputEM", output); - } else { - aNBT.setInteger("outputStackCount", 0); - aNBT.removeTag("outputEM"); - } - - NBTTagCompound paramI = new NBTTagCompound(); - for (int i = 0; i < iParamsIn.length; i++) - paramI.setInteger(Integer.toString(i), iParamsIn[i]); - aNBT.setTag("eParamsIn", paramI); - - NBTTagCompound paramO = new NBTTagCompound(); - for (int i = 0; i < iParamsOut.length; i++) - paramO.setInteger(Integer.toString(i), iParamsOut[i]); - aNBT.setTag("eParamsOut", paramO); - - NBTTagCompound paramB = new NBTTagCompound(); - for (int i = 0; i < bParamsAreFloats.length; i++) - paramB.setBoolean(Integer.toString(i), bParamsAreFloats[i]); - aNBT.setTag("eParamsB", paramB); - - NBTTagCompound paramIs = new NBTTagCompound(); - for (int i = 0; i < eParamsInStatus.length; i++) - paramIs.setByte(Integer.toString(i), eParamsInStatus[i]); - aNBT.setTag("eParamsInS", paramIs); - - NBTTagCompound paramOs = new NBTTagCompound(); - for (int i = 0; i < eParamsOutStatus.length; i++) - paramOs.setByte(Integer.toString(i), eParamsOutStatus[i]); - aNBT.setTag("eParamsOutS", paramOs); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - - maxEUinputMin = aNBT.getLong("eMaxEUmin"); - 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"); - eParameters = aNBT.getBoolean("eParam"); - ePowerPass = aNBT.getBoolean("ePass"); - eSafeVoid = aNBT.getBoolean("eVoid"); - eDismantleBoom = aNBT.getBoolean("eBoom"); - mMachine = aNBT.getBoolean("eOK"); - - //Ensures compatibility - int aOutputItemsLength = aNBT.getInteger("mOutputItemsLength"); - if (aOutputItemsLength > 0) { - mOutputItems = new ItemStack[aOutputItemsLength]; - for (int i = 0; i < mOutputItems.length; i++) - mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - } - - //Ensures compatibility - int aOutputFluidsLength = aNBT.getInteger("mOutputFluidsLength"); - if (aOutputFluidsLength > 0) { - mOutputFluids = new FluidStack[aOutputFluidsLength]; - for (int i = 0; i < mOutputFluids.length; i++) - mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - } - - final int outputLen = aNBT.getInteger("outputStackCount"); - if (outputLen > 0) { - outputEM = new cElementalInstanceStackMap[outputLen]; - for (int i = 0; i < outputEM.length; i++) - try { - outputEM[i] = cElementalInstanceStackMap.fromNBT( - aNBT.getCompoundTag("outputEM").getCompoundTag(Integer.toString(i))); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - outputEM[i] = new cElementalInstanceStackMap(); - } - } else outputEM = new cElementalInstanceStackMap[0]; - - NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); - for (int i = 0; i < iParamsIn.length; i++) - iParamsIn[i] = paramI.getInteger(Integer.toString(i)); - - NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); - for (int i = 0; i < iParamsOut.length; i++) - iParamsOut[i] = paramO.getInteger(Integer.toString(i)); - - NBTTagCompound paramB = aNBT.getCompoundTag("eParamsB"); - for (int i = 0; i < bParamsAreFloats.length; i++) - bParamsAreFloats[i] = paramB.getBoolean(Integer.toString(i)); - - NBTTagCompound paramIs = aNBT.getCompoundTag("eParamsInS"); - for (int i = 0; i < eParamsInStatus.length; i++) - eParamsInStatus[i] = paramIs.getByte(Integer.toString(i)); - - NBTTagCompound paramOs = aNBT.getCompoundTag("eParamsOutS"); - for (int i = 0; i < eParamsOutStatus.length; i++) - eParamsOutStatus[i] = paramOs.getByte(Integer.toString(i)); - } - - private boolean cyclicUpdate() { - if (cyclicUpdate_EM()) { - mUpdate = 0; - return true; - } - return false; - } - - //Param methods - public final boolean isParametrizerUsingFloat(int hatchNo){ - return bParamsAreFloats[hatchNo]; - } - - public final double getParameterInSafely(int hatchNo, int paramID){ - return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]):iParamsIn[hatchNo+10*paramID]; - } - - public final int getParameterInInt(int hatchNo, int paramID){ - return iParamsIn[hatchNo+10*paramID]; - } - - public final float getParameterInFloat(int hatchNo, int paramID){ - return Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); - } - - public final void setParameterOutSafely(int hatchNo, int paramID, double value){ - if(bParamsAreFloats[hatchNo]) { - iParamsOut[hatchNo+10*paramID]=Float.floatToIntBits((float) value); - }else{ - iParamsOut[hatchNo+10*paramID]=(int)value; - } - } - - 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 byte getStatusOfParameterIn(int hatchNo, int paramID){ - return eParamsInStatus[hatchNo+10*paramID]; - } - - 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; - } - - @Override - public final boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return checkMachine_EM(iGregTechTileEntity, itemStack); - } - - //can be used to check structures of multi-blocks larger than one chunk, but... - //ALL THE HATCHES AND THE CONTROLLER SHOULD BE IN ONE CHUNK OR IN LOADED CHUNKS - @Deprecated - public final boolean structureCheck_EM( - String[][] structure,//0-9 casing, +- air no air, a-z ignore - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureChecker(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), !mMachine); - } - - public final boolean structureCheck_EM( - String[][] structure,//0-9 casing, +- air no air, a-z ignore - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - String[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerAdvanced(structure, blockType, blockMeta, - adderMethod, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, - horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), !mMachine); - } - - //CAREFUL!!! it calls most of the callbacks - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - explodedThisTick=false; - if (mEfficiency < 0) mEfficiency = 0; - - if (--mUpdate == 0 || --mStartUpCheck == 0 || cyclicUpdate() || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) - 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) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); - - eUncertainHatches.clear(); - eEnergyMulti.clear(); - eInputHatches.clear(); - eOutputHatches.clear(); - eParamHatches.clear(); - eMufflerHatches.clear(); - eDynamoMulti.clear(); - eOutputData.clear(); - eInputData.clear(); - - if ((getBaseMetaTileEntity() instanceof BaseTileEntity)) - ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = mMachine; - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - - if (!mMachine) { - if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) - explodeMultiblock(); - if (outputEM != null) - for (cElementalInstanceStackMap tree : outputEM) - if (tree.hasStacks()) explodeMultiblock(); - } - - if (eUncertainHatches.size() > 1) mMachine = false; - - if (mMachine) { - short id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) - if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; - id = 1; - 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]; - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) - if (isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) maxEUinputMin = hatch.maxEUInput(); - if (hatch.maxEUInput() > maxEUinputMax) maxEUinputMax = hatch.maxEUInput(); - } - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) - if (isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) maxEUinputMin = hatch.maxEUInput(); - if (hatch.maxEUInput() > maxEUinputMax) maxEUinputMax = hatch.maxEUInput(); - } - eMaxAmpereFlow = 0; - //counts only full amps - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) - if (isValidMetaTileEntity(hatch)) eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) - if (isValidMetaTileEntity(hatch)) - eMaxAmpereFlow += (hatch.maxEUInput() / maxEUinputMin) * hatch.Amperes; - if (this.getEUVar() > maxEUStore()) this.setEUVar(this.maxEUStore()); - } else { - maxEUinputMin = 0; - maxEUinputMax = 0; - eMaxAmpereFlow = 0; - this.setEUVar(0); - } - - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(true); - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches){ - if (isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(true); - if(hatch.param>=0) bParamsAreFloats[hatch.param]=hatch.isUsingFloats(); - } - } - } else { - maxEUinputMin = 0; - maxEUinputMax = 0; - eMaxAmpereFlow = 0; - this.setEUVar(0); - } - hatchInit_EM(); - } - - if (mStartUpCheck < 0) {//E - if (mMachine) {//S - final byte Tick = (byte) (aTick % 20); - if (MULTI_PURGE_1_AT == Tick || MULTI_PURGE_2_AT == Tick) - purgeAllOverflowEM_EM(); - else if (MULTI_CHECK_AT == Tick) - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (disableMaintenance) { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } else { - if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) - tHatch.autoMaintainance(); - if (tHatch.mWrench) mWrench = true; - if (tHatch.mScrewdriver) mScrewdriver = true; - if (tHatch.mSoftHammer) mSoftHammer = true; - if (tHatch.mHardHammer) mHardHammer = true; - if (tHatch.mSolderingTool) mSolderingTool = true; - if (tHatch.mCrowbar) mCrowbar = true; - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - } - else if (MOVE_AT == Tick && eSafeVoid) { - for (GT_MetaTileEntity_Hatch_MufflerElemental voider : eMufflerHatches) { - if (voider.overflowMax < voider.getOverflowMatter()) continue; - float remaining = voider.overflowMax - voider.getOverflowMatter(); - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - long qty = (long) Math.floor(remaining / instance.definition.getMass()); - if (qty > 0) { - qty = Math.min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) - voider.setOverflowMatter(voider.overflowMax); - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - long qty = (long)Math.floor(remaining / instance.definition.getMass()); - if (qty > 0) { - qty = Math.min(qty, instance.amount); - if (voider.addOverflowMatter(instance.definition.getMass() * qty)) - voider.setOverflowMatter(voider.overflowMax); - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - } - } - - if (getRepairStatus() >= minRepairStatus) {//S - if (MULTI_CHECK_AT == Tick) - hatchesStatusUpdate_EM(); - - //region power pass and controller charging - {//DO - long euVar; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (this.getEUVar() > this.getMinimumStoredEU()) break; - if (isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput(); - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) - this.setEUVar(this.getEUVar() + euVar); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (this.getEUVar() > this.getMinimumStoredEU()) break; - if (isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) - this.setEUVar(this.getEUVar() + euVar); - } - } - if (ePowerPass) { - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= (tHatch.maxEUStore() - euVar) && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false)) - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,tHatch.Amperes), false)) - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - } - //endregion - - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start - if (onRunningTick(mInventory[1])) {//Compute EU - 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(); - - outputAfterRecipe_EM(); - cleanOutputEM_EM(); - - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) addOutput(tStack); - mOutputItems = null; - - if (mOutputFluids != null) { - if (mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) - if (tStack != null) addOutput(tStack); - } else if (mOutputFluids.length > 1) addFluidOutputs(mOutputFluids); - } - mOutputFluids = null; - - updateSlots(); - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) { - if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - }else { - mMaxProgresstime=0; - } - updateSlots(); - } else notAllowedToWork_stopMachine_EM(); - } - }// else {//failed to consume power/resources - inside on running tick - // stopMachine(); - //} -