From 465a9295ddf785dca9725bc15b2d06d27b7444b3 Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 15 Mar 2017 21:22:15 +0100 Subject: REfactor, slowly adding debug container --- .../com/github/technus/tectech/CustomItemList.java | 161 --- .../github/technus/tectech/GT_CustomLoader.java | 27 - .../github/technus/tectech/GT_Loader_Machines.java | 195 --- .../github/technus/tectech/GT_Loader_Recipes.java | 35 - .../java/com/github/technus/tectech/TecTech.java | 21 +- .../Behaviour_elementalMatterContainer.java | 77 -- .../interfaces/iConnectsToEMpipe.java | 8 - .../technus/tectech/loader/GT_CustomLoader.java | 28 + .../technus/tectech/loader/GT_Loader_Machines.java | 200 +++ .../technus/tectech/loader/GT_Loader_Recipes.java | 35 + .../github/technus/tectech/proxy/ClientProxy.java | 2 +- .../technus/tectech/thing/CustomItemList.java | 161 +++ .../technus/tectech/thing/block/QuantumGlass.java | 87 ++ .../tectech/thing/block/QuantumGlassRender.java | 122 ++ .../tectech/thing/casing/GT_Block_CasingsTT.java | 114 ++ .../thing/casing/GT_Container_CasingsTT.java | 10 + .../tectech/thing/casing/GT_Item_CasingsTT.java | 14 + .../tectech/thing/casing/GT_Loader_CasingsTT.java | 10 + .../tectech/thing/item/debug_container_EM.java | 87 ++ .../github/technus/tectech/thing/machineTT.java | 7 + ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 249 ++++ .../GT_MetaTileEntity_MultiblockBase_EM.java | 1410 ++++++++++++++++++++ .../hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java | 114 ++ .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 115 ++ .../GT_MetaTileEntity_Hatch_InputElemental.java | 44 + .../GT_MetaTileEntity_Hatch_MufflerElemental.java | 173 +++ .../GT_MetaTileEntity_Hatch_OutputElemental.java | 72 + .../hatch/GT_MetaTileEntity_Hatch_Param.java | 183 +++ .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 297 +++++ .../hatch/gui/GT_Container_Param.java | 208 +++ .../hatch/gui/GT_Container_Uncertainty.java | 121 ++ .../hatch/gui/GT_GUIContainer_Param.java | 37 + .../hatch/gui/GT_GUIContainer_Uncertainty.java | 109 ++ .../hatch/gui/GT_GUIContainer_UncertaintyAdv.java | 117 ++ .../multi/GT_MetaTileEntity_EM_bhg.java | 95 ++ .../multi/GT_MetaTileEntity_EM_collider.java | 74 + .../multi/GT_MetaTileEntity_EM_computer.java | 51 + .../multi/GT_MetaTileEntity_EM_crafter.java | 51 + .../multi/GT_MetaTileEntity_EM_dequantifier.java | 66 + .../multi/GT_MetaTileEntity_EM_junction.java | 121 ++ .../multi/GT_MetaTileEntity_EM_machine.java | 51 + .../multi/GT_MetaTileEntity_EM_quantifier.java | 389 ++++++ .../multi/GT_MetaTileEntity_EM_scanner.java | 51 + .../multi/GT_MetaTileEntity_EM_transformer.java | 110 ++ .../multi/GT_MetaTileEntity_EM_wormhole.java | 74 + .../multi/gui/GT_Container_MultiMachineEM.java | 100 ++ .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 185 +++ .../pipe/GT_MetaTileEntity_Pipe_EM.java | 164 +++ .../metaTileEntity/pipe/iConnectsToEMpipe.java | 8 + .../technus/tectech/things/block/QuantumGlass.java | 83 -- .../tectech/things/block/QuantumGlassRender.java | 122 -- .../tectech/things/casing/GT_Block_CasingsTT.java | 114 -- .../things/casing/GT_Container_CasingsTT.java | 10 - .../tectech/things/casing/GT_Item_CasingsTT.java | 14 - .../tectech/things/casing/GT_Loader_CasingsTT.java | 10 - .../github/technus/tectech/things/machineTT.java | 7 - ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 249 ---- .../GT_MetaTileEntity_MultiblockBase_EM.java | 1410 -------------------- .../hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java | 114 -- .../hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java | 115 -- .../GT_MetaTileEntity_Hatch_InputElemental.java | 44 - .../GT_MetaTileEntity_Hatch_MufflerElemental.java | 173 --- .../GT_MetaTileEntity_Hatch_OutputElemental.java | 70 - .../hatch/GT_MetaTileEntity_Hatch_Param.java | 183 --- .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 297 ----- .../hatch/gui/GT_Container_Param.java | 208 --- .../hatch/gui/GT_Container_Uncertainty.java | 121 -- .../hatch/gui/GT_GUIContainer_Param.java | 37 - .../hatch/gui/GT_GUIContainer_Uncertainty.java | 109 -- .../hatch/gui/GT_GUIContainer_UncertaintyAdv.java | 117 -- .../multi/GT_MetaTileEntity_EM_bhg.java | 94 -- .../multi/GT_MetaTileEntity_EM_collider.java | 73 - .../multi/GT_MetaTileEntity_EM_computer.java | 50 - .../multi/GT_MetaTileEntity_EM_crafter.java | 50 - .../multi/GT_MetaTileEntity_EM_dequantifier.java | 65 - .../multi/GT_MetaTileEntity_EM_junction.java | 118 -- .../multi/GT_MetaTileEntity_EM_machine.java | 50 - .../multi/GT_MetaTileEntity_EM_quantifier.java | 388 ------ .../multi/GT_MetaTileEntity_EM_scanner.java | 50 - .../multi/GT_MetaTileEntity_EM_transformer.java | 109 -- .../multi/GT_MetaTileEntity_EM_wormhole.java | 73 - .../multi/gui/GT_Container_MultiMachineEM.java | 100 -- .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 185 --- .../pipe/GT_MetaTileEntity_Pipe_EM.java | 165 --- 84 files changed, 5726 insertions(+), 5691 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/CustomItemList.java delete mode 100644 src/main/java/com/github/technus/tectech/GT_CustomLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/GT_Loader_Machines.java delete mode 100644 src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java delete mode 100644 src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java delete mode 100644 src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java create mode 100644 src/main/java/com/github/technus/tectech/loader/GT_CustomLoader.java create mode 100644 src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java create mode 100644 src/main/java/com/github/technus/tectech/loader/GT_Loader_Recipes.java create mode 100644 src/main/java/com/github/technus/tectech/thing/CustomItemList.java create mode 100644 src/main/java/com/github/technus/tectech/thing/block/QuantumGlass.java create mode 100644 src/main/java/com/github/technus/tectech/thing/block/QuantumGlassRender.java create mode 100644 src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java create mode 100644 src/main/java/com/github/technus/tectech/thing/casing/GT_Container_CasingsTT.java create mode 100644 src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java create mode 100644 src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java create mode 100644 src/main/java/com/github/technus/tectech/thing/item/debug_container_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/machineTT.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java create 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_OutputElemental.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java create 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/GT_MetaTileEntity_EM_quantifier.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToEMpipe.java delete mode 100644 src/main/java/com/github/technus/tectech/things/block/QuantumGlass.java delete mode 100644 src/main/java/com/github/technus/tectech/things/block/QuantumGlassRender.java delete mode 100644 src/main/java/com/github/technus/tectech/things/casing/GT_Block_CasingsTT.java delete mode 100644 src/main/java/com/github/technus/tectech/things/casing/GT_Container_CasingsTT.java delete mode 100644 src/main/java/com/github/technus/tectech/things/casing/GT_Item_CasingsTT.java delete mode 100644 src/main/java/com/github/technus/tectech/things/casing/GT_Loader_CasingsTT.java delete mode 100644 src/main/java/com/github/technus/tectech/things/machineTT.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Param.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java delete mode 100644 src/main/java/com/github/technus/tectech/things/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java (limited to 'src/main') diff --git a/src/main/java/com/github/technus/tectech/CustomItemList.java b/src/main/java/com/github/technus/tectech/CustomItemList.java deleted file mode 100644 index 5b3c2fd350..0000000000 --- a/src/main/java/com/github/technus/tectech/CustomItemList.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.github.technus.tectech; - -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import static gregtech.api.enums.GT_Values.W; - -public enum CustomItemList implements IItemContainer { - EMpipe, - eM_dynamomulti4_UV, eM_dynamomulti16_UV, eM_dynamomulti64_UV, - eM_dynamomulti4_UHV, eM_dynamomulti16_UHV, eM_dynamomulti64_UHV, - eM_dynamomulti4_UEV, eM_dynamomulti16_UEV, eM_dynamomulti64_UEV, - eM_dynamomulti4_UIV, eM_dynamomulti16_UIV, eM_dynamomulti64_UIV, - eM_dynamomulti4_UMV, eM_dynamomulti16_UMV, eM_dynamomulti64_UMV, - eM_dynamomulti4_UXV, eM_dynamomulti16_UXV, eM_dynamomulti64_UXV, - eM_energymulti4_UV, eM_energymulti16_UV, eM_energymulti64_UV, - eM_energymulti4_UHV, eM_energymulti16_UHV, eM_energymulti64_UHV, - eM_energymulti4_UEV, eM_energymulti16_UEV, eM_energymulti64_UEV, - eM_energymulti4_UIV, eM_energymulti16_UIV, eM_energymulti64_UIV, - eM_energymulti4_UMV, eM_energymulti16_UMV, eM_energymulti64_UMV, - eM_energymulti4_UXV, eM_energymulti16_UXV, eM_energymulti64_UXV, - eM_in_UV, eM_in_UHV, eM_in_UEV, eM_in_UIV, eM_in_UMV, eM_in_UXV, - eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV, - eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV, - Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, - eM_Casing, eM_Field, eM_Field_Casing, eM_Coil, eM_Tele, eM_TimeSpaceWarp, - debugBlock, - Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, - Machine_Multi_Transformer, Machine_Multi_Computer, - Machine_Multi_BHG, Machine_Multi_EMmachine, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner; - - - private ItemStack mStack = null; - private boolean mHasNotBeenSet = true; - - //public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; - - @Override - public IItemContainer set(Item aItem) { - mHasNotBeenSet = false; - if (aItem == null) return this; - ItemStack aStack = new ItemStack(aItem, 1, 0); - mStack = GT_Utility.copyAmount(1, aStack); - return this; - } - - @Override - public IItemContainer set(ItemStack aStack) { - mHasNotBeenSet = false; - mStack = GT_Utility.copyAmount(1, aStack); - return this; - } - - @Override - public Item getItem() { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return null; - return mStack.getItem(); - } - - @Override - public Block getBlock() { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - return GT_Utility.getBlockFromStack(getItem()); - } - - @Override - public final boolean hasBeenSet() { - return !mHasNotBeenSet; - } - - @Override - public boolean isStackEqual(Object aStack) { - return isStackEqual(aStack, false, false); - } - - @Override - public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { - if (GT_Utility.isStackInvalid(aStack)) return false; - return GT_Utility.areUnificationsEqual((ItemStack) aStack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT); - } - - @Override - public ItemStack get(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack)); - } - - @Override - public ItemStack getWildcard(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack)); - } - - @Override - public ItemStack getUndamaged(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack)); - } - - @Override - public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(mStack)); - } - - @Override - public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { - ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) return null; - rStack.setStackDisplayName(aDisplayName); - return GT_Utility.copyAmount(aAmount, rStack); - } - - @Override - public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { - ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) return null; - GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); - return GT_Utility.copyAmount(aAmount, rStack); - } - - @Override - public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack)); - } - - @Override - public IItemContainer registerOre(Object... aOreNames) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1)); - return this; - } - - @Override - public IItemContainer registerWildcardAsOre(Object... aOreNames) { - if (mHasNotBeenSet) - throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); - return this; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/GT_CustomLoader.java b/src/main/java/com/github/technus/tectech/GT_CustomLoader.java deleted file mode 100644 index 196b97c074..0000000000 --- a/src/main/java/com/github/technus/tectech/GT_CustomLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.github.technus.tectech; - -import com.github.technus.tectech.things.casing.GT_Loader_CasingsTT; - -public class GT_CustomLoader { - private GT_Loader_Machines ElementalLoader; - private GT_Loader_CasingsTT ElementalCasing; - private GT_Loader_Recipes ElementalRecipes; - - public GT_CustomLoader() { - } - - public void run() { - ElementalCasing = new GT_Loader_CasingsTT(); - ElementalCasing.run(); - TecTech.Logger.info("Casing Init Done"); - ElementalLoader = new GT_Loader_Machines(); - ElementalLoader.run(); - TecTech.Logger.info("Machine Init Done"); - } - - public void run2() { - ElementalRecipes = new GT_Loader_Recipes(); - ElementalRecipes.run(); - TecTech.Logger.info("Recipe Init Done Done"); - } -} diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java b/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java deleted file mode 100644 index 1364498063..0000000000 --- a/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.github.technus.tectech; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class GT_Loader_Machines implements Runnable { - public void run() { - // =================================================================================================== - // eM IN - // =================================================================================================== - - CustomItemList.eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12070, "hatch.emin.tier.08", "UV Elemental Input Hatch", 8).getStackForm(1L)); - - CustomItemList.eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12071, "hatch.emin.tier.09", "UHV Elemental Input Hatch", 9).getStackForm(1L)); - - CustomItemList.eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12072, "hatch.emin.tier.10", "UEV Elemental Input Hatch", 10).getStackForm(1L)); - - CustomItemList.eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12073, "hatch.emin.tier.11", "UIV Elemental Input Hatch", 11).getStackForm(1L)); - - CustomItemList.eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12074, "hatch.emin.tier.12", "UMV Elemental Input Hatch", 12).getStackForm(1L)); - - CustomItemList.eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12075, "hatch.emin.tier.13", "UXV Elemental Input Hatch", 13).getStackForm(1L)); - - // =================================================================================================== - // eM OUT - // =================================================================================================== - - CustomItemList.eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12080, "hatch.emout.tier.08", "UV Elemental Output Hatch", 8).getStackForm(1L)); - - CustomItemList.eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12081, "hatch.emout.tier.09", "UHV Elemental Output Hatch", 9).getStackForm(1L)); - - CustomItemList.eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12082, "hatch.emout.tier.10", "UEV Elemental Output Hatch", 10).getStackForm(1L)); - - CustomItemList.eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12083, "hatch.emout.tier.11", "UIV Elemental Output Hatch", 11).getStackForm(1L)); - - CustomItemList.eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12084, "hatch.emout.tier.12", "UMV Elemental Output Hatch", 12).getStackForm(1L)); - - CustomItemList.eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12085, "hatch.emout.tier.13", "UXV Elemental Output Hatch", 13).getStackForm(1L)); - - // =================================================================================================== - // eM Waste OUT - // =================================================================================================== - - CustomItemList.eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12090, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12091, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12092, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12093, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12094, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); - - CustomItemList.eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12095, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); - - // =================================================================================================== - // Multi AMP Power INPUTS - // =================================================================================================== - - CustomItemList.eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); - - - // =================================================================================================== - // Multi AMP Power OUTPUTS - // =================================================================================================== - - CustomItemList.eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12130, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12140, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12150, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12131, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12141, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12151, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12132, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12142, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12152, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12133, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12143, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12153, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12134, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12144, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12154, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12135, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12145, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12155, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); - - // =================================================================================================== - // MULTIBLOCKS EM - // =================================================================================================== - - CustomItemList.Machine_Multi_Transformer.set(new GT_MetaTileEntity_EM_transformer(12160, "multimachine.em.transformer", "Active Transformer").getStackForm(1L)); - CustomItemList.Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantifier(12161, "multimachine.em.mattertoem", "Matter Quantifier").getStackForm(1L)); - CustomItemList.Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EM_dequantifier(12162, "multimachine.em.emtomatter", "Matter De-quantifier").getStackForm(1L)); - CustomItemList.Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(12163, "multimachine.em.junction", "Matter junction").getStackForm(1L)); - CustomItemList.Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EM_machine(12164, "multimachine.em.processing", "Quantum Processing Machine").getStackForm(1L)); - CustomItemList.Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafter(12165, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); - CustomItemList.Machine_Multi_Collider.set(new GT_MetaTileEntity_EM_collider(12166, "multimachine.em.collider", "Matter Collider").getStackForm(1L)); - CustomItemList.Machine_Multi_BHG.set(new GT_MetaTileEntity_EM_bhg(12167, "multimachine.em.blackholegenerator", "Black Hole Generator").getStackForm(1L)); - CustomItemList.Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EM_wormhole(12168, "multimachine.em.wormhole", "Wormhole").getStackForm(1L)); - CustomItemList.Machine_Multi_Scanner.set(new GT_MetaTileEntity_EM_scanner(12169, "multimachine.em.scanner", "Elemental Scanner").getStackForm(1L)); - CustomItemList.Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(12170, "multimachine.em.computer", "Quantum computer").getStackForm(1L)); - - // =================================================================================================== - // Hatches EM - // =================================================================================================== - CustomItemList.Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12180, "hatch.param.tier.06", "Parametrizer for machines", 6).getStackForm(1L)); - CustomItemList.Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12181, "hatch.emcertain.tier.06", "Uncertainty resolver", 6).getStackForm(1L)); - CustomItemList.UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12182, "hatch.emcertain.tier.10", "Uncertainty resolver X", 10).getStackForm(1L)); - - // =================================================================================================== - // EM pipe - // =================================================================================================== - CustomItemList.EMpipe.set(new GT_MetaTileEntity_Pipe_EM(12179, "pipe.elementalmatter", "Quantum tunnel").getStackForm(1L)); - } -} diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java b/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java deleted file mode 100644 index fc957224dc..0000000000 --- a/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.github.technus.tectech; - -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; -import com.github.technus.tectech.elementalMatter.definitions.*; -import com.github.technus.tectech.things.metaTileEntity.multi.GT_MetaTileEntity_EM_quantifier; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class GT_Loader_Recipes implements Runnable { - public void run() { - // =================================================================================================== - // def init - // =================================================================================================== - - cElementalPrimitive.run(); - - cPrimitiveDefinition.run(); - - eQuarkDefinition.run(); - eLeptonDefinition.run(); - eNeutrinoDefinition.run(); - eBosonDefinition.run(); - - dHadronDefinition.run(); - - dAtomDefinition.run(); - - // =================================================================================================== - // Recipe init - // =================================================================================================== - - GT_MetaTileEntity_EM_quantifier.run(); - } -} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 5104cbc055..c4d9cc3a86 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -2,9 +2,12 @@ package com.github.technus.tectech; import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.auxiliary.TecTechConfig; -import com.github.technus.tectech.things.block.QuantumGlass; -import com.github.technus.tectech.things.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.things.machineTT; +import com.github.technus.tectech.loader.GT_CustomLoader; +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.block.QuantumGlass; +import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.thing.item.debug_container_EM; +import com.github.technus.tectech.thing.machineTT; import com.github.technus.tectech.proxy.CommonProxy; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; @@ -81,6 +84,9 @@ public class TecTech { @EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { + QuantumGlass.run(); + debug_container_EM.run(); + GTCustomLoader = new GT_CustomLoader(); GTCustomLoader.run(); GTCustomLoader.run2(); @@ -89,13 +95,7 @@ public class TecTech { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return CustomItemList.eM_TimeSpaceWarp.getItem(); - } - - @SideOnly(Side.CLIENT) - @Override - public ItemStack getIconItemStack() { - return CustomItemList.eM_TimeSpaceWarp.getWithDamage(1, 8); + return debug_container_EM.INSTANCE; } @Override @@ -115,6 +115,7 @@ public class TecTech { public void RegisterThingsInTabs() { QuantumGlass.INSTANCE.setCreativeTab(mainTab);//TODO? COPY PASTE GT CLASSES TO ADD MY THINGS TO CREATIVE TAB GT_Container_CasingsTT.sBlockCasingsTT.setCreativeTab(mainTab); + debug_container_EM.INSTANCE.setCreativeTab(mainTab); } /** diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java deleted file mode 100644 index 4136d78339..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.github.technus.tectech.elementalMatter.classes; - - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.items.behaviors.Behaviour_None; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import java.util.Collections; -import java.util.List; - -/** - * Created by danie_000 on 11.12.2016. - * used in custom GT build! debug purposes - */ -public final class Behaviour_elementalMatterContainer extends Behaviour_None { - public static final IItemBehaviour INSTANCE = new Behaviour_elementalMatterContainer(); - private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.emc", "Container for elemental matter"); - - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - NBTTagCompound tNBT = aStack.getTagCompound(); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (aPlayer instanceof EntityPlayerMP) { - aStack.stackSize = 1; - if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE != null && metaTE instanceof iElementalInstanceContainer) { - cElementalInstanceStackTree content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); - if (tNBT.hasKey("content")) { - try { - content.putUnifyAll(cElementalInstanceStackTree.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { - if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); - return true; - } - ((iElementalInstanceContainer) metaTE).purgeOverflow(); - tNBT.removeTag("content"); - tNBT.removeTag("info"); - } else if (content.hasStacks()) { - ((iElementalInstanceContainer) metaTE).purgeOverflow(); - tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); - content.clear(); - } - } - return true; - } - } - return aPlayer instanceof EntityPlayerMP; - } - - public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) { - aList.add(commonValues.tecMark); - aList.add(mTooltip); - try { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT.hasKey("info")) { - aList.add("Contains:"); - Collections.addAll(aList, cElementalInstanceStackTree.infoFromNBT(tNBT.getCompoundTag("info"))); - } - } catch (Exception e) { - aList.add("---Unexpected Termination---"); - } - return aList; - } -} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java deleted file mode 100644 index 9d9d0ebea9..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iConnectsToEMpipe.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.elementalMatter.interfaces; - -/** - * Created by Tec on 26.02.2017. - */ -public interface iConnectsToEMpipe { - boolean canConnect(byte side); -} diff --git a/src/main/java/com/github/technus/tectech/loader/GT_CustomLoader.java b/src/main/java/com/github/technus/tectech/loader/GT_CustomLoader.java new file mode 100644 index 0000000000..2e9bb371af --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/GT_CustomLoader.java @@ -0,0 +1,28 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.casing.GT_Loader_CasingsTT; + +public class GT_CustomLoader { + private GT_Loader_Machines ElementalLoader; + private GT_Loader_CasingsTT ElementalCasing; + private GT_Loader_Recipes ElementalRecipes; + + public GT_CustomLoader() { + } + + public void run() { + ElementalCasing = new GT_Loader_CasingsTT(); + ElementalCasing.run(); + TecTech.Logger.info("Casing Init Done"); + ElementalLoader = new GT_Loader_Machines(); + ElementalLoader.run(); + TecTech.Logger.info("Machine Init Done"); + } + + public void run2() { + ElementalRecipes = new GT_Loader_Recipes(); + ElementalRecipes.run(); + TecTech.Logger.info("Recipe Init Done Done"); + } +} diff --git a/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java new file mode 100644 index 0000000000..28ea0e22d4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Machines.java @@ -0,0 +1,200 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.metaTileEntity.hatch.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.*; +import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class GT_Loader_Machines implements Runnable { + public void run() { + // =================================================================================================== + // eM IN + // =================================================================================================== + + CustomItemList.eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12070, "hatch.emin.tier.08", "UV Elemental Input Hatch", 8).getStackForm(1L)); + + CustomItemList.eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12071, "hatch.emin.tier.09", "UHV Elemental Input Hatch", 9).getStackForm(1L)); + + CustomItemList.eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12072, "hatch.emin.tier.10", "UEV Elemental Input Hatch", 10).getStackForm(1L)); + + CustomItemList.eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12073, "hatch.emin.tier.11", "UIV Elemental Input Hatch", 11).getStackForm(1L)); + + CustomItemList.eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12074, "hatch.emin.tier.12", "UMV Elemental Input Hatch", 12).getStackForm(1L)); + + CustomItemList.eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12075, "hatch.emin.tier.13", "UXV Elemental Input Hatch", 13).getStackForm(1L)); + + // =================================================================================================== + // eM OUT + // =================================================================================================== + + CustomItemList.eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12080, "hatch.emout.tier.08", "UV Elemental Output Hatch", 8).getStackForm(1L)); + + CustomItemList.eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12081, "hatch.emout.tier.09", "UHV Elemental Output Hatch", 9).getStackForm(1L)); + + CustomItemList.eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12082, "hatch.emout.tier.10", "UEV Elemental Output Hatch", 10).getStackForm(1L)); + + CustomItemList.eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12083, "hatch.emout.tier.11", "UIV Elemental Output Hatch", 11).getStackForm(1L)); + + CustomItemList.eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12084, "hatch.emout.tier.12", "UMV Elemental Output Hatch", 12).getStackForm(1L)); + + CustomItemList.eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12085, "hatch.emout.tier.13", "UXV Elemental Output Hatch", 13).getStackForm(1L)); + + // =================================================================================================== + // eM Waste OUT + // =================================================================================================== + + CustomItemList.eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12090, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12091, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12092, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12093, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12094, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + + CustomItemList.eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12095, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + + // =================================================================================================== + // Multi AMP Power INPUTS + // =================================================================================================== + + CustomItemList.eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); + + + // =================================================================================================== + // Multi AMP Power OUTPUTS + // =================================================================================================== + + CustomItemList.eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12130, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12140, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12150, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12131, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12141, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12151, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12132, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12142, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12152, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12133, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12143, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12153, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12134, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12144, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12154, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12135, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12145, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12155, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); + + // =================================================================================================== + // MULTIBLOCKS EM + // =================================================================================================== + + CustomItemList.Machine_Multi_Transformer.set(new GT_MetaTileEntity_EM_transformer(12160, "multimachine.em.transformer", "Active Transformer").getStackForm(1L)); + CustomItemList.Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantifier(12161, "multimachine.em.mattertoem", "Matter Quantifier").getStackForm(1L)); + CustomItemList.Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EM_dequantifier(12162, "multimachine.em.emtomatter", "Matter De-quantifier").getStackForm(1L)); + CustomItemList.Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(12163, "multimachine.em.junction", "Matter junction").getStackForm(1L)); + CustomItemList.Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EM_machine(12164, "multimachine.em.processing", "Quantum Processing Machine").getStackForm(1L)); + CustomItemList.Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafter(12165, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); + CustomItemList.Machine_Multi_Collider.set(new GT_MetaTileEntity_EM_collider(12166, "multimachine.em.collider", "Matter Collider").getStackForm(1L)); + CustomItemList.Machine_Multi_BHG.set(new GT_MetaTileEntity_EM_bhg(12167, "multimachine.em.blackholegenerator", "Black Hole Generator").getStackForm(1L)); + CustomItemList.Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EM_wormhole(12168, "multimachine.em.wormhole", "Wormhole").getStackForm(1L)); + CustomItemList.Machine_Multi_Scanner.set(new GT_MetaTileEntity_EM_scanner(12169, "multimachine.em.scanner", "Elemental Scanner").getStackForm(1L)); + CustomItemList.Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(12170, "multimachine.em.computer", "Quantum computer").getStackForm(1L)); + + // =================================================================================================== + // Hatches EM + // =================================================================================================== + CustomItemList.Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12180, "hatch.param.tier.06", "Parametrizer for machines", 6).getStackForm(1L)); + CustomItemList.Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12181, "hatch.emcertain.tier.06", "Uncertainty resolver", 6).getStackForm(1L)); + CustomItemList.UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12182, "hatch.emcertain.tier.10", "Uncertainty resolver X", 10).getStackForm(1L)); + + // =================================================================================================== + // EM pipe + // =================================================================================================== + CustomItemList.EMpipe.set(new GT_MetaTileEntity_Pipe_EM(12179, "pipe.elementalmatter", "Quantum tunnel").getStackForm(1L)); + } +} diff --git a/src/main/java/com/github/technus/tectech/loader/GT_Loader_Recipes.java b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Recipes.java new file mode 100644 index 0000000000..a4885f5401 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/GT_Loader_Recipes.java @@ -0,0 +1,35 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.definitions.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantifier; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class GT_Loader_Recipes implements Runnable { + public void run() { + // =================================================================================================== + // def init + // =================================================================================================== + + cElementalPrimitive.run(); + + cPrimitiveDefinition.run(); + + eQuarkDefinition.run(); + eLeptonDefinition.run(); + eNeutrinoDefinition.run(); + eBosonDefinition.run(); + + dHadronDefinition.run(); + + dAtomDefinition.run(); + + // =================================================================================================== + // Recipe init + // =================================================================================================== + + GT_MetaTileEntity_EM_quantifier.run(); + } +} diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 3bee3cdd77..67ed5e81ef 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.proxy; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.block.QuantumGlassRender; +import com.github.technus.tectech.thing.block.QuantumGlassRender; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java new file mode 100644 index 0000000000..ece34583f7 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -0,0 +1,161 @@ +package com.github.technus.tectech.thing; + +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import static gregtech.api.enums.GT_Values.W; + +public enum CustomItemList implements IItemContainer { + EMpipe, + eM_dynamomulti4_UV, eM_dynamomulti16_UV, eM_dynamomulti64_UV, + eM_dynamomulti4_UHV, eM_dynamomulti16_UHV, eM_dynamomulti64_UHV, + eM_dynamomulti4_UEV, eM_dynamomulti16_UEV, eM_dynamomulti64_UEV, + eM_dynamomulti4_UIV, eM_dynamomulti16_UIV, eM_dynamomulti64_UIV, + eM_dynamomulti4_UMV, eM_dynamomulti16_UMV, eM_dynamomulti64_UMV, + eM_dynamomulti4_UXV, eM_dynamomulti16_UXV, eM_dynamomulti64_UXV, + eM_energymulti4_UV, eM_energymulti16_UV, eM_energymulti64_UV, + eM_energymulti4_UHV, eM_energymulti16_UHV, eM_energymulti64_UHV, + eM_energymulti4_UEV, eM_energymulti16_UEV, eM_energymulti64_UEV, + eM_energymulti4_UIV, eM_energymulti16_UIV, eM_energymulti64_UIV, + eM_energymulti4_UMV, eM_energymulti16_UMV, eM_energymulti64_UMV, + eM_energymulti4_UXV, eM_energymulti16_UXV, eM_energymulti64_UXV, + eM_in_UV, eM_in_UHV, eM_in_UEV, eM_in_UIV, eM_in_UMV, eM_in_UXV, + eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV, + eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV, + Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, + eM_Casing, eM_Field, eM_Field_Casing, eM_Coil, eM_Tele, eM_TimeSpaceWarp, + debugBlock, + Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, + Machine_Multi_Transformer, Machine_Multi_Computer, + Machine_Multi_BHG, Machine_Multi_EMmachine, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner; + + + private ItemStack mStack = null; + private boolean mHasNotBeenSet = true; + + //public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; + + @Override + public IItemContainer set(Item aItem) { + mHasNotBeenSet = false; + if (aItem == null) return this; + ItemStack aStack = new ItemStack(aItem, 1, 0); + mStack = GT_Utility.copyAmount(1, aStack); + return this; + } + + @Override + public IItemContainer set(ItemStack aStack) { + mHasNotBeenSet = false; + mStack = GT_Utility.copyAmount(1, aStack); + return this; + } + + @Override + public Item getItem() { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return null; + return mStack.getItem(); + } + + @Override + public Block getBlock() { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + return GT_Utility.getBlockFromStack(getItem()); + } + + @Override + public final boolean hasBeenSet() { + return !mHasNotBeenSet; + } + + @Override + public boolean isStackEqual(Object aStack) { + return isStackEqual(aStack, false, false); + } + + @Override + public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { + if (GT_Utility.isStackInvalid(aStack)) return false; + return GT_Utility.areUnificationsEqual((ItemStack) aStack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT); + } + + @Override + public ItemStack get(long aAmount, Object... aReplacements) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); + return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack)); + } + + @Override + public ItemStack getWildcard(long aAmount, Object... aReplacements) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); + return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack)); + } + + @Override + public ItemStack getUndamaged(long aAmount, Object... aReplacements) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); + return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack)); + } + + @Override + public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); + return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(mStack)); + } + + @Override + public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { + ItemStack rStack = get(1, aReplacements); + if (GT_Utility.isStackInvalid(rStack)) return null; + rStack.setStackDisplayName(aDisplayName); + return GT_Utility.copyAmount(aAmount, rStack); + } + + @Override + public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { + ItemStack rStack = get(1, aReplacements); + if (GT_Utility.isStackInvalid(rStack)) return null; + GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); + return GT_Utility.copyAmount(aAmount, rStack); + } + + @Override + public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); + return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack)); + } + + @Override + public IItemContainer registerOre(Object... aOreNames) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1)); + return this; + } + + @Override + public IItemContainer registerWildcardAsOre(Object... aOreNames) { + if (mHasNotBeenSet) + throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); + for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); + return this; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlass.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlass.java new file mode 100644 index 0000000000..3035641675 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlass.java @@ -0,0 +1,87 @@ +package com.github.technus.tectech.thing.block; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import eu.usrv.yamcore.blocks.BlockBase; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 17.12.2016. + */ +public final class QuantumGlass extends BlockBase { + public static IIcon stuff; + public static QuantumGlass INSTANCE; + + public QuantumGlass() { + super(Material.iron); + this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockName("QuantumGlass"); + setHarvestLevel("wrench", 3); + setHardness(50); + setResistance(30); + setLightOpacity(0); + setStepSound(Block.soundTypeMetal); + setBlockTextureName(MODID + ":blockQuantumGlass"); + } + + @Override + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { + return true; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean getCanBlockGrass() { + return false; + } + + //@Override + //public boolean canRenderInPass(int pass) { + // return true; + //} + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { + return false; + } + + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } + + public boolean renderAsNormalBlock() { + return false; + } + + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); + return block != this;// && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); + } + + @Override + public int getRenderType() { + return QuantumGlassRender.renderID; + } + + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + stuff = this.blockIcon; + } + + public static void run(){ + INSTANCE=new QuantumGlass(); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassRender.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassRender.java new file mode 100644 index 0000000000..cf0a152ab4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassRender.java @@ -0,0 +1,122 @@ +package com.github.technus.tectech.thing.block; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +/** + * Created by danie_000 on 19.12.2016. + */ +public final class QuantumGlassRender implements ISimpleBlockRenderingHandler { + public static int renderID; + + public QuantumGlassRender() { + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + Tessellator tessellator = Tessellator.instance; + + //Get icons from custom register (useful for renderers and fluids) + IIcon side = QuantumGlass.stuff; + GL11.glDisable(GL11.GL_CULL_FACE); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, side); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + GL11.glEnable(GL11.GL_CULL_FACE); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, + Block block, int modelId, + RenderBlocks renderer) { + + renderer.renderStandardBlock(block, x, y, z); + Tessellator tes = Tessellator.instance; + tes.setNormal(0F, 1F, 0F); + tes.setBrightness(15728880); + tes.setColorOpaque_F(0F, 1F, 1F); + IIcon side = QuantumGlass.stuff; + + //South + if (world.getBlock(x, y, z + 1).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x, y, z + 0.999, side.getMinU(), side.getMaxV()); //0.999 instead of 1 for fighting (textures overlapping) + tes.addVertexWithUV(x, y + 1, z + 0.999, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y + 1, z + 0.999, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y, z + 0.999, side.getMaxU(), side.getMaxV()); + } + //East + if (world.getBlock(x + 1, y, z).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x + 0.999, y, z + 1, side.getMinU(), side.getMaxV()); + tes.addVertexWithUV(x + 0.999, y + 1, z + 1, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x + 0.999, y + 1, z, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x + 0.999, y, z, side.getMaxU(), side.getMaxV()); + } + //North + if (world.getBlock(x, y, z - 1).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x + 1, y, z + 0.001, side.getMinU(), side.getMaxV()); + tes.addVertexWithUV(x + 1, y + 1, z + 0.001, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x, y + 1, z + 0.001, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x, y, z + 0.001, side.getMaxU(), side.getMaxV()); + } + //West + if (world.getBlock(x - 1, y, z).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x + 0.001, y, z, side.getMinU(), side.getMaxV()); + tes.addVertexWithUV(x + 0.001, y + 1, z, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x + 0.001, y + 1, z + 1, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x + 0.001, y, z + 1, side.getMaxU(), side.getMaxV()); + } + //Top + if (world.getBlock(x, y + 1, z).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x, y + 0.999, z + 1, side.getMinU(), side.getMaxV()); + tes.addVertexWithUV(x, y + 0.999, z, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y + 0.999, z, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y + 0.999, z + 1, side.getMaxU(), side.getMaxV()); + } + //Bottom + if (world.getBlock(x, y - 1, z).getClass() != QuantumGlass.class) { + tes.addVertexWithUV(x, y + 0.001, z, side.getMinU(), side.getMaxV()); + tes.addVertexWithUV(x, y + 0.001, z + 1, side.getMinU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y + 0.001, z + 1, side.getMaxU(), side.getMinV()); + tes.addVertexWithUV(x + 1, y + 0.001, z, side.getMaxU(), side.getMaxV()); + } + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return QuantumGlassRender.renderID; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java new file mode 100644 index 0000000000..ffd798f487 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.thing.casing; + +import com.github.technus.tectech.thing.CustomItemList; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Block_Casings_Abstract; +import gregtech.common.blocks.GT_Material_Casings; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import java.util.List; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Block_CasingsTT + extends GT_Block_Casings_Abstract { + + private static IIcon eM3, eM4, eM5, eM6, eM7, eM8, eM9; + private static IIcon debug[] = new IIcon[6]; + + public GT_Block_CasingsTT() { + + super(GT_Item_CasingsTT.class, "gt.blockcasingsTT", GT_Material_Casings.INSTANCE); + for (byte i = 0; i < 16; i = (byte) (i + 1)) { + Textures.BlockIcons.CASING_BLOCKS[(i + 96)] = new GT_CopiedBlockTexture(this, 6, i); + /*IMPORTANT for block recoloring*/ + } + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Molecular Containment Casing");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Containment Field Generator");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Containment Field Generator Casing");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Molecular Containment Coil");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Teleportation Casing");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Spacetime Altering Casing");//adding + + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Debug Sides");//adding + + + CustomItemList.eM_Casing.set(new ItemStack(this, 1, 3));//adding + CustomItemList.eM_Field.set(new ItemStack(this, 1, 4));//adding + CustomItemList.eM_Field_Casing.set(new ItemStack(this, 1, 5));//adding + CustomItemList.eM_Coil.set(new ItemStack(this, 1, 6));//adding + CustomItemList.eM_Tele.set(new ItemStack(this, 1, 7));//adding + CustomItemList.eM_TimeSpaceWarp.set(new ItemStack(this, 1, 8)); + + CustomItemList.debugBlock.set(new ItemStack(this, 1, 9)); + } + + @Override + public void registerBlockIcons(IIconRegister aIconRegister) { + //super.registerBlockIcons(aIconRegister); + eM3 = aIconRegister.registerIcon("gregtech:iconsets/EM_CASING"); + eM4 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD"); + eM5 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_CASING"); + eM6 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL"); + eM7 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL_NONSIDE"); + eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); + eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); + eM9 = aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); + + debug[0] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_0"); + debug[1] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_1"); + debug[2] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_2"); + debug[3] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_3"); + debug[4] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_4"); + debug[5] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_5"); + } + + public IIcon getIcon(int aSide, int aMeta) { + switch (aMeta) { + case 3: + return eM3; + case 4: + return eM4; + case 5: + return eM5; + case 6: + if (aSide < 2) return eM7; + return eM6; + case 7: + return eM8; + case 8: + return eM9; + case 9: + return debug[aSide]; + default: + return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); + } + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { + int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + return getIcon(aSide, tMeta); + } + + public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { + return super.colorMultiplier(aWorld, aX, aY, aZ); + } + + @Override + public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { + for (int i = 3; i <= 9; i++) { + aList.add(new ItemStack(aItem, 1, i)); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Container_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Container_CasingsTT.java new file mode 100644 index 0000000000..7e7360de18 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Container_CasingsTT.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.thing.casing; + +import net.minecraft.block.Block; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Container_CasingsTT { + public static Block sBlockCasingsTT; +} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java new file mode 100644 index 0000000000..e8e8fc8f17 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.thing.casing; + +import gregtech.common.blocks.GT_Item_Casings_Abstract; +import net.minecraft.block.Block; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Item_CasingsTT + extends GT_Item_Casings_Abstract { + public GT_Item_CasingsTT(Block par1) { + super(par1); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java new file mode 100644 index 0000000000..2e7ef20b27 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Loader_CasingsTT.java @@ -0,0 +1,10 @@ +package com.github.technus.tectech.thing.casing; + +/** + * Created by danie_000 on 03.10.2016. + */ +public class GT_Loader_CasingsTT implements Runnable { + public void run() { + GT_Container_CasingsTT.sBlockCasingsTT = new GT_Block_CasingsTT(); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/debug_container_EM.java b/src/main/java/com/github/technus/tectech/thing/item/debug_container_EM.java new file mode 100644 index 0000000000..d6e3a475b5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/debug_container_EM.java @@ -0,0 +1,87 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by Tec on 15.03.2017. + */ +public class debug_container_EM extends Item { + public static debug_container_EM INSTANCE; + + debug_container_EM(){ + super(); + setMaxStackSize(1); + setUnlocalizedName("em.debugContainer"); + setTextureName(MODID + ":debugContainer"); + } + + @Override + public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + NBTTagCompound tNBT = aStack.getTagCompound(); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (aPlayer instanceof EntityPlayerMP) { + aStack.stackSize = 1; + if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE != null && metaTE instanceof iElementalInstanceContainer) { + cElementalInstanceStackTree content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); + if (tNBT.hasKey("content")) { + try { + content.putUnifyAll(cElementalInstanceStackTree.fromNBT(tNBT.getCompoundTag("content"))); + } catch (tElementalException e) { + if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); + return true; + } + ((iElementalInstanceContainer) metaTE).purgeOverflow(); + tNBT.removeTag("content"); + tNBT.removeTag("info"); + } else if (content.hasStacks()) { + ((iElementalInstanceContainer) metaTE).purgeOverflow(); + tNBT.setTag("info", content.getInfoNBT()); + tNBT.setTag("content", content.toNBT()); + content.clear(); + } + } + return true; + } + } + return aPlayer instanceof EntityPlayerMP; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(commonValues.tecMark); + aList.add("Container for elemental matter"); + try { + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT.hasKey("info")) { + aList.add("Contains:"); + Collections.addAll(aList, cElementalInstanceStackTree.infoFromNBT(tNBT.getCompoundTag("info"))); + } + } catch (Exception e) { + aList.add("---Unexpected Termination---"); + } + } + + public static void run(){ + INSTANCE=new debug_container_EM(); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/machineTT.java b/src/main/java/com/github/technus/tectech/thing/machineTT.java new file mode 100644 index 0000000000..1aebfe84e3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/machineTT.java @@ -0,0 +1,7 @@ +package com.github.technus.tectech.thing; + +/** + * Created by Tec on 15.03.2017. + */ +public interface machineTT { +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java new file mode 100644 index 0000000000..b02545327d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -0,0 +1,249 @@ +package com.github.technus.tectech.thing.metaTileEntity; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.pipe.iConnectsToEMpipe; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_MufflerElemental; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +import static com.github.technus.tectech.elementalMatter.commonValues.*; +import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; + +/** + * Created by danie_000 on 11.12.2016. + */ +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, iConnectsToEMpipe, machineTT { + private static Textures.BlockIcons.CustomIcon EM_T_SIDES; + private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; + + protected cElementalInstanceStackTree content = new cElementalInstanceStackTree(); + //float lifeTimeMult=1f; + public int postEnergize = 0; + public float overflowMatter = 0f; + public short id = -1; + private byte deathDelay = 2; + + public GT_MetaTileEntity_Hatch_ElementalContainer(int aID, String aName, String aNameRegional, int aTier, String descr) { + super(aID, aName, aNameRegional, aTier, 0, descr); + } + + public GT_MetaTileEntity_Hatch_ElementalContainer(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + @Override + 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"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("postEnergize", postEnergize); + //aNBT.setFloat("lifeTimeMult",lifeTimeMult); + aNBT.setFloat("overflowMatter", overflowMatter); + aNBT.setTag("eM_Stacks", content.toNBT()); + aNBT.setShort("eID", id); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + postEnergize = aNBT.getInteger("postEnergize"); + //lifeTimeMult=aNBT.getFloat("lifeTimeMult"); + overflowMatter = aNBT.getFloat("overflowMatter"); + id = aNBT.getShort("eID"); + try { + content = cElementalInstanceStackTree.fromNBT(aNBT.getCompoundTag("eM_Stacks")); + } catch (tElementalException e) { + if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); + if (content == null) content = new cElementalInstanceStackTree(); + } + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + byte Tick = (byte) (aTick % 20); + if (decayAt == Tick) { + purgeOverflow(); + content.tickContent(postEnergize);//Hatches don't life time mult things + purgeOverflow(); + } else if (overflowAt == Tick) { + if (overflowMatter <= 0) { + deathDelay = 3; + } else { + if (deathDelay == 2) { + if (TecTech.ModConfig.BOOM_ENABLE && TecTech.Rnd.nextInt(10) == 0) + aBaseMetaTileEntity.setOnFire(); + else + TecTech.proxy.broadcast("Container0 FIRE! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + } else if (deathDelay == 1) { + IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); + if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) + tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); + if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) + 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(); + aMetaTileEntity.overflowMatter += overflowMatter; + if (aMetaTileEntity.overflowMatter > aMetaTileEntity.overflowMax) { + if (TecTech.ModConfig.BOOM_ENABLE) tGTTileEntity.doExplosion(V[14]); + else + TecTech.proxy.broadcast("Container1 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + } else overflowMatter = 0F; + } + } else if (deathDelay < 1) { + if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[14]); + else + TecTech.proxy.broadcast("Container2 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + } + deathDelay--; + } + } else if (moveAt == Tick) { + moveAround(aBaseMetaTileEntity); + getBaseMetaTileEntity().setActive(content.hasStacks()); + } + } + } + + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { + } + + @Override + public cElementalInstanceStackTree getContainerHandler() { + return content; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + public int getMaxStacksCount() { + return mTier * 2; + } + + public int getMaxStackSize() { + return mTier * (mTier - 7) * 1000; + } + + @Override + public float purgeOverflow() { + return overflowMatter += content.removeOverflow(getMaxStacksCount(), getMaxStackSize()); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + if (id > 0) { + if (content == null || content.size() == 0) + return new String[]{"ID: " + EnumChatFormatting.AQUA + id, "No Stacks"}; + else { + final String[] lines = content.getElementalInfo(); + final String[] output = new String[lines.length + 1]; + output[0] = "ID: " + EnumChatFormatting.AQUA + id; + System.arraycopy(lines, 0, output, 1, lines.length); + return output; + } + } + if (content == null || content.size() == 0) return new String[]{"No Stacks"}; + return content.getElementalInfo(); + } + + public float updateSlots() { + return purgeOverflow(); + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), + "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), + "Place Overflow Hatch behind,on top or below", + "to provide overflow protection while this block", + "is not attached to multi block.", + "Transport range can be extended in straight", + "line up to 15 blocks with quantum tunnels.", + EnumChatFormatting.AQUA + "Must be painted to work" + }; + } + + @Override + public void onRemoval() { + if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) + if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[15]); + else + TecTech.proxy.broadcast("BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java new file mode 100644 index 0000000000..f58adf41ee --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java @@ -0,0 +1,1410 @@ +package com.github.technus.tectech.thing.metaTileEntity; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +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 gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.*; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_OreDictUnificator; +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.minecraft.world.ChunkPosition; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static com.github.technus.tectech.elementalMatter.commonValues.*; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; + +/** + * Created by danie_000 on 27.10.2016. + */ +public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements machineTT { + protected cElementalInstanceStackTree[] outputEM = new cElementalInstanceStackTree[0]; + + public final static ItemStack[] nothingI = new ItemStack[0]; + public final static FluidStack[] nothingF = new FluidStack[0]; + + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private 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 final float[] eParamsIn = new float[20]; + public final float[] eParamsOut = new float[20]; + public final byte[] eParamsInStatus = new byte[20]; + public final byte[] eParamsOutStatus = new byte[20]; + protected final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6; + + //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, eDismatleBoom = false; + public byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3; + + private long eMaxAmpereFlow = 0; + private long maxEUinputMin = 0, maxEUinputMax = 0; + public long eAmpereFlow = 1; + + //init param states in constructor, or implement it in checkrecipe/outputfunction + + //METHODS TO OVERRIDE - this 3 below + checkMachine + + //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 EM_checkRecipe(ItemStack itemStack) { + return false; + } + //My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! + + public void EM_checkParams() { + } + //update status of parameters in guis and "machine state" + + public void EM_outputFunction() { + } + // based on "machine state" do output, + // this must move to output EM things and can also modify output items/fluids/EM, remaining EM is NOT overflowed. + //(Well it can be overflowed if machine didn't finished, soft-hammered/disabled/not enough EU) + + //RATHER LEAVE ALONE Section + + 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 + 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); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; + } + + @Override + public final byte getTileEntityBaseType() { + return 3; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + + //Fix supermethod shit. + if (mOutputItems != null) + aNBT.setInteger("eItemsOut", mOutputItems.length); + if (mOutputFluids != null) + aNBT.setInteger("eFluidsOut", mOutputFluids.length); + + aNBT.setLong("eMaxEUmin", maxEUinputMin); + aNBT.setLong("eMaxEUmax", maxEUinputMax); + aNBT.setLong("eRating", eAmpereFlow); + aNBT.setLong("eMaxA", eMaxAmpereFlow); + 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", eDismatleBoom); + + 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 < 20; i++) + paramI.setFloat(Integer.toString(i), eParamsIn[i]); + aNBT.setTag("eParamsIn", paramI); + + NBTTagCompound paramO = new NBTTagCompound(); + for (int i = 0; i < 20; i++) + paramO.setFloat(Integer.toString(i), eParamsOut[i]); + aNBT.setTag("eParamsOut", paramO); + + NBTTagCompound paramIs = new NBTTagCompound(); + for (int i = 0; i < 20; i++) + paramIs.setByte(Integer.toString(i), eParamsInStatus[i]); + aNBT.setTag("eParamsInS", paramIs); + + NBTTagCompound paramOs = new NBTTagCompound(); + for (int i = 0; i < 20; 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"); + eCertainMode = aNBT.getByte("eCertainM"); + eCertainStatus = aNBT.getByte("eCertainS"); + minRepairStatus = aNBT.getByte("eMinRepair"); + eParameters = aNBT.getBoolean("eParam"); + ePowerPass = aNBT.getBoolean("ePass"); + eSafeVoid = aNBT.getBoolean("eVoid"); + eDismatleBoom = aNBT.getBoolean("eBoom"); + + //Fix supermethod shit. + mOutputItems = new ItemStack[aNBT.getInteger("eItemsOut")]; + for (int i = 0; i < mOutputItems.length; i++) + mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + mOutputFluids = new FluidStack[aNBT.getInteger("eFluidsOut")]; + 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 cElementalInstanceStackTree[outputLen]; + for (int i = 0; i < outputEM.length; i++) + try { + outputEM[i] = cElementalInstanceStackTree.fromNBT( + aNBT.getCompoundTag("outputEM").getCompoundTag(Integer.toString(i))); + } catch (tElementalException e) { + if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); + outputEM[i] = new cElementalInstanceStackTree(); + } + } else outputEM = new cElementalInstanceStackTree[0]; + + NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); + for (int i = 0; i < eParamsIn.length; i++) + eParamsIn[i] = paramI.getFloat(Integer.toString(i)); + + NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); + for (int i = 0; i < eParamsOut.length; i++) + eParamsOut[i] = paramO.getFloat(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)); + } + + @Override + public final long maxEUStore() { + return (maxEUinputMin * eMaxAmpereFlow) << 3; + } + + @Override + public final long getMinimumStoredEU() { + return maxEUStore() >> 1; + } + + @Override + public final long maxAmperesIn() { + return 0L; + } + + @Override + public final long maxAmperesOut() { + return 0L; + } + + @Override + public int getPollutionPerTick(ItemStack itemStack) { + return 0; + } + + @Override + public final void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (mEfficiency < 0) mEfficiency = 0; + if (--mUpdate == 0 || --mStartUpCheck == 0) { + + 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_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(); + + mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); + + if (!mMachine) + if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock(); + else if (outputEM != null) + for (cElementalInstanceStackTree tree : outputEM) + if (tree.hasStacks()) { + explodeMultiblock(); + break; + } + + 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++; + + 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); + } else { + maxEUinputMin = 0; + maxEUinputMax = 0; + eMaxAmpereFlow = 0; + this.setEUVar(0); + } + } + + if (mStartUpCheck < 0) {//E + if (mMachine) {//S + final byte Tick = (byte) (aTick % 20); + if (multiPurge1At == Tick || multiPurge2At == Tick) + purgeAll(); + else if (multiCheckAt == 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.isRecipeInputEqual(true); + 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 (moveAt == Tick && eSafeVoid) { + for (GT_MetaTileEntity_Hatch_MufflerElemental voider : eMufflerHatches) { + if (voider.overflowMax < voider.overflowMatter) continue; + float remaining = voider.overflowMax - voider.overflowMatter; + for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { + for (cElementalInstanceStack instance : in.getContainerHandler().values()) { + int qty = (int) Math.floor(remaining / instance.definition.getMass()); + if (qty > 0) { + qty = Math.min(qty, instance.amount); + voider.overflowMatter += instance.definition.getMass() * qty; + in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + } + } + } + for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { + for (cElementalInstanceStack instance : out.getContainerHandler().values()) { + int qty = (int) Math.floor(remaining / instance.definition.getMass()); + if (qty > 0) { + qty = Math.min(qty, instance.amount); + voider.overflowMatter += instance.definition.getMass() * qty; + out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); + } + } + } + //in case some weird shit happened here, it will still be safe + if (voider.overflowMatter > voider.overflowMax) voider.overflowMatter = voider.overflowMax; + } + } + + if (getRepairStatus() >= minRepairStatus) {//S + if (multiCheckAt == Tick) + paramsUpdate(); + + if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start + if (onRunningTick(mInventory[1])) {//Compute EU + if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) + stopMachine(); + + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && recipeAt == Tick) {//progress increase and done + paramsUpdate(); + EM_outputFunction(); + if (mOutputItems != null) for (ItemStack tStack : mOutputItems) + if (tStack != null) + addOutput(tStack); + + if (mOutputFluids != null && mOutputFluids.length == 1) + for (FluidStack tStack : mOutputFluids) + if (tStack != null) + addOutput(tStack); + else if (mOutputFluids != null && mOutputFluids.length > 1) + addFluidOutputs(mOutputFluids); + updateSlots(); + mOutputItems = null; + mOutputFluids = null; + outputEM = new cElementalInstanceStackTree[0]; + 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))); + } + updateSlots(); + } + } + } + } else { + if (recipeAt == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { + if (aBaseMetaTileEntity.isAllowedToWork()) { + if (checkRecipe(mInventory[1])) { + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + } + updateSlots(); + } + } + } + + {//DO ONCE + 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 + (euVar >> 7), 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 + (euVar >> 7), false)) + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + } + } else {//not repaired + stopMachine(); + } + } else {//not machine + stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & -512) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64) | ((eCertainStatus == 0) ? 0 : 128) | (eParameters ? 0 : 256)); + aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); + boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; + for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) + aMuffler.getBaseMetaTileEntity().setActive(active); + } + } + + @Deprecated + @Override + public final int getAmountOfOutputs() { + return 0; + } + + private void addFluidOutputs(FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; ++i) { + if (this.mOutputHatches.size() > i && this.mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity((MetaTileEntity) this.mOutputHatches.get(i))) { + this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 10000; + } + + @Override + public int getIdealStatus() { + return super.getIdealStatus() + 2; + } + + @Override + public int getRepairStatus() { + return super.getRepairStatus() + ((eCertainStatus == 0) ? 1 : 0) + (this.eParameters ? 1 : 0); + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (this.mEUt > 0) { + this.EMaddEnergyOutput((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + return true; + } else if (this.mEUt < 0 && !this.EMdrainEnergyInput((long) (-this.mEUt) * getMaxEfficiency(aStack) / (long) Math.max(1000, this.mEfficiency), eAmpereFlow)) { + this.stopMachine(); + return false; + } else return true; + } + + @Deprecated + @Override + public final boolean addEnergyOutput(long EU) { + if (EU <= 0L) return true; + for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) + if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) + return true; + for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) + if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) + return true; + return false; + } + + //new method + public final boolean EMaddEnergyOutput(long EU, long Amperes) { + if (EU <= 0L || Amperes <= 0) return true; + long euVar = EU * Amperes; + long diff; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.maxEUOutput() < EU) explodeMultiblock(); + diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); + if (diff > 0) { + if (euVar > diff) { + tHatch.setEUVar(tHatch.maxEUStore()); + euVar -= diff; + } else if (euVar <= diff) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + return true; + } + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.maxEUOutput() < EU) explodeMultiblock(); + diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); + if (diff > 0) { + if (euVar > diff) { + tHatch.setEUVar(tHatch.maxEUStore()); + euVar -= diff; + } else if (euVar <= diff) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + return true; + } + } + } + } + return false; + } + + @Deprecated + @Override + public final boolean drainEnergyInput(long EU) { + if (EU <= 0L) return true; + for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + return true; + for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + return true; + return false; + } + + //new method + public final boolean EMdrainEnergyInput(long EU, long Amperes) { + if (EU <= 0L || Amperes <= 0) return true; + long euVar = EU * Amperes; + if (euVar > getEUVar() || + EU > maxEUinputMax || + (euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) { + if (TecTech.ModConfig.DEBUG_MODE) { + TecTech.Logger.debug("OMG1 " + euVar + " " + getEUVar() + " " + (euVar > getEUVar())); + TecTech.Logger.debug("OMG2 " + EU + " " + maxEUinputMax + " " + (EU > maxEUinputMax)); + TecTech.Logger.debug("OMG3 " + euVar + " " + eMaxAmpereFlow); + TecTech.Logger.debug("OMG4 " + ((euVar - 1) / maxEUinputMin + 1) + " " + eMaxAmpereFlow + " " + ((euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); + } + return false; + } + //sub eu + setEUVar(getEUVar() - euVar); + return true; + } + + //new method + public final boolean EMoverclockAndPutValuesIn(long EU, int time) { + if (EU == 0) { + mEUt = 0; + mMaxProgresstime = time; + return true; + } + long tempEUt = EU < V[1] ? V[1] : EU; + long tempTier = maxEUinputMax >> 2; + while (tempEUt < tempTier) { + tempEUt <<= 2; + time >>= 1; + EU = time == 0 ? EU >> 1 : EU << 2;//U know, if the time is less than 1 tick make the machine use less power + } + if (EU > Integer.MAX_VALUE || EU < Integer.MIN_VALUE) { + mEUt = Integer.MAX_VALUE - 1; + mMaxProgresstime = Integer.MAX_VALUE - 1; + return false; + } + mEUt = (int) EU; + mMaxProgresstime = time == 0 ? 1 : time; + return true; + }//Use in EM check recipe return statement if you want overclocking + + @Override + public final long getMaxInputVoltage() { + long rVoltage = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); + return rVoltage; + } + + //new Method + public final int getMaxEnergyInputTier() { + return GT_Utility.getTier(maxEUinputMax); + } + + //new Method + public final int getMinEnergyInputTier() { + return GT_Utility.getTier(maxEUinputMin); + } + + @Override + public final void stopMachine() { + mOutputItems = null; + mOutputFluids = null; + //mEUt = 0; + mEfficiency = 0; + mProgresstime = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + getBaseMetaTileEntity().disableWorking(); + + float mass = 0; + if (outputEM == null) return; + for (cElementalInstanceStackTree tree : outputEM) + mass += tree.getMass(); + if (mass > 0) { + if (eMufflerHatches.size() < 1) explodeMultiblock(); + mass /= eMufflerHatches.size(); + for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { + dump.overflowMatter += mass; + if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); + } + } + outputEM = null; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + @Override + public void updateSlots() { + super.updateSlots(); + purgeAll(); + } + + private void purgeAll() { + float mass = 0; + for (GT_MetaTileEntity_Hatch_InputElemental tHatch : eInputHatches) { + if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + mass += tHatch.overflowMatter; + tHatch.overflowMatter = 0; + } + for (GT_MetaTileEntity_Hatch_OutputElemental tHatch : eOutputHatches) { + if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + mass += tHatch.overflowMatter; + tHatch.overflowMatter = 0; + } + if (mass > 0) { + if (eMufflerHatches.size() < 1) { + explodeMultiblock(); + return; + } + mass /= eMufflerHatches.size(); + for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { + dump.overflowMatter += mass; + if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); + } + } + } + + public void cleanHatchContent(GT_MetaTileEntity_Hatch_ElementalContainer target) { + float mass = target.getContainerHandler().getMass(); + if (mass > 0) { + if (eMufflerHatches.size() < 1) explodeMultiblock(); + mass /= eMufflerHatches.size(); + for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { + dump.overflowMatter += mass; + if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); + } + } + } + + @Override + public final boolean checkRecipe(ItemStack itemStack) {//do recipe checks, based on "machine content and state" + paramsUpdate(); + return EM_checkRecipe(itemStack); + } + + private void paramsUpdate() { + for (GT_MetaTileEntity_Hatch_Param param : eParamHatches) { + int paramID = param.param; + if (paramID < 0) continue; + eParamsIn[paramID] = param.value1f; + eParamsIn[paramID + 10] = param.value2f; + param.input1f = eParamsOut[paramID]; + param.input2f = eParamsOut[paramID + 10]; + } + EM_checkParams(); + for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) { + eCertainStatus = uncertainty.update(eCertainMode); + } + } + + @Override + public boolean isCorrectMachinePart(ItemStack itemStack) { + return true; + } + + @Override + public int getDamageToComponent(ItemStack itemStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack itemStack) { + return false; + } + + @Override + public void explodeMultiblock() {//BEST METHOD EVER!!! + if (!TecTech.ModConfig.BOOM_ENABLE) { + TecTech.proxy.broadcast("Multi Explode BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); + StackTraceElement[] ste = Thread.currentThread().getStackTrace(); + TecTech.proxy.broadcast("Multi Explode BOOM! " + ste[2].toString()); + return; + } + GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 600000); + mInventory[1] = null; + for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : eParamHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : eInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : eOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : eMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : eEnergyMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + for (MetaTileEntity tTileEntity : eUncertainHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + for (MetaTileEntity tTileEntity : eDynamoMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); + getBaseMetaTileEntity().doExplosion(V[15]); + } + + @Override + public final boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) + return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) + return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) + return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) + return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) + return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) + return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) + return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) + 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_Param) + 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_EnergyMulti) + return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + return false; + } + + @Override + public final boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); + } + return false; + } + + @Override + public final boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); + } + return false; + } + + @Override + public final boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); + } + return false; + } + + @Deprecated + @Override + public final boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + } + return false; + } + + @Deprecated + @Override + public final boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { + ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + } + return false; + } + + //New Method + public final boolean addEnergyIOToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { + ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addElementalInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addElementalOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addClassicInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); + return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addClassicOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addParametrizerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addUncertainToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); + } + return false; + } + + @Override + public final boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); + } + return false; + } + + //NEW METHOD + public final boolean addClassicMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + return false; + } + + @Override + public String[] getInfoData() {//TODO Do it + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + + return new String[]{ + "Progress:", + EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + "Energy Hatches:", + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU", + (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + + EnumChatFormatting.RED + Integer.toString(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", + "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier()] + EnumChatFormatting.RESET + + " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", + "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid + }; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + //Check Machine Structure based on string array array, ond offset of the controller + public static boolean stuctureCheck(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, + IGregTechTileEntity aBaseMetaTileEntity) { + //TE Rotation + byte facing = aBaseMetaTileEntity.getFrontFacing(); + + int x, y, z, a, c;//b is y no matter what + + //perform your duties + c = -depthOffset; + for (String[] _structure : structure) {//front to back + y = verticalOffset; + for (String __structure : _structure) {//top to bottom + a = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block > '`') {//small characters allow to skip check a-1 skip, b-2 skips etc. + a += block - '`'; + } else { + //get x y z from rotation + switch (facing) {//translation + case 4: + x = c; + z = a; + break; + case 3: + x = a; + z = -c; + break; + case 5: + x = -c; + z = -a; + break; + case 2: + x = -a; + z = c; + break; + default: + return false; + } + //Check block + switch (block) { + case '-'://must be air + if (!aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; + break; + case '+'://must not be air + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; + break; + default: {//check for block (countable) + int pointer = block - '0'; + //countable air -> net.minecraft.block.BlockAir + if (aBaseMetaTileEntity.getBlockOffset(x, y, z) != blockType[pointer]) { + if (TecTech.ModConfig.DEBUG_MODE) + TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + aBaseMetaTileEntity.getBlockOffset(x, y, z) + " " + blockType[pointer]); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != blockMeta[pointer]) { + if (TecTech.ModConfig.DEBUG_MODE) + TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + aBaseMetaTileEntity.getMetaIDOffset(x, y, z) + " " + blockMeta[pointer]); + return false; + } + } + } + a++;//block in horizontal layer + } + } + y--;//horizontal layer + } + c++;//depth + } + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Nothing special just override me." + }; + } + + @Override + public void onRemoval() { + try { + if (eOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) + hatch_elemental.id = -1; + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) + hatch_elemental.id = -1; + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) + hatch.getBaseMetaTileEntity().setActive(false); + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) + hatch.getBaseMetaTileEntity().setActive(false); + } + if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock(); + else if (outputEM != null) + for (cElementalInstanceStackTree output : outputEM) + if (output.hasStacks()) { + explodeMultiblock(); + return; + } + } catch (Exception e) { + if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); + } + } + + protected boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { + if (!GregTech_API.sPostloadFinished) return false; + if (requiredFluidInputs.length > 0 && givenFluidInputs == null) return false; + int amt; + for (FluidStack tFluid : requiredFluidInputs) + if (tFluid != null) { + boolean temp = true; + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aFluid.amount; + if (amt < 1) { + temp = false; + break; + } + } + if (temp) return false; + } + + if (requiredInputs.length > 0 && givenInputs == null) return false; + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + boolean temp = true; + for (ItemStack aStack : givenInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aStack.stackSize; + if (amt < 1) { + temp = false; + break; + } + } + } + if (temp) return false; + } + } + + if (aDecreaseStacksizeBySuccess) { + if (givenFluidInputs != null) { + for (FluidStack tFluid : requiredFluidInputs) { + if (tFluid != null) { + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) { + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + aFluid.amount -= amt; + break; + } + if (aFluid.amount < amt) { + amt -= aFluid.amount; + aFluid.amount = 0; + } else { + aFluid.amount -= amt; + amt = 0; + break; + } + } + } + } + } + } + + if (givenInputs != null) { + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + for (ItemStack aStack : givenInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if (aDontCheckStackSizes) { + aStack.stackSize -= amt; + break; + } + if (aStack.stackSize < amt) { + amt -= aStack.stackSize; + aStack.stackSize = 0; + } else { + aStack.stackSize -= amt; + amt = 0; + break; + } + } + } + } + } + } + } + + return true; + } + + /** + * finds a Recipe matching the aFluid and ItemStack Inputs. + * + * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs + * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage + * @param aFluids the Fluid Inputs + * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. + * @param aInputs the Item Inputs + * @return the Recipe it has found or null for no matching Recipe + */ + + //protected static GT_Recipe findRecipe(boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + // // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. + // // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. + // if (GregTech_API.sPostloadFinished) { + // if (mMinimalInputFluids > 0) { + // if (aFluids == null) return null; + // int tAmount = 0; + // for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; + // if (tAmount < mMinimalInputFluids) return null; + // } + // if (mMinimalInputItems > 0) { + // if (aInputs == null) return null; + // int tAmount = 0; + // for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; + // if (tAmount < mMinimalInputItems) return null; + // } + // } + // // Unification happens here in case the Input isn't already unificated. + // if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + // // Check the Recipe which has been used last time in order to not have to search for it again, if possible. + // if (aRecipe != null) + // if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + // return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; + // // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. + // if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) + // if (tStack != null) { + // Collection + // tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); + // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) + // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + // tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); + // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) + // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + // } + // // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. + // if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) + // if (aFluid != null) { + // Collection + // tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); + // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) + // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + // } + // // And nothing has been found. + // return null; + //} +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java new file mode 100644 index 0000000000..7cd12cc63f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +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 net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 16.12.2016. + */ +public class GT_MetaTileEntity_Hatch_DynamoMulti extends GT_MetaTileEntity_Hatch implements machineTT { + public final int Amperes; + + public GT_MetaTileEntity_Hatch_DynamoMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { + super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Extractor for Multiblocks"); + Amperes = aAmp; + } + + public GT_MetaTileEntity_Hatch_DynamoMulti(String aName, int aTier, int aAmp, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + Amperes = aAmp; + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; + } + + @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 isEnetOutput() { + return true; + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512 * Amperes; + } + + @Override + public long maxEUOutput() { + return V[mTier]; + } + + @Override + public long maxEUStore() { + return 512L + V[mTier] * 4L * Amperes; + } + + @Override + public long maxAmperesOut() { + return Amperes; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_DynamoMulti(mName, mTier, Amperes, mDescription, mTextures); + } + + @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 String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription + //"Amperes Out: "+ EnumChatFormatting.AQUA+Amperes+" A" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java new file mode 100644 index 0000000000..c86bfa71a4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -0,0 +1,115 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +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 net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 16.12.2016. + */ +public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch implements machineTT { + public final int Amperes; + + public GT_MetaTileEntity_Hatch_EnergyMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { + super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Injector for Multiblocks"); + Amperes = aAmp; + } + + public GT_MetaTileEntity_Hatch_EnergyMulti(String aName, int aTier, int aAmp, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + Amperes = aAmp; + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; + } + + @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 isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512L * Amperes; + } + + @Override + public long maxEUInput() { + return V[mTier]; + } + + @Override + public long maxEUStore() { + return 512L + V[mTier] * 4L * Amperes; + } + + @Override + public long maxAmperesIn() { + return Amperes + (Amperes >> 2); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_EnergyMulti(mName, mTier, Amperes, mDescription, mTextures); + } + + @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 String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + "Amperes In: " + EnumChatFormatting.AQUA + maxAmperesIn() + " A" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java new file mode 100644 index 0000000000..3508c0e0f0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java @@ -0,0 +1,44 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_Hatch_ElementalContainer; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_InputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { + public GT_MetaTileEntity_Hatch_InputElemental(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Elemental Input for Multiblocks (" + 1000 * aTier * (aTier - 7) + "U, " + aTier * 2 + " stacks)"); + } + + public GT_MetaTileEntity_Hatch_InputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_InputElemental(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return false; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean canConnect(byte side) { + return isInputFacing(side); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java new file mode 100644 index 0000000000..f10a6bf97e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java @@ -0,0 +1,173 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +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.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.EnumSkyBlock; + +import static com.github.technus.tectech.elementalMatter.commonValues.disperseAt; +import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static gregtech.api.enums.GT_Values.V; +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 implements machineTT { + private static Textures.BlockIcons.CustomIcon EM_T_SIDES; + private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; + private static Textures.BlockIcons.CustomIcon MufflerEM; + public float overflowMatter = 0f; + public final float overflowMax; + public final float overflowDisperse; + + 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); + } + + 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); + } + + @Override + 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"); + } + + @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(Textures.BlockIcons.OVERLAY_MUFFLER)}; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c^2", + "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c^2)/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, 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) == disperseAt) { + 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()); + } + } 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.particles(getBaseMetaTileEntity(), getBaseMetaTileEntity().getFrontFacing()); + } + super.onPostTick(aBaseMetaTileEntity, aTick); + //DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + return new String[]{ + "Contained mass:", + EnumChatFormatting.RED + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c^2 /", + EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c^2", + "Mass Disposal speed: " + EnumChatFormatting.BLUE + Double.toString(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c^2)/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()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java new file mode 100644 index 0000000000..c8e65b6451 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java @@ -0,0 +1,72 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_Hatch_ElementalContainer; +import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; + +/** + * Created by danie_000 on 27.10.2016. + */ +public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { + public GT_MetaTileEntity_Hatch_OutputElemental(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Elemental Output for Multiblocks (" + 1000 * aTier * (aTier - 7) + "U, " + aTier * 2 + " stacks)"); + } + + public GT_MetaTileEntity_Hatch_OutputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_OutputElemental(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isInputFacing(byte aSide) { + return false; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { + byte color = getBaseMetaTileEntity().getColorization(); + if (color < 0) return; + byte front = aBaseMetaTileEntity.getFrontFacing(); + byte opposite = GT_Utility.getOppositeSide(getBaseMetaTileEntity().getFrontFacing()); + for (byte dist = 1; dist < 16; dist++) { + IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSideAndDistance(front, dist); + if (tGTTileEntity != null && tGTTileEntity.getColorization() == color) { + IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); + if (aMetaTileEntity != null) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && + opposite == aMetaTileEntity.getBaseMetaTileEntity().getFrontFacing()) { + ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); + ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); + content.clear(); + return; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Pipe_EM) { + if (((GT_MetaTileEntity_Pipe_EM) aMetaTileEntity).connectionCount > 2) return; + } else return; + } else return; + } else return; + } + } + + @Override + public boolean canConnect(byte side) { + return isOutputFacing(side); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java new file mode 100644 index 0000000000..51f82eb866 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -0,0 +1,183 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Param; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Param; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 15.12.2016. + */ +public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch implements machineTT { + public int exponent = 0; + public int value2 = 0; + public int value1 = 0; + public int param = -1; + public float value1f = 0; + public float value2f = 0; + public float input1f = 0; + public float input2f = 0; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static Textures.BlockIcons.CustomIcon ScreenOFF; + + public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks"); + } + + public GT_MetaTileEntity_Hatch_Param(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/PARAM"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/PARAM_ACTIVE"); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; + } + + //@Override + //public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + // if (aBaseMetaTileEntity.isClientSide() && (aTick % 20L == 0L)) { + // //refresh casing on state change + // int Xpos = aBaseMetaTileEntity.getXCoord(); + // int Ypos = aBaseMetaTileEntity.getYCoord(); + // int Zpos = aBaseMetaTileEntity.getZCoord(); + // try { + // aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(Xpos , Ypos, Zpos , Xpos , Ypos, Zpos ); + // } catch (Exception e) {} + // } + // super.onPostTick(aBaseMetaTileEntity, aTick); + //} + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_MetaTileEntity_Hatch_Param(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + return new String[]{ + "Parameter ID: " + EnumChatFormatting.GREEN + param, + "Value 1: " + EnumChatFormatting.AQUA + value1f, + "Value 2: " + EnumChatFormatting.BLUE + value2f, + "Input 1: " + EnumChatFormatting.GOLD + input1f, + "Input 2: " + EnumChatFormatting.YELLOW + input2f + }; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @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; + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mEXP", exponent); + aNBT.setInteger("mV2", value2); + aNBT.setInteger("mV1", value1); + aNBT.setInteger("mParam", param); + //aNBT.setFloat("mI1",input1f);//no need to store this. + //aNBT.setFloat("mI2",input2f); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + exponent = aNBT.getInteger("mEXP"); + value2 = aNBT.getInteger("mV2"); + value1 = aNBT.getInteger("mV1"); + param = aNBT.getInteger("mParam"); + value1f = (float) (value1 * Math.pow(2, exponent)); + value2f = (float) (value2 * Math.pow(2, exponent)); + //input1f=aNBT.getFloat("mI1"); + //input2f=aNBT.getFloat("mI2"); + } + + @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 boolean isLiquidInput(byte aSide) { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=M*C^2" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java new file mode 100644 index 0000000000..38d4529847 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -0,0 +1,297 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Uncertainty; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Uncertainty; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_UncertaintyAdv; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 15.12.2016. + */ +public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch implements machineTT { + private static Textures.BlockIcons.CustomIcon ScreenON; + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static float errorMargin = 0.05f; + public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; + public byte selection = -1, mode = 0, status = -128; + + public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?"); + regenerate(); + } + + public GT_MetaTileEntity_Hatch_Uncertainty(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + regenerate(); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/UC"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/UC_ACTIVE"); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + if (mTier > 6) return new GT_GUIContainer_UncertaintyAdv(aPlayerInventory, aBaseMetaTileEntity); + return new GT_GUIContainer_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && (aTick & 15) == 0) { + shift(); + compute(); + if (mode == 0) aBaseMetaTileEntity.setActive(false); + else aBaseMetaTileEntity.setActive(true); + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_MetaTileEntity_Hatch_Uncertainty(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + return new String[]{ + "Status: " + EnumChatFormatting.GOLD + status + }; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @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; + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("mSel", selection); + aNBT.setByte("mMode", mode); + aNBT.setByte("mStatus", status); + NBTTagCompound mat = new NBTTagCompound(); + for (int i = 0; i < 16; i++) + mat.setShort(Integer.toString(i), matrix[i]); + aNBT.setTag("mMat", mat); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + selection = aNBT.getByte("mSel"); + mode = aNBT.getByte("mMode"); + status = aNBT.getByte("mStatus"); + NBTTagCompound mat = aNBT.getCompoundTag("mMat"); + for (int i = 0; i < 16; i++) + matrix[i] = mat.getShort(Integer.toString(i)); + } + + @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 boolean isLiquidInput(byte aSide) { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + mDescription, + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Schrödinger equation in a box" + }; + } + + private float massOffset(int sideLenY, int sideLenX, short... masses) { + int mass = 0; + int massI = 0, massJ = 0; + for (int i = 0; i < sideLenY; i++) { + for (int j = 0; j < sideLenY * sideLenX; j += sideLenY) { + mass += masses[i + j]; + massI += ((float) i - ((float) sideLenY / 2f) + .5f) * masses[i + j]; + massJ += ((float) (j / sideLenY) - ((float) sideLenX / 2f) + .5f) * masses[i + j]; + } + } + return ((Math.abs(massI / (float) mass) / (float) sideLenY) + (Math.abs(massJ / (float) mass)) / (float) sideLenX); + } + + public void regenerate() { + for (int i = 0; i < matrix.length; i++) + matrix[i] = (short) TecTech.Rnd.nextInt(1000); + } + + public byte compute() { + int result = 0; + switch (mode) { + case 1://ooo oxo ooo + result = (massOffset(4, 4, matrix) < errorMargin) ? 0 : 1; + break; + case 2://ooo xox ooo + result += (massOffset(4, 2, + matrix[0], matrix[4], + matrix[1], matrix[5], + matrix[2], matrix[6], + matrix[3], matrix[7]) < errorMargin) ? 0 : 1; + result += (massOffset(4, 2, + matrix[8], matrix[12], + matrix[9], matrix[13], + matrix[10], matrix[14], + matrix[11], matrix[15]) < errorMargin) ? 0 : 2; + break; + case 3://oxo xox oxo + result += (massOffset(2, 4, + matrix[0], matrix[4], matrix[8], matrix[12], + matrix[1], matrix[5], matrix[9], matrix[13]) < errorMargin) ? 0 : 1; + result += (massOffset(4, 2, + matrix[0], matrix[4], + matrix[1], matrix[5], + matrix[2], matrix[6], + matrix[3], matrix[7]) < errorMargin) ? 0 : 2; + result += (massOffset(4, 2, + matrix[8], matrix[12], + matrix[9], matrix[13], + matrix[10], matrix[14], + matrix[11], matrix[15]) < errorMargin) ? 0 : 4; + result += (massOffset(2, 4, + matrix[2], matrix[6], matrix[10], matrix[14], + matrix[3], matrix[7], matrix[11], matrix[15]) < errorMargin) ? 0 : 8; + break; + case 4://xox ooo xox + result += (massOffset(2, 2, + matrix[0], matrix[4], + matrix[1], matrix[5]) < errorMargin) ? 0 : 1; + result += (massOffset(2, 2, + matrix[8], matrix[12], + matrix[9], matrix[13]) < errorMargin) ? 0 : 2; + result += (massOffset(2, 2, + matrix[2], matrix[6], + matrix[3], matrix[7]) < errorMargin) ? 0 : 4; + result += (massOffset(2, 2, + matrix[10], matrix[14], + matrix[11], matrix[15]) < errorMargin) ? 0 : 8; + break; + case 5://xox oxo xox + result += (massOffset(2, 2, + matrix[0], matrix[4], + matrix[1], matrix[5]) < errorMargin) ? 0 : 1; + result += (massOffset(2, 2, + matrix[8], matrix[12], + matrix[9], matrix[13]) < errorMargin) ? 0 : 2; + result += (massOffset(4, 4, matrix) < errorMargin) ? 0 : 4; + result += (massOffset(2, 2, + matrix[2], matrix[6], + matrix[3], matrix[7]) < errorMargin) ? 0 : 8; + result += (massOffset(2, 2, + matrix[10], matrix[14], + matrix[11], matrix[15]) < errorMargin) ? 0 : 16; + break; + } + return status = (byte) result; + } + + private void shift() {//TODO MAKE IT MORE EVIL + final int i = TecTech.Rnd.nextInt(16), j = TecTech.Rnd.nextInt(2); + matrix[i] += (((matrix[i] & 1) == 0) ? 2 : -2) * j; + switch (matrix[i]) { + case 1002: + matrix[i] -= 3; + break; + case 1001: + matrix[i] -= 1; + break; + case -1: + matrix[i] += 1; + break; + case -2: + matrix[i] += 3; + break; + } + } + + public byte update(int newMode) { + if (newMode == mode) return mode; + if (newMode < 0 || newMode > 5) newMode = 0; + mode = (byte) newMode; + regenerate(); + compute(); + return status; + } + + //@Override + //public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + // if(aSide == this.getBaseMetaTileEntity().getFrontFacing()) { + // changeMode(++mode); + // GT_Utility.sendChatToPlayer(aPlayer, "Equation mode: "+mode); + // } + //} +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java new file mode 100644 index 0000000000..c384552c25 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -0,0 +1,208 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +public final class GT_Container_Param extends GT_ContainerMetaTile_Machine { + public int exponent = 0; + public int value2 = 0; + public int value1 = 0; + public int param = 0; + public float value2f = 0; + public float value1f = 0; + public float input1f = 0; + private int input1Bits = 0; + public float input2f = 0; + private int input2Bits = 0; + + public GT_Container_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + boolean doStuff = true; + if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); + switch (aSlotIndex) { + case 0: + paramH.param -= (aShifthold == 1 ? 512 : 64); + break; + case 1: + paramH.value1 -= (aShifthold == 1 ? 512 : 64); + break; + case 2: + paramH.value2 -= (aShifthold == 1 ? 512 : 64); + break; + case 3: + paramH.exponent -= (aShifthold == 1 ? 16 : 8); + break; + case 4: + paramH.param -= (aShifthold == 1 ? 16 : 1); + break; + case 5: + paramH.value1 -= (aShifthold == 1 ? 16 : 1); + break; + case 6: + paramH.value2 -= (aShifthold == 1 ? 16 : 1); + break; + case 7: + paramH.exponent -= (aShifthold == 1 ? 4 : 1); + break; + case 8: + paramH.param += (aShifthold == 1 ? 512 : 64); + break; + case 9: + paramH.value1 += (aShifthold == 1 ? 512 : 64); + break; + case 10: + paramH.value2 += (aShifthold == 1 ? 512 : 64); + break; + case 11: + paramH.exponent += (aShifthold == 1 ? 16 : 8); + break; + case 12: + paramH.param += (aShifthold == 1 ? 16 : 1); + break; + case 13: + paramH.value1 += (aShifthold == 1 ? 16 : 1); + break; + case 14: + paramH.value2 += (aShifthold == 1 ? 16 : 1); + break; + case 15: + paramH.exponent += (aShifthold == 1 ? 4 : 1); + break; + default: + doStuff = false; + } + if (doStuff) { + if (paramH.param > 9) paramH.param = 9; + if (paramH.param < -1) paramH.param = -1; + paramH.value1f = (float) (paramH.value1 * Math.pow(2, paramH.exponent)); + paramH.value2f = (float) (paramH.value2 * Math.pow(2, paramH.exponent)); + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; + this.value1 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1; + this.value2 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value2; + this.exponent = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).exponent; + this.input1Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1f); + this.input2Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input2f); + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); + var1.sendProgressBarUpdate(this, 101, this.param >>> 16); + var1.sendProgressBarUpdate(this, 102, this.value1 & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, this.value1 >>> 16); + var1.sendProgressBarUpdate(this, 104, this.value2 & 0xFFFF); + var1.sendProgressBarUpdate(this, 105, this.value2 >>> 16); + var1.sendProgressBarUpdate(this, 106, this.exponent & 0xFFFF); + var1.sendProgressBarUpdate(this, 107, this.exponent >>> 16); + var1.sendProgressBarUpdate(this, 108, this.input1Bits & 0xFFFF); + var1.sendProgressBarUpdate(this, 109, this.input1Bits >>> 16); + var1.sendProgressBarUpdate(this, 110, this.input2Bits & 0xFFFF); + var1.sendProgressBarUpdate(this, 111, this.input2Bits >>> 16); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.param = (this.param & 0xFFFF0000 | par2); + return; + case 101: + this.param = (this.param & 0xFFFF | par2 << 16); + return; + case 102: + this.value1 = (this.value1 & 0xFFFF0000 | par2); + break; + case 103: + this.value1 = (this.value1 & 0xFFFF | par2 << 16); + break; + case 104: + this.value2 = (this.value2 & 0xFFFF0000 | par2); + break; + case 105: + this.value2 = (this.value2 & 0xFFFF | par2 << 16); + break; + case 106: + this.exponent = (this.exponent & 0xFFFF0000 | par2); + break; + case 107: + this.exponent = (this.exponent & 0xFFFF | par2 << 16); + break; + case 108: + this.input1Bits = (this.input1Bits & 0xFFFF0000 | par2); + this.input1f = Float.intBitsToFloat(input1Bits); + return; + case 109: + this.input1Bits = (this.input1Bits & 0xFFFF | par2 << 16); + this.input1f = Float.intBitsToFloat(input1Bits); + return; + case 110: + this.input2Bits = (this.input2Bits & 0xFFFF0000 | par2); + this.input2f = Float.intBitsToFloat(input2Bits); + return; + case 111: + this.input2Bits = (this.input2Bits & 0xFFFF | par2 << 16); + this.input2f = Float.intBitsToFloat(input2Bits); + return; + default: + return; + } + this.value1f = (float) (this.value1 * Math.pow(2, this.exponent)); + this.value2f = (float) (this.value2 * Math.pow(2, this.exponent)); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java new file mode 100644 index 0000000000..68b4f9268b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java @@ -0,0 +1,121 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Uncertainty; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +public final class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { + public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; + public byte selection = -1, mode = 0, status = -128; + + public GT_Container_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + GT_MetaTileEntity_Hatch_Uncertainty catH = (GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity(); + if (aSlotIndex < 16 && catH.matrix != null) { + if (catH.selection == -1) { + catH.selection = (byte) (aSlotIndex); + } else { + short temp = catH.matrix[catH.selection]; + catH.matrix[catH.selection] = catH.matrix[aSlotIndex]; + catH.matrix[aSlotIndex] = temp; + catH.selection = -1; + } + + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + + ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).compute(); + + if (this.matrix != null) + for (int i = 0; i < 16; i++) + this.matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).matrix[i]; + + this.selection = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).selection; + this.mode = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).mode; + this.status = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).status; + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.selection); + var1.sendProgressBarUpdate(this, 101, this.mode); + var1.sendProgressBarUpdate(this, 102, this.status); + + if (this.matrix != null) + for (int i = 0; i < 16; i++) + var1.sendProgressBarUpdate(this, 103 + i, this.matrix[i]); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.selection = (byte) par2; + break; + case 101: + this.mode = (byte) par2; + break; + case 102: + this.status = (byte) par2; + break; + default: + if (matrix != null && par1 >= 103 && par1 < 119) { + this.matrix[par1 - 103] = (short) par2; + break; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java new file mode 100644 index 0000000000..877b91f09c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +public final class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { + public GT_GUIContainer_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_Param(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Parametrizer.png"); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + if (this.mContainer != null) { + proxy.renderUnicodeString("Parametrizer: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input1f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2461\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input2f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value1f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2461\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value2f), 46, 41, 167, 0x0077ff); + proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value1, 46, 50, 167, 0x00bbff); + proxy.renderUnicodeString("M\u2461: " + ((GT_Container_Param) this.mContainer).value2, 46, 58, 167, 0x0077ff); + proxy.renderUnicodeString("E\u2460\u2461: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66, 167, 0x0033ff); + } else { + proxy.renderUnicodeString("Parametrizer", 46, 7, 167, 0xffffff); + } + //167 + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java new file mode 100644 index 0000000000..e2af74aa9f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java @@ -0,0 +1,109 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import com.github.technus.tectech.TecTech; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine { + public GT_GUIContainer_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + proxy.renderUnicodeString("Schrödinger", 46, 7, 167, 0xffffff); + if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) + proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); + else + proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + final short bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; + x += 52; + y += 33; + final int state = ((GT_Container_Uncertainty) this.mContainer).status; + switch (((GT_Container_Uncertainty) this.mContainer).mode) { + case 1://ooo oxo ooo + drawTexturedModalRect(x + 12, y + 12, + rU + (state == 0 ? 76 : 12), + Vs + 12, 10, 10); + break; + case 2://ooo xox ooo + drawTexturedModalRect(x, y + 12, + rU + ((state & 1) == 0 ? 64 : 0), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, + rU + ((state & 2) == 0 ? 88 : 24), + Vs + 12, 10, 10); + break; + case 3://oxo xox oxo + drawTexturedModalRect(x + 12, y, + rU + ((state & 1) == 0 ? 76 : 12), + Vs, 10, 10); + drawTexturedModalRect(x, y + 12, + rU + ((state & 2) == 0 ? 64 : 0), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, + rU + ((state & 4) == 0 ? 88 : 24), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 12, y + 24, + rU + ((state & 8) == 0 ? 76 : 12), + Vs + 24, 10, 10); + break; + case 4://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 64 : 0), + Vs, 10, 10); + drawTexturedModalRect(x + 24, y, + rU + ((state & 2) == 0 ? 88 : 24), + Vs, 10, 10); + drawTexturedModalRect(x, y + 24, + rU + ((state & 4) == 0 ? 64 : 0), + Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, + rU + ((state & 8) == 0 ? 88 : 24), + Vs + 24, 10, 10); + break; + case 5://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 64 : 0), + Vs, 10, 10); + drawTexturedModalRect(x + 24, y, + rU + ((state & 2) == 0 ? 88 : 24), + Vs, 10, 10); + drawTexturedModalRect(x + 12, y + 12, + rU + ((state & 4) == 0 ? 76 : 12), + Vs + 12, 10, 10); + drawTexturedModalRect(x, y + 24, + rU + ((state & 8) == 0 ? 64 : 0), + Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, + rU + ((state & 16) == 0 ? 88 : 24), + Vs + 24, 10, 10); + break; + } + x -= 6; + y -= 6; + for (int i = 0; i < 16; i++) + if (TecTech.Rnd.nextInt(1000) < ((GT_Container_Uncertainty) this.mContainer).matrix[i]) + drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), + fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); + if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { + int sel = ((GT_Container_Uncertainty) this.mContainer).selection; + drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), + bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java new file mode 100644 index 0000000000..0c2daaab2e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java @@ -0,0 +1,117 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import static org.lwjgl.opengl.GL11.*; + +public final class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Machine { + protected static final short sX = 52, sY = 33, bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; + + public GT_GUIContainer_UncertaintyAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + proxy.renderUnicodeString("Schrödinger X", 46, 7, 167, 0xffffff); + if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) + proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); + else + proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + x += sX; + y += sY; + final int state = ((GT_Container_Uncertainty) this.mContainer).status; + switch (((GT_Container_Uncertainty) this.mContainer).mode) { + case 1://ooo oxo ooo + drawTexturedModalRect(x + 12, y + 12, + rU + (state == 0 ? 76 : 12), + Vs + 12, 10, 10); + break; + case 2://ooo xox ooo + drawTexturedModalRect(x, y + 12, + rU + ((state & 1) == 0 ? 64 : 0), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, + rU + ((state & 2) == 0 ? 88 : 24), + Vs + 12, 10, 10); + break; + case 3://oxo xox oxo + drawTexturedModalRect(x + 12, y, + rU + ((state & 1) == 0 ? 76 : 12), + Vs, 10, 10); + drawTexturedModalRect(x, y + 12, + rU + ((state & 2) == 0 ? 64 : 0), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, + rU + ((state & 4) == 0 ? 88 : 24), + Vs + 12, 10, 10); + drawTexturedModalRect(x + 12, y + 24, + rU + ((state & 8) == 0 ? 76 : 12), + Vs + 24, 10, 10); + break; + case 4://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 64 : 0), + Vs, 10, 10); + drawTexturedModalRect(x + 24, y, + rU + ((state & 2) == 0 ? 88 : 24), + Vs, 10, 10); + drawTexturedModalRect(x, y + 24, + rU + ((state & 4) == 0 ? 64 : 0), + Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, + rU + ((state & 8) == 0 ? 88 : 24), + Vs + 24, 10, 10); + break; + case 5://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 64 : 0), + Vs, 10, 10); + drawTexturedModalRect(x + 24, y, + rU + ((state & 2) == 0 ? 88 : 24), + Vs, 10, 10); + drawTexturedModalRect(x + 12, y + 12, + rU + ((state & 4) == 0 ? 76 : 12), + Vs + 12, 10, 10); + drawTexturedModalRect(x, y + 24, + rU + ((state & 8) == 0 ? 64 : 0), + Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, + rU + ((state & 16) == 0 ? 88 : 24), + Vs + 24, 10, 10); + break; + } + x -= 6; + y -= 6; + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + for (int i = 0; i < 16; i++) { + GL11.glColor4f(1f, 1f, 1f, (float) ((GT_Container_Uncertainty) this.mContainer).matrix[i] / 1000f); + drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), + fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); + } + glDisable(GL_BLEND); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { + int sel = ((GT_Container_Uncertainty) this.mContainer).selection; + drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), + bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); + } + } + } +} 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 new file mode 100644 index 0000000000..5b26c90766 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -0,0 +1,95 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.thing.block.QuantumGlass; +import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static gregtech.api.enums.GT_Values.E; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_EM { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT + //Startcodes to startup + //per dim disable thingies + private static final String[] s = new String[]{ + "f202", "f020", "g0", "c5g5", "d55c55", "f0a0", "e21212", + "d00c00", "c0g0", "b0i0", "a20i02", "a02i20", "d0024200", + "c022c220", "b02g20", "02k20", "a03i30", "21k12" + }; + private static final String[][] S = new String[][]{ + {E, E, E, E, E, E, s[0], s[5], s[0]},//front + {E, E, E, E, s[2], s[0], s[6], "d0033300", s[6], s[0], s[2]}, + {E, E, E, s[2], s[1], s[1], s[7], "c033c330", s[7], s[1], s[1], s[2]}, + {E, E, s[2], s[1], s[4], s[4], s[8], "b03g30", s[8], s[4], s[4], s[1], s[2]}, + {E, s[2], s[1], s[4], s[3], s[3], s[9], s[16], s[9], s[3], s[3], s[4], s[1], s[2]}, + {E, s[0], s[1], s[4], s[3], s[3], s[10], s[16], s[10], s[3], s[3], s[4], s[1], s[0]}, + {s[0], s[6], s[7], s[8], s[9], s[10], s[17], "03k30", s[17], s[10], s[9], s[8], s[7], s[6], s[0]}, + {s[5], s[12], s[13], s[14], s[11], s[11], s[15], "a3k3", s[15], s[11], s[11], s[14], s[13], s[12], s[5]} + }; + private static final String[][] shape = new String[][]{ + S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], S[6], S[5], S[4], S[3], S[2], S[1], S[0] + }; + private static final Block[] blockType = new Block[]{ + GT_Container_CasingsTT.sBlockCasingsTT, + GT_Container_CasingsTT.sBlockCasingsTT, + GT_Container_CasingsTT.sBlockCasingsTT, + GT_Container_CasingsTT.sBlockCasingsTT, + GT_Container_CasingsTT.sBlockCasingsTT, + QuantumGlass.INSTANCE}; + private static final byte[] blockMeta = new byte[]{3, 4, 5, 6, 7, 0}; + + public GT_MetaTileEntity_EM_bhg(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_bhg(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_bhg(this.mName); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return stuctureCheck(shape, blockType, blockMeta, 7, 7, 0, iGregTechTileEntity); + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Singularity decay based power generation.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" + }; + } +} 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 new file mode 100644 index 0000000000..ca83d78e39 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -0,0 +1,74 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + + //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_collider(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_collider(this.mName); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Collide matter at extreme velocities.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light!!!" + }; + } +} 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 new file mode 100644 index 0000000000..224cd38926 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -0,0 +1,51 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM { + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + public GT_MetaTileEntity_EM_computer(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_computer(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_computer(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Processing quantum matter since...", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java new file mode 100644 index 0000000000..52774a7d29 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java @@ -0,0 +1,51 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_crafter extends GT_MetaTileEntity_MultiblockBase_EM { + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + public GT_MetaTileEntity_EM_crafter(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_crafter(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_crafter(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "The most precise way of making stuff.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java new file mode 100644 index 0000000000..1cfeedf07d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java @@ -0,0 +1,66 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.thing.block.QuantumGlass; +import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_dequantifier extends GT_MetaTileEntity_MultiblockBase_EM { + + public GT_MetaTileEntity_EM_dequantifier(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_dequantifier(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_dequantifier(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { + IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 99)) && + (!addElementalInputToMachineList(tTileEntity, 99)) && + (!addClassicOutputToMachineList(tTileEntity, 99)) && + (!addMufflerToMachineList(tTileEntity, 99)) && + (!addEnergyIOToMachineList(tTileEntity, 99))) { + if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || + iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { + return false; + } + } + } + } + } + } + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Transform quantum form back to regular one...", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "but why?" + }; + } +} 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 new file mode 100644 index 0000000000..19e4d0d081 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -0,0 +1,121 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.thing.block.QuantumGlass; +import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM { + public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_junction(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_junction(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { + IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 99)) && + (!addElementalInputToMachineList(tTileEntity, 99)) && + (!addElementalOutputToMachineList(tTileEntity, 99)) && + (!addMufflerToMachineList(tTileEntity, 99)) && + (!addEnergyIOToMachineList(tTileEntity, 99))) { + if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || + iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { + return false; + } + } + } + } + } + } + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Reroutes Matter", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Axis aligned movement!" + }; + } + + @Override + public void EM_checkParams() { + for (int i = 0; i < 10; i++) { + if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; + else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; + else if ((int) eParamsIn[i] > eInputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; + else eParamsInStatus[i] = PARAM_OK; + } + for (int i = 10; i < 20; i++) { + if (eParamsInStatus[i - 10] == PARAM_OK) { + if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; + else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_LOW; + else if ((int) eParamsIn[i] > eOutputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; + else eParamsInStatus[i] = PARAM_OK; + } else { + eParamsInStatus[i] = PARAM_UNUSED; + } + } + } + + @Override + public boolean EM_checkRecipe(ItemStack itemStack) { + for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) + if (in.getContainerHandler().hasStacks()) { + mEUt = -(int) V[8]; + eAmpereFlow = 1 + ((eInputHatches.size() + eOutputHatches.size()) >> 1); + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + return true; + } + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + return false; + } + + @Override + public void EM_outputFunction() { + for (int i = 0; i < 10; i++) { + final int inIndex = (int) (eParamsIn[i]) - 1; + if (inIndex < 0 || inIndex > eInputHatches.size()) continue; + final int outIndex = (int) (eParamsIn[i + 10]) - 1; + GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); + if (outIndex == -1) { + cleanHatchContent(in); + } else { + GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); + out.getContainerHandler().putUnifyAll(in.getContainerHandler()); + in.getContainerHandler().clear(); + } + } + } +} 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 new file mode 100644 index 0000000000..d20cdfc671 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java @@ -0,0 +1,51 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM { + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + 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(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Processing quantum matter since...", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java new file mode 100644 index 0000000000..d0d7294f98 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java @@ -0,0 +1,389 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.block.QuantumGlass; +import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; +import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; +import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; + +import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getBestUnstableIsotope; +import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getFirstStableIsotope; +import static gregtech.api.enums.GT_Values.V; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_quantifier extends GT_MetaTileEntity_MultiblockBase_EM { + public static HashMap itemBinds = new HashMap<>(32); + public static HashMap fluidBind = new HashMap<>(8); + private static float refMass, refUnstableMass; + + public GT_MetaTileEntity_EM_quantifier(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_quantifier(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_quantifier(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { + IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 99)) && + (!addClassicInputToMachineList(tTileEntity, 99)) && + (!addElementalOutputToMachineList(tTileEntity, 99)) && + (!addMufflerToMachineList(tTileEntity, 99)) && + (!addEnergyIOToMachineList(tTileEntity, 99))) { + if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || + iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { + return false; + } + } + } + } + } + } + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Conveniently convert regular stuff into quantum form.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "To make it more inconvenient." + }; + } + + @Override + public boolean EM_checkRecipe(ItemStack itemStack) { + if (GregTech_API.sPostloadFinished) { + ItemStack[] inI = getStoredInputs().toArray(new ItemStack[0]); + if (inI.length > 0) { + for (ItemStack is : inI) { + int[] oreIDs = OreDictionary.getOreIDs(is); + if (TecTech.ModConfig.DEBUG_MODE) + TecTech.Logger.info("Quantifier-recipe " + is.getItem().getUnlocalizedName() + "." + is.getItemDamage() + " " + is.getDisplayName()); + for (int ID : oreIDs) { + if (TecTech.ModConfig.DEBUG_MODE) + TecTech.Logger.info("Quantifier-recipe " + is.getItem().getUnlocalizedName() + "." + is.getItemDamage() + " " + OreDictionary.getOreName(ID)); + cElementalDefinitionStack into = itemBinds.get(ID); + if (into != null && isInputEqual(true, false, + nothingF, new ItemStack[]{new ItemStack(is.getItem(), 1, is.getItemDamage())}, null, inI)) { + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + float mass = into.getMass(); + float euMult = mass / refMass; + eAmpereFlow = (int) Math.ceil(euMult); + if (mass > refUnstableMass) { + mEUt = (int) -V[9]; + } else { + mEUt = (int) -V[8]; + } + outputEM = new cElementalInstanceStackTree[1]; + outputEM[0] = new cElementalInstanceStackTree(new cElementalInstanceStack(into)); + return true; + } + } + } + } + FluidStack[] inF = getStoredFluids().toArray(new FluidStack[0]); + if (inF.length > 0) { + for (FluidStack fs : inF) { + cElementalDefinitionStack into = fluidBind.get(fs.getFluid().getID()); + if (into != null && fs.amount >= 144 && isInputEqual(true, false, + new FluidStack[]{new FluidStack(fs.getFluid(), 144)}, nothingI, inF, (ItemStack[]) null)) { + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + float mass = into.getMass(); + float euMult = mass / refMass; + eAmpereFlow = (int) Math.ceil(euMult); + if (mass > refUnstableMass) { + mEUt = (int) -V[9]; + } else { + mEUt = (int) -V[8]; + } + outputEM = new cElementalInstanceStackTree[1]; + outputEM[0] = new cElementalInstanceStackTree(new cElementalInstanceStack(into)); + return true; + } + } + } + } + mEfficiencyIncrease = 0; + mMaxProgresstime = 0; + return false; + } + + @Override + public void EM_outputFunction() { + if (eOutputHatches.size() < 1) { + stopMachine(); + return; + } + eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); + } + + private static int getID(OrePrefixes prefix, Materials material) { + return OreDictionary.getOreID(prefix.name() + material.name()); + } + + public static void run() { + refMass = getFirstStableIsotope(1).getMass() * 144F; + fluidBind.put(Materials.Hydrogen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(1), 144)); + fluidBind.put(Materials.Helium.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(2), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Lithium), + new cElementalDefinitionStack(getFirstStableIsotope(3), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Beryllium), + new cElementalDefinitionStack(getFirstStableIsotope(4), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Boron), + new cElementalDefinitionStack(getFirstStableIsotope(5), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Carbon), + new cElementalDefinitionStack(getFirstStableIsotope(6), 144)); + fluidBind.put(Materials.Nitrogen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(7), 144)); + fluidBind.put(Materials.Oxygen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(8), 144)); + fluidBind.put(Materials.Fluorine.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(9), 144)); + //fluidBind.put(Materials.Neon.mGas.getID(),new cElementalDefinitionStack(getFirstStableIsotope(10),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Sodium), + new cElementalDefinitionStack(getFirstStableIsotope(11), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Magnesium), + new cElementalDefinitionStack(getFirstStableIsotope(12), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Aluminium), + new cElementalDefinitionStack(getFirstStableIsotope(13), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Silicon), + new cElementalDefinitionStack(getFirstStableIsotope(14), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Phosphorus), + new cElementalDefinitionStack(getFirstStableIsotope(15), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Sulfur), + new cElementalDefinitionStack(getFirstStableIsotope(16), 144)); + fluidBind.put(Materials.Chlorine.mFluid.getID(), new cElementalDefinitionStack(getFirstStableIsotope(17), 144)); + fluidBind.put(Materials.Argon.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(18), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Potassium), + new cElementalDefinitionStack(getFirstStableIsotope(19), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Calcium), + new cElementalDefinitionStack(getFirstStableIsotope(20), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Scandium), + new cElementalDefinitionStack(getFirstStableIsotope(21), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Titanium), + new cElementalDefinitionStack(getFirstStableIsotope(22), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Vanadium), + new cElementalDefinitionStack(getFirstStableIsotope(23), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Chrome), + new cElementalDefinitionStack(getFirstStableIsotope(24), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Manganese), + new cElementalDefinitionStack(getFirstStableIsotope(25), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Iron), + new cElementalDefinitionStack(getFirstStableIsotope(26), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.IronMagnetic), + new cElementalDefinitionStack(getFirstStableIsotope(26), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Cobalt), + new cElementalDefinitionStack(getFirstStableIsotope(27), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Nickel), + new cElementalDefinitionStack(getFirstStableIsotope(28), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Copper), + new cElementalDefinitionStack(getFirstStableIsotope(29), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Zinc), + new cElementalDefinitionStack(getFirstStableIsotope(30), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Gallium), + new cElementalDefinitionStack(getFirstStableIsotope(31), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Germanium), + // new cElementalDefinitionStack(getFirstStableIsotope(32),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Arsenic), + new cElementalDefinitionStack(getFirstStableIsotope(33), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Selenium), + // new cElementalDefinitionStack(getFirstStableIsotope(34),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Bromine), + // new cElementalDefinitionStack(getFirstStableIsotope(35),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Krypton), + // new cElementalDefinitionStack(getFirstStableIsotope(36),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Rubidium), + new cElementalDefinitionStack(getFirstStableIsotope(37), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Strontium), + new cElementalDefinitionStack(getFirstStableIsotope(38), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Yttrium), + new cElementalDefinitionStack(getFirstStableIsotope(39), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Zirconium), + // new cElementalDefinitionStack(getFirstStableIsotope(40),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Niobium), + new cElementalDefinitionStack(getFirstStableIsotope(41), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Molybdenum), + new cElementalDefinitionStack(getFirstStableIsotope(42), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Technetium), + // new cElementalDefinitionStack(getFirstStableIsotope(43),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Ruthenium), + // new cElementalDefinitionStack(getFirstStableIsotope(44),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Rhodium), + // new cElementalDefinitionStack(getFirstStableIsotope(45),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Palladium), + new cElementalDefinitionStack(getFirstStableIsotope(46), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Silver), + new cElementalDefinitionStack(getFirstStableIsotope(47), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Cadmium), + new cElementalDefinitionStack(getFirstStableIsotope(48), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Indium), + new cElementalDefinitionStack(getFirstStableIsotope(49), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Tin), + new cElementalDefinitionStack(getFirstStableIsotope(50), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Antimony), + new cElementalDefinitionStack(getFirstStableIsotope(51), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Tellurium), + new cElementalDefinitionStack(getFirstStableIsotope(52), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Iodine), + // new cElementalDefinitionStack(getFirstStableIsotope(53),144)); + //fluidBind.put(Materials.Xenon.mGas.getID(),new cElementalDefinitionStack(getFirstStableIsotope(54),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Caesium), + new cElementalDefinitionStack(getFirstStableIsotope(55), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Barium), + new cElementalDefinitionStack(getFirstStableIsotope(56), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Lanthanum), + new cElementalDefinitionStack(getFirstStableIsotope(57), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Cerium), + new cElementalDefinitionStack(getFirstStableIsotope(58), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Praseodymium), + new cElementalDefinitionStack(getFirstStableIsotope(59), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Neodymium), + new cElementalDefinitionStack(getFirstStableIsotope(60), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.NeodymiumMagnetic), + new cElementalDefinitionStack(getFirstStableIsotope(60), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Promethium), + new cElementalDefinitionStack(getFirstStableIsotope(61), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Samarium), + new cElementalDefinitionStack(getFirstStableIsotope(62), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.SamariumMagnetic), + // new cElementalDefinitionStack(getFirstStableIsotope(62),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Europium), + new cElementalDefinitionStack(getFirstStableIsotope(63), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Gadolinium), + new cElementalDefinitionStack(getFirstStableIsotope(64), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Terbium), + new cElementalDefinitionStack(getFirstStableIsotope(65), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Dysprosium), + new cElementalDefinitionStack(getFirstStableIsotope(66), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Holmium), + new cElementalDefinitionStack(getFirstStableIsotope(67), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Erbium), + new cElementalDefinitionStack(getFirstStableIsotope(68), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Thulium), + new cElementalDefinitionStack(getFirstStableIsotope(69), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Ytterbium), + new cElementalDefinitionStack(getFirstStableIsotope(70), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Lutetium), + new cElementalDefinitionStack(getFirstStableIsotope(71), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Hafnum), + // new cElementalDefinitionStack(getFirstStableIsotope(72),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Tantalum), + new cElementalDefinitionStack(getFirstStableIsotope(73), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Tungsten), + new cElementalDefinitionStack(getFirstStableIsotope(74), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Rhenium), + // new cElementalDefinitionStack(getFirstStableIsotope(75),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Osmium), + new cElementalDefinitionStack(getFirstStableIsotope(76), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Iridium), + new cElementalDefinitionStack(getFirstStableIsotope(77), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Platinum), + new cElementalDefinitionStack(getFirstStableIsotope(78), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Gold), + new cElementalDefinitionStack(getFirstStableIsotope(79), 144)); + fluidBind.put(Materials.Mercury.mFluid.getID(), new cElementalDefinitionStack(getFirstStableIsotope(80), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Thalium), + // new cElementalDefinitionStack(getFirstStableIsotope(81),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Lead), + new cElementalDefinitionStack(getFirstStableIsotope(82), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Bismuth), + new cElementalDefinitionStack(getFirstStableIsotope(83), 144)); + //UNSTABLE ATOMS + refUnstableMass = getFirstStableIsotope(83).getMass() * 144F; + //itemBinds.put(getID(OrePrefixes.dust, Materials.Polonium), + // new cElementalDefinitionStack(getBestUnstableIsotope(84),144)); + //fluidBind.put(Materials.Astatine.mPlasma.getID(),new cElementalDefinitionStack(getBestUnstableIsotope(85),144)); + fluidBind.put(Materials.Radon.mGas.getID(), new cElementalDefinitionStack(getBestUnstableIsotope(86), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Francium), + // new cElementalDefinitionStack(getBestUnstableIsotope(87),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Radium), + // new cElementalDefinitionStack(getBestUnstableIsotope(88),144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Actinium), + // new cElementalDefinitionStack(getBestUnstableIsotope(89),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Thorium), + new cElementalDefinitionStack(getBestUnstableIsotope(90), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Protactinium), + // new cElementalDefinitionStack(getBestUnstableIsotope(91),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Uranium), + new cElementalDefinitionStack(getBestUnstableIsotope(92), 144)); + //itemBinds.put(getID(OrePrefixes.dust, Materials.Neptunium), + // new cElementalDefinitionStack(getBestUnstableIsotope(93),144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Plutonium), + new cElementalDefinitionStack(getBestUnstableIsotope(94), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Americium), + new cElementalDefinitionStack(getBestUnstableIsotope(95), 144)); + /* ... */ + itemBinds.put(getID(OrePrefixes.ingotHot, Materials.Neutronium), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 100000)); + + try { + fluidBind.put(Materials.Deuterium.mGas.getID(), new cElementalDefinitionStack( + new dAtomDefinition( + eLeptonDefinition.lepton_e1, + dHadronDefinition.hadron_p1, + dHadronDefinition.hadron_n1 + ), 144)); + fluidBind.put(Materials.Tritium.mGas.getID(), new cElementalDefinitionStack( + new dAtomDefinition( + eLeptonDefinition.lepton_e1, + dHadronDefinition.hadron_p1, + dHadronDefinition.hadron_n2 + ), 144)); + fluidBind.put(Materials.Helium_3.mGas.getID(), new cElementalDefinitionStack( + new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 2), + dHadronDefinition.hadron_p2, + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 3) + ), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Uranium235), + new cElementalDefinitionStack(new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) + ), 144)); + itemBinds.put(getID(OrePrefixes.dust, Materials.Plutonium241), + new cElementalDefinitionStack(new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 149) + ), 144)); + } catch (tElementalException e) { + if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java new file mode 100644 index 0000000000..e20ff2d0bf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -0,0 +1,51 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM { + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_scanner(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_scanner(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "What is existing here?", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I HAVE NO IDEA (yet)!" + }; + } +} 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 new file mode 100644 index 0000000000..5d9b8ddc77 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -0,0 +1,110 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT; +import static com.github.technus.tectech.elementalMatter.commonValues.multiCheckAt; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM { + public GT_MetaTileEntity_EM_transformer(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } + + public GT_MetaTileEntity_EM_transformer(String aName) { + super(aName); + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_transformer(this.mName); + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != sBlockCasingsTT || iGregTechTileEntity.getMetaIDOffset(xDir, yDir, zDir) != 6) + return false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { + IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); + if (!addEnergyIOToMachineList(tTileEntity, 99)) { + if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != sBlockCasingsTT || + iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { + return false; + } + } + } + } + } + } + return true; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "Power substation", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "All the transformation!", + EnumChatFormatting.AQUA + "SafeVoid button = Soft Hammer!", + EnumChatFormatting.BLUE + "Only 0.78125% power loss, HAYO!", + }; + } + + @Override + public boolean EM_checkRecipe(ItemStack itemStack) { + if (ePowerPass) { + mEfficiencyIncrease = 10000; + mMaxProgresstime = 20; + } else { + mEfficiencyIncrease = 0; + mMaxProgresstime = 0; + } + eAmpereFlow = 0; + mEUt = 0; + eDismatleBoom = ePowerPass; + return ePowerPass; + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if ((aTick % 20) == multiCheckAt) { + if (eSafeVoid) { + eSafeVoid = false; + if (aBaseMetaTileEntity.isAllowedToWork()) + aBaseMetaTileEntity.disableWorking(); + else aBaseMetaTileEntity.enableWorking(); + } + ePowerPass = aBaseMetaTileEntity.isAllowedToWork(); + } + } + + @Override + public boolean doRandomMaintenanceDamage() { + return true; + } +} 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 new file mode 100644 index 0000000000..843e8edbfc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -0,0 +1,74 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.elementalMatter.commonValues; +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockBase_EM { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + + //use multi A energy inputs, use less power the longer it runs + private static final String[][] shape = new String[][]{ + {"",//left to right top + "", + ""},//front + {},//behind front + {} //behind + }; + private static final int[] casingRequirements = new int[]{}; + private static final Block[] blockType = new Block[]{}; + private static final byte[] blockMeta = new byte[]{}; + + public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_wormhole(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_wormhole(this.mName); + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + commonValues.tecMark, + "It is not full of worms.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "It is full of anti-worms!!!" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java new file mode 100644 index 0000000000..3b3245e3a3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java @@ -0,0 +1,100 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.gui; + +import com.github.technus.tectech.thing.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { + public byte[] eParamsInStatus = new byte[20];//unused 0,G ok 1, B too low 2, R too high 3, Y blink dangerous 4,5 + public byte[] eParamsOutStatus = new byte[20]; + public byte eCertainMode = 5, eCertainStatus = 127; + public boolean ePowerPass = false, eSafeVoid = false; + + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 1, 152, -21)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 0, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 21, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0) + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity(); + switch (aSlotIndex) { + case 1: + base.ePowerPass ^= true; + break; + case 2: + base.eSafeVoid ^= true; + break; + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null) || (this.eParamsInStatus == null)) + return;//INTELLIJ IS TALKING BULLSHIT HERE IT CAN BE NULL!!! + this.eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsInStatus; + this.eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsOutStatus; + this.eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainMode; + this.eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainStatus; + this.ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).ePowerPass; + this.eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eSafeVoid; + + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + int i = 100; + for (int j = 0; j < eParamsInStatus.length; j++) + var1.sendProgressBarUpdate(this, i++, eParamsInStatus[j] | (eParamsOutStatus[j] << 8)); + var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); + var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0)); + } + } + + @Override + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + if (this.eParamsInStatus == null) return; + if (par1 >= 100 && par1 < 120) { + this.eParamsInStatus[par1 - 100] = (byte) (par2 & 0xff); + this.eParamsOutStatus[par1 - 100] = (byte) (par2 >>> 8); + } else if (par1 == 120) { + this.eCertainMode = (byte) (par2 & 0xff); + this.eCertainStatus = (byte) (par2 >>> 8); + } else if (par1 == 121) { + this.ePowerPass = (par2 & 1) == 1; + this.eSafeVoid = (par2 & 2) == 2; + } + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java new file mode 100644 index 0000000000..2e2377e8e9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java @@ -0,0 +1,185 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +/** + * Created by Tec on 21.02.2017. + */ + +public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { + String mName = ""; + private static byte cntr = 0; + + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 10, -18, 16448255); + + if (mContainer != null) { + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 1) != 0) + fontRendererObj.drawString("Pipe is loose.", 10, -10, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 2) != 0) + fontRendererObj.drawString("Screws are missing.", 10, -2, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 4) != 0) + fontRendererObj.drawString("Something is stuck.", 10, 6, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 8) != 0) + fontRendererObj.drawString("Platings are dented.", 10, 14, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 16) != 0) + fontRendererObj.drawString("Circuitry burned out.", 10, 22, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 32) != 0) + fontRendererObj.drawString("That doesn't belong there.", 10, 30, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 64) != 0) + fontRendererObj.drawString("Incomplete Structure.", 10, 38, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 128) != 0) + fontRendererObj.drawString("Too Uncertain.", 10, 46, 16448255); + if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 256) != 0) + fontRendererObj.drawString("Invalid Parameters.", 10, 54, 16448255); + + if (((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode == 0) { + if (((GT_Container_MultiMachineEM) mContainer).mActive == 0) { + fontRendererObj.drawString("Hit with Soft Hammer", 10, -10, 16448255); + fontRendererObj.drawString("to (re-)start the Machine", 10, -2, 16448255); + fontRendererObj.drawString("if it doesn't start.", 10, 6, 16448255); + } else { + fontRendererObj.drawString("Running perfectly.", 10, -10, 16448255); + } + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + y -= 26; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize + 26); + if (this.mContainer != null && ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus != null) { + cntr = (byte) ((1 + cntr) % 6); + GL11.glColor4f(1f, 1f, 1f, 1f); + + if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) + drawTexturedModalRect(x + 151, y + 25, 183, 25, 18, 18); + + if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) + drawTexturedModalRect(x + 151, y + 46, 183, 46, 18, 18); + + x += 11; + y += 96; + for (int i = 0; i < 20; ) { + byte j = (byte) (i >>> 1); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j]); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j + 10]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j + 10]); + } + + final short rU = 183, Vs = 77; + x += 140; + y -= 19; + final byte state = ((GT_Container_MultiMachineEM) this.mContainer).eCertainStatus; + switch (((GT_Container_MultiMachineEM) this.mContainer).eCertainMode) { + case 1://ooo oxo ooo + drawTexturedModalRect(x + 6, y + 6, + rU + (state == 0 ? 38 : 6), + Vs + 6, 6, 6); + break; + case 2://ooo xox ooo + drawTexturedModalRect(x, y + 6, + rU + ((state & 1) == 0 ? 32 : 0), + Vs + 6, 6, 6); + drawTexturedModalRect(x + 12, y + 6, + rU + ((state & 2) == 0 ? 44 : 12), + Vs + 6, 6, 6); + break; + case 3://oxo xox oxo + drawTexturedModalRect(x + 6, y, + rU + ((state & 1) == 0 ? 38 : 6), + Vs, 6, 6); + drawTexturedModalRect(x, y + 6, + rU + ((state & 2) == 0 ? 32 : 0), + Vs + 6, 6, 6); + drawTexturedModalRect(x + 12, y + 6, + rU + ((state & 4) == 0 ? 44 : 12), + Vs + 6, 6, 6); + drawTexturedModalRect(x + 6, y + 12, + rU + ((state & 8) == 0 ? 38 : 6), + Vs + 12, 6, 6); + break; + case 4://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 32 : 0), + Vs, 6, 6); + drawTexturedModalRect(x + 12, y, + rU + ((state & 2) == 0 ? 44 : 12), + Vs, 6, 6); + drawTexturedModalRect(x, y + 12, + rU + ((state & 4) == 0 ? 32 : 0), + Vs + 12, 6, 6); + drawTexturedModalRect(x + 12, y + 12, + rU + ((state & 8) == 0 ? 44 : 12), + Vs + 12, 6, 6); + break; + case 5://xox ooo xox + drawTexturedModalRect(x, y, + rU + ((state & 1) == 0 ? 32 : 0), + Vs, 6, 6); + drawTexturedModalRect(x + 12, y, + rU + ((state & 2) == 0 ? 44 : 12), + Vs, 6, 6); + drawTexturedModalRect(x + 6, y + 6, + rU + ((state & 4) == 0 ? 38 : 6), + Vs + 6, 6, 6); + drawTexturedModalRect(x, y + 12, + rU + ((state & 8) == 0 ? 32 : 0), + Vs + 12, 6, 6); + drawTexturedModalRect(x + 12, y + 12, + rU + ((state & 16) == 0 ? 44 : 12), + Vs + 12, 6, 6); + break; + } + } + } + + private void LEDdrawP(int x, int y, int i, int j, byte status) { + final int v = 192, su = 8, sv = 6, u = 11; + switch (status) { + case 6: + if (cntr < 2) { + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); + break; + } else if (cntr < 4) { + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); + break; + } + case 1://ok + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (4 + j), su, sv); + break; + case 2://too low blink + if (cntr < 3) { + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); + break; + } + case 3:// too low + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (2 + j), su, sv); + break; + case 4://too high blink + if (cntr < 3) { + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); + break; + } + case 5:// too high + drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); + break; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java new file mode 100644 index 0000000000..1e006f2041 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -0,0 +1,164 @@ +package com.github.technus.tectech.thing.metaTileEntity.pipe; + +import com.github.technus.tectech.thing.machineTT; +import com.github.technus.tectech.elementalMatter.commonValues; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IColoredTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +/** + * Created by Tec on 26.02.2017. + */ +public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnectsToEMpipe, machineTT { + private static Textures.BlockIcons.CustomIcon EMpipe; + private static Textures.BlockIcons.CustomIcon EMcandy; + public byte connectionCount = 0; + + public GT_MetaTileEntity_Pipe_EM(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, 0); + } + + public GT_MetaTileEntity_Pipe_EM(String aName) { + super(aName, 0); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_MetaTileEntity_Pipe_EM(mName); + } + + @Override + public float getThickNess() { + return 0.5F; + } + + @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE"); + EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[]{new GT_RenderedTexture(EMpipe), new GT_RenderedTexture(EMcandy, Dyes.getModulation(aColorIndex, MACHINE_METAL.getRGBA()))}; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + return false; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + return false; + } + + @Override + public void loadNBTData(NBTTagCompound nbtTagCompound) { + } + + @Override + public void saveNBTData(NBTTagCompound nbtTagCompound) { + } + + @Override + public boolean renderInside(byte b) { + return false; + } + + @Override + public byte getTileEntityBaseType() { + return 4; + } + + @Override + public String[] getDescription() { + String tecMark; + return new String[]{ + commonValues.tecMark, + "Quantum tunneling device.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", + EnumChatFormatting.AQUA + "Must be painted to work", + EnumChatFormatting.AQUA + "Do not cross,split or turn" + }; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if ((aTick & 31) == 0) { + byte mOld = 0; + mConnections = 0; + connectionCount = 0; + if (aBaseMetaTileEntity.getColorization() < 0) return; + for (byte i = 0, j; i < 6; i++) { + j = GT_Utility.getOppositeSide(i); + if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { + TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); + if (tTileEntity instanceof IColoredTileEntity) { + //if (aBaseMetaTileEntity.getColorization() >= 0) { + byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); + if (tColor != aBaseMetaTileEntity.getColorization()) continue; + //} + } + if (tTileEntity instanceof iConnectsToEMpipe && (((iConnectsToEMpipe) tTileEntity).canConnect(j))) { + mConnections |= (1 << i); + if (mOld != mConnections) { + connectionCount++; + mOld = mConnections; + } + continue; + } + if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { + if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || + ((iConnectsToEMpipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { + mConnections |= (1 << i); + if (mOld != mConnections) { + connectionCount++; + mOld = mConnections; + } + } + } + } else { + mConnections |= (1 << i); + if (mOld != mConnections) { + connectionCount++; + mOld = mConnections; + } + } + + } + } + + } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + } + + @Override + public boolean canConnect(byte side) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToEMpipe.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToEMpipe.java new file mode 100644 index 0000000000..d8fd912455 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/iConnectsToEMpipe.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.pipe; + +/** + * Created by Tec on 26.02.2017. + */ +public interface iConnectsToEMpipe { + boolean canConnect(byte side); +} diff --git a/src/main/java/com/github/technus/tectech/things/block/QuantumGlass.java b/src/main/java/com/github/technus/tectech/things/block/QuantumGlass.java deleted file mode 100644 index 676538d72f..0000000000 --- a/src/main/java/com/github/technus/tectech/things/block/QuantumGlass.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.github.technus.tectech.things.block; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import eu.usrv.yamcore.blocks.BlockBase; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import static com.github.technus.tectech.auxiliary.Reference.MODID; - -/** - * Created by danie_000 on 17.12.2016. - */ -public final class QuantumGlass extends BlockBase { - public static IIcon stuff; - public static QuantumGlass INSTANCE = new QuantumGlass(); - - public QuantumGlass() { - super(Material.iron); - this.setBlockBounds(0, 0, 0, 1, 1, 1); - setBlockName("QuantumGlass"); - setHarvestLevel("wrench", 3); - setHardness(50); - setResistance(30); - setLightOpacity(0); - setStepSound(Block.soundTypeMetal); - setBlockTextureName(MODID + ":blockQuantumGlass"); - } - - @Override - public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { - return true; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean getCanBlockGrass() { - return false; - } - - //@Override - //public boolean canRenderInPass(int pass) { - // return true; - //} - - @Override - public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { - return false; - } - - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - return 1; - } - - public boolean renderAsNormalBlock() { - return false; - } - - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { - Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); - return block != this;// && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); - } - - @Override - public int getRenderType() { - return QuantumGlassRender.renderID; - } - - @Override - public void registerBlockIcons(IIconRegister p_149651_1_) { - super.registerBlockIcons(p_149651_1_); - stuff = this.blockIcon; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/block/QuantumGlassRender.java b/src/main/java/com/github/technus/tectech/things/block/QuantumGlassRender.java deleted file mode 100644 index 37eb98236f..0000000000 --- a/src/main/java/com/github/technus/tectech/things/block/QuantumGlassRender.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.github.technus.tectech.things.block; - -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import org.lwjgl.opengl.GL11; - -/** - * Created by danie_000 on 19.12.2016. - */ -public final class QuantumGlassRender implements ISimpleBlockRenderingHandler { - public static int renderID; - - public QuantumGlassRender() { - } - - @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - Tessellator tessellator = Tessellator.instance; - - //Get icons from custom register (useful for renderers and fluids) - IIcon side = QuantumGlass.stuff; - GL11.glDisable(GL11.GL_CULL_FACE); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, side); - tessellator.draw(); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - GL11.glEnable(GL11.GL_CULL_FACE); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, - Block block, int modelId, - RenderBlocks renderer) { - - renderer.renderStandardBlock(block, x, y, z); - Tessellator tes = Tessellator.instance; - tes.setNormal(0F, 1F, 0F); - tes.setBrightness(15728880); - tes.setColorOpaque_F(0F, 1F, 1F); - IIcon side = QuantumGlass.stuff; - - //South - if (world.getBlock(x, y, z + 1).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x, y, z + 0.999, side.getMinU(), side.getMaxV()); //0.999 instead of 1 for fighting (textures overlapping) - tes.addVertexWithUV(x, y + 1, z + 0.999, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y + 1, z + 0.999, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y, z + 0.999, side.getMaxU(), side.getMaxV()); - } - //East - if (world.getBlock(x + 1, y, z).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x + 0.999, y, z + 1, side.getMinU(), side.getMaxV()); - tes.addVertexWithUV(x + 0.999, y + 1, z + 1, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x + 0.999, y + 1, z, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x + 0.999, y, z, side.getMaxU(), side.getMaxV()); - } - //North - if (world.getBlock(x, y, z - 1).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x + 1, y, z + 0.001, side.getMinU(), side.getMaxV()); - tes.addVertexWithUV(x + 1, y + 1, z + 0.001, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x, y + 1, z + 0.001, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x, y, z + 0.001, side.getMaxU(), side.getMaxV()); - } - //West - if (world.getBlock(x - 1, y, z).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x + 0.001, y, z, side.getMinU(), side.getMaxV()); - tes.addVertexWithUV(x + 0.001, y + 1, z, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x + 0.001, y + 1, z + 1, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x + 0.001, y, z + 1, side.getMaxU(), side.getMaxV()); - } - //Top - if (world.getBlock(x, y + 1, z).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x, y + 0.999, z + 1, side.getMinU(), side.getMaxV()); - tes.addVertexWithUV(x, y + 0.999, z, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y + 0.999, z, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y + 0.999, z + 1, side.getMaxU(), side.getMaxV()); - } - //Bottom - if (world.getBlock(x, y - 1, z).getClass() != QuantumGlass.class) { - tes.addVertexWithUV(x, y + 0.001, z, side.getMinU(), side.getMaxV()); - tes.addVertexWithUV(x, y + 0.001, z + 1, side.getMinU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y + 0.001, z + 1, side.getMaxU(), side.getMinV()); - tes.addVertexWithUV(x + 1, y + 0.001, z, side.getMaxU(), side.getMaxV()); - } - return true; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } - - @Override - public int getRenderId() { - return QuantumGlassRender.renderID; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/things/casing/GT_Block_CasingsTT.java deleted file mode 100644 index 51ccb9fc7f..0000000000 --- a/src/main/java/com/github/technus/tectech/things/casing/GT_Block_CasingsTT.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.github.technus.tectech.things.casing; - -import com.github.technus.tectech.CustomItemList; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Block_Casings_Abstract; -import gregtech.common.blocks.GT_Material_Casings; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import java.util.List; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Block_CasingsTT - extends GT_Block_Casings_Abstract { - - private static IIcon eM3, eM4, eM5, eM6, eM7, eM8, eM9; - private static IIcon debug[] = new IIcon[6]; - - public GT_Block_CasingsTT() { - - super(GT_Item_CasingsTT.class, "gt.blockcasingsTT", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - Textures.BlockIcons.CASING_BLOCKS[(i + 96)] = new GT_CopiedBlockTexture(this, 6, i); - /*IMPORTANT for block recoloring*/ - } - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Molecular Containment Casing");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Containment Field Generator");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Containment Field Generator Casing");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Molecular Containment Coil");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Teleportation Casing");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Spacetime Altering Casing");//adding - - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Debug Sides");//adding - - - CustomItemList.eM_Casing.set(new ItemStack(this, 1, 3));//adding - CustomItemList.eM_Field.set(new ItemStack(this, 1, 4));//adding - CustomItemList.eM_Field_Casing.set(new ItemStack(this, 1, 5));//adding - CustomItemList.eM_Coil.set(new ItemStack(this, 1, 6));//adding - CustomItemList.eM_Tele.set(new ItemStack(this, 1, 7));//adding - CustomItemList.eM_TimeSpaceWarp.set(new ItemStack(this, 1, 8)); - - CustomItemList.debugBlock.set(new ItemStack(this, 1, 9)); - } - - @Override - public void registerBlockIcons(IIconRegister aIconRegister) { - //super.registerBlockIcons(aIconRegister); - eM3 = aIconRegister.registerIcon("gregtech:iconsets/EM_CASING"); - eM4 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD"); - eM5 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_CASING"); - eM6 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL"); - eM7 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL_NONSIDE"); - eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); - eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); - eM9 = aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); - - debug[0] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_0"); - debug[1] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_1"); - debug[2] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_2"); - debug[3] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_3"); - debug[4] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_4"); - debug[5] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_5"); - } - - public IIcon getIcon(int aSide, int aMeta) { - switch (aMeta) { - case 3: - return eM3; - case 4: - return eM4; - case 5: - return eM5; - case 6: - if (aSide < 2) return eM7; - return eM6; - case 7: - return eM8; - case 8: - return eM9; - case 9: - return debug[aSide]; - default: - return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); - } - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - return getIcon(aSide, tMeta); - } - - public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { - return super.colorMultiplier(aWorld, aX, aY, aZ); - } - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 3; i <= 9; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/casing/GT_Container_CasingsTT.java b/src/main/java/com/github/technus/tectech/things/casing/GT_Container_CasingsTT.java deleted file mode 100644 index b3cf5ee3e6..0000000000 --- a/src/main/java/com/github/technus/tectech/things/casing/GT_Container_CasingsTT.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.things.casing; - -import net.minecraft.block.Block; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Container_CasingsTT { - public static Block sBlockCasingsTT; -} diff --git a/src/main/java/com/github/technus/tectech/things/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/things/casing/GT_Item_CasingsTT.java deleted file mode 100644 index 199b899d78..0000000000 --- a/src/main/java/com/github/technus/tectech/things/casing/GT_Item_CasingsTT.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.technus.tectech.things.casing; - -import gregtech.common.blocks.GT_Item_Casings_Abstract; -import net.minecraft.block.Block; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Item_CasingsTT - extends GT_Item_Casings_Abstract { - public GT_Item_CasingsTT(Block par1) { - super(par1); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/casing/GT_Loader_CasingsTT.java b/src/main/java/com/github/technus/tectech/things/casing/GT_Loader_CasingsTT.java deleted file mode 100644 index a611dbd708..0000000000 --- a/src/main/java/com/github/technus/tectech/things/casing/GT_Loader_CasingsTT.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.things.casing; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Loader_CasingsTT implements Runnable { - public void run() { - GT_Container_CasingsTT.sBlockCasingsTT = new GT_Block_CasingsTT(); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/machineTT.java b/src/main/java/com/github/technus/tectech/things/machineTT.java deleted file mode 100644 index 942502ad13..0000000000 --- a/src/main/java/com/github/technus/tectech/things/machineTT.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.technus.tectech.things; - -/** - * Created by Tec on 15.03.2017. - */ -public interface machineTT { -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java deleted file mode 100644 index 68baa20cd4..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.elementalMatter.interfaces.iConnectsToEMpipe; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; -import com.github.technus.tectech.things.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_MufflerElemental; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -import static com.github.technus.tectech.elementalMatter.commonValues.*; -import static gregtech.api.enums.Dyes.MACHINE_METAL; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; - -/** - * Created by danie_000 on 11.12.2016. - */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, iConnectsToEMpipe, machineTT { - private static Textures.BlockIcons.CustomIcon EM_T_SIDES; - private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; - - protected cElementalInstanceStackTree content = new cElementalInstanceStackTree(); - //float lifeTimeMult=1f; - int postEnergize = 0; - float overflowMatter = 0f; - public short id = -1; - private byte deathDelay = 2; - - public GT_MetaTileEntity_Hatch_ElementalContainer(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 0, descr); - } - - public GT_MetaTileEntity_Hatch_ElementalContainer(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - } - - @Override - 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"); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_ACTIVE, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_T_SIDES, Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("postEnergize", postEnergize); - //aNBT.setFloat("lifeTimeMult",lifeTimeMult); - aNBT.setFloat("overflowMatter", overflowMatter); - aNBT.setTag("eM_Stacks", content.toNBT()); - aNBT.setShort("eID", id); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - postEnergize = aNBT.getInteger("postEnergize"); - //lifeTimeMult=aNBT.getFloat("lifeTimeMult"); - overflowMatter = aNBT.getFloat("overflowMatter"); - id = aNBT.getShort("eID"); - try { - content = cElementalInstanceStackTree.fromNBT(aNBT.getCompoundTag("eM_Stacks")); - } catch (tElementalException e) { - if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); - if (content == null) content = new cElementalInstanceStackTree(); - } - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - byte Tick = (byte) (aTick % 20); - if (decayAt == Tick) { - purgeOverflow(); - content.tickContent(postEnergize);//Hatches don't life time mult things - purgeOverflow(); - } else if (overflowAt == Tick) { - if (overflowMatter <= 0) { - deathDelay = 3; - } else { - if (deathDelay == 2) { - if (TecTech.ModConfig.BOOM_ENABLE && TecTech.Rnd.nextInt(10) == 0) - aBaseMetaTileEntity.setOnFire(); - else - TecTech.proxy.broadcast("Container0 FIRE! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } else if (deathDelay == 1) { - IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()); - if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) - tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); - if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_MufflerElemental)) - 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(); - aMetaTileEntity.overflowMatter += overflowMatter; - if (aMetaTileEntity.overflowMatter > aMetaTileEntity.overflowMax) { - if (TecTech.ModConfig.BOOM_ENABLE) tGTTileEntity.doExplosion(V[14]); - else - TecTech.proxy.broadcast("Container1 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } else overflowMatter = 0F; - } - } else if (deathDelay < 1) { - if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[14]); - else - TecTech.proxy.broadcast("Container2 BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } - deathDelay--; - } - } else if (moveAt == Tick) { - moveAround(aBaseMetaTileEntity); - getBaseMetaTileEntity().setActive(content.hasStacks()); - } - } - } - - public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { - } - - @Override - public cElementalInstanceStackTree getContainerHandler() { - return content; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isLiquidInput(byte aSide) { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - public int getMaxStacksCount() { - return mTier * 2; - } - - public int getMaxStackSize() { - return mTier * (mTier - 7) * 1000; - } - - @Override - public float purgeOverflow() { - return overflowMatter += content.removeOverflow(getMaxStacksCount(), getMaxStackSize()); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - if (id > 0) { - if (content == null || content.size() == 0) - return new String[]{"ID: " + EnumChatFormatting.AQUA + id, "No Stacks"}; - else { - final String[] lines = content.getElementalInfo(); - final String[] output = new String[lines.length + 1]; - output[0] = "ID: " + EnumChatFormatting.AQUA + id; - System.arraycopy(lines, 0, output, 1, lines.length); - return output; - } - } - if (content == null || content.size() == 0) return new String[]{"No Stacks"}; - return content.getElementalInfo(); - } - - public float updateSlots() { - return purgeOverflow(); - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription, - "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), - "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), - "Place Overflow Hatch behind,on top or below", - "to provide overflow protection while this block", - "is not attached to multi block.", - "Transport range can be extended in straight", - "line up to 15 blocks with quantum tunnels.", - EnumChatFormatting.AQUA + "Must be painted to work" - }; - } - - @Override - public void onRemoval() { - if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) - if (TecTech.ModConfig.BOOM_ENABLE) getBaseMetaTileEntity().doExplosion(V[15]); - else - TecTech.proxy.broadcast("BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java deleted file mode 100644 index 352e55718f..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/GT_MetaTileEntity_MultiblockBase_EM.java +++ /dev/null @@ -1,1410 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.things.metaTileEntity.hatch.*; -import com.github.technus.tectech.things.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.things.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_OreDictUnificator; -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.minecraft.world.ChunkPosition; -import net.minecraftforge.fluids.FluidStack; - -import java.util.ArrayList; - -import static com.github.technus.tectech.elementalMatter.commonValues.*; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; - -/** - * Created by danie_000 on 27.10.2016. - */ -public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements machineTT { - protected cElementalInstanceStackTree[] outputEM = new cElementalInstanceStackTree[0]; - - final static ItemStack[] nothingI = new ItemStack[0]; - final static FluidStack[] nothingF = new FluidStack[0]; - - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private 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 final float[] eParamsIn = new float[20]; - public final float[] eParamsOut = new float[20]; - public final byte[] eParamsInStatus = new byte[20]; - public final byte[] eParamsOutStatus = new byte[20]; - protected final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6; - - //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, eDismatleBoom = false; - public byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3; - - private long eMaxAmpereFlow = 0; - private long maxEUinputMin = 0, maxEUinputMax = 0; - public long eAmpereFlow = 1; - - //init param states in constructor, or implement it in checkrecipe/outputfunction - - //METHODS TO OVERRIDE - this 3 below + checkMachine - - //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 EM_checkRecipe(ItemStack itemStack) { - return false; - } - //My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! - - public void EM_checkParams() { - } - //update status of parameters in guis and "machine state" - - public void EM_outputFunction() { - } - // based on "machine state" do output, - // this must move to output EM things and can also modify output items/fluids/EM, remaining EM is NOT overflowed. - //(Well it can be overflowed if machine didn't finished, soft-hammered/disabled/not enough EU) - - //RATHER LEAVE ALONE Section - - 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 - 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); - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; - } - - @Override - public final byte getTileEntityBaseType() { - return 3; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - - //Fix supermethod shit. - if (mOutputItems != null) - aNBT.setInteger("eItemsOut", mOutputItems.length); - if (mOutputFluids != null) - aNBT.setInteger("eFluidsOut", mOutputFluids.length); - - aNBT.setLong("eMaxEUmin", maxEUinputMin); - aNBT.setLong("eMaxEUmax", maxEUinputMax); - aNBT.setLong("eRating", eAmpereFlow); - aNBT.setLong("eMaxA", eMaxAmpereFlow); - 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", eDismatleBoom); - - 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 < 20; i++) - paramI.setFloat(Integer.toString(i), eParamsIn[i]); - aNBT.setTag("eParamsIn", paramI); - - NBTTagCompound paramO = new NBTTagCompound(); - for (int i = 0; i < 20; i++) - paramO.setFloat(Integer.toString(i), eParamsOut[i]); - aNBT.setTag("eParamsOut", paramO); - - NBTTagCompound paramIs = new NBTTagCompound(); - for (int i = 0; i < 20; i++) - paramIs.setByte(Integer.toString(i), eParamsInStatus[i]); - aNBT.setTag("eParamsInS", paramIs); - - NBTTagCompound paramOs = new NBTTagCompound(); - for (int i = 0; i < 20; 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"); - eCertainMode = aNBT.getByte("eCertainM"); - eCertainStatus = aNBT.getByte("eCertainS"); - minRepairStatus = aNBT.getByte("eMinRepair"); - eParameters = aNBT.getBoolean("eParam"); - ePowerPass = aNBT.getBoolean("ePass"); - eSafeVoid = aNBT.getBoolean("eVoid"); - eDismatleBoom = aNBT.getBoolean("eBoom"); - - //Fix supermethod shit. - mOutputItems = new ItemStack[aNBT.getInteger("eItemsOut")]; - for (int i = 0; i < mOutputItems.length; i++) - mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mOutputFluids = new FluidStack[aNBT.getInteger("eFluidsOut")]; - 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 cElementalInstanceStackTree[outputLen]; - for (int i = 0; i < outputEM.length; i++) - try { - outputEM[i] = cElementalInstanceStackTree.fromNBT( - aNBT.getCompoundTag("outputEM").getCompoundTag(Integer.toString(i))); - } catch (tElementalException e) { - if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); - outputEM[i] = new cElementalInstanceStackTree(); - } - } else outputEM = new cElementalInstanceStackTree[0]; - - NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); - for (int i = 0; i < eParamsIn.length; i++) - eParamsIn[i] = paramI.getFloat(Integer.toString(i)); - - NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); - for (int i = 0; i < eParamsOut.length; i++) - eParamsOut[i] = paramO.getFloat(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)); - } - - @Override - public final long maxEUStore() { - return (maxEUinputMin * eMaxAmpereFlow) << 3; - } - - @Override - public final long getMinimumStoredEU() { - return maxEUStore() >> 1; - } - - @Override - public final long maxAmperesIn() { - return 0L; - } - - @Override - public final long maxAmperesOut() { - return 0L; - } - - @Override - public int getPollutionPerTick(ItemStack itemStack) { - return 0; - } - - @Override - public final void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) mEfficiency = 0; - if (--mUpdate == 0 || --mStartUpCheck == 0) { - - 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_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(); - - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - - if (!mMachine) - if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock(); - else if (outputEM != null) - for (cElementalInstanceStackTree tree : outputEM) - if (tree.hasStacks()) { - explodeMultiblock(); - break; - } - - 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++; - - 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); - } else { - maxEUinputMin = 0; - maxEUinputMax = 0; - eMaxAmpereFlow = 0; - this.setEUVar(0); - } - } - - if (mStartUpCheck < 0) {//E - if (mMachine) {//S - final byte Tick = (byte) (aTick % 20); - if (multiPurge1At == Tick || multiPurge2At == Tick) - purgeAll(); - else if (multiCheckAt == 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.isRecipeInputEqual(true); - 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 (moveAt == Tick && eSafeVoid) { - for (GT_MetaTileEntity_Hatch_MufflerElemental voider : eMufflerHatches) { - if (voider.overflowMax < voider.overflowMatter) continue; - float remaining = voider.overflowMax - voider.overflowMatter; - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - int qty = (int) Math.floor(remaining / instance.definition.getMass()); - if (qty > 0) { - qty = Math.min(qty, instance.amount); - voider.overflowMatter += instance.definition.getMass() * qty; - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - int qty = (int) Math.floor(remaining / instance.definition.getMass()); - if (qty > 0) { - qty = Math.min(qty, instance.amount); - voider.overflowMatter += instance.definition.getMass() * qty; - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - //in case some weird shit happened here, it will still be safe - if (voider.overflowMatter > voider.overflowMax) voider.overflowMatter = voider.overflowMax; - } - } - - if (getRepairStatus() >= minRepairStatus) {//S - if (multiCheckAt == Tick) - paramsUpdate(); - - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start - if (onRunningTick(mInventory[1])) {//Compute EU - if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) - stopMachine(); - - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && recipeAt == Tick) {//progress increase and done - paramsUpdate(); - EM_outputFunction(); - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) - addOutput(tStack); - - if (mOutputFluids != null && mOutputFluids.length == 1) - for (FluidStack tStack : mOutputFluids) - if (tStack != null) - addOutput(tStack); - else if (mOutputFluids != null && mOutputFluids.length > 1) - addFluidOutputs(mOutputFluids); - updateSlots(); - mOutputItems = null; - mOutputFluids = null; - outputEM = new cElementalInstanceStackTree[0]; - 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))); - } - updateSlots(); - } - } - } - } else { - if (recipeAt == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { - if (aBaseMetaTileEntity.isAllowedToWork()) { - if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - } - updateSlots(); - } - } - } - - {//DO ONCE - 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 + (euVar >> 7), 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 + (euVar >> 7), false)) - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - } - } else {//not repaired - stopMachine(); - } - } else {//not machine - stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & -512) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64) | ((eCertainStatus == 0) ? 0 : 128) | (eParameters ? 0 : 256)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; - for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) - aMuffler.getBaseMetaTileEntity().setActive(active); - } - } - - @Deprecated - @Override - public final int getAmountOfOutputs() { - return 0; - } - - private void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; ++i) { - if (this.mOutputHatches.size() > i && this.mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity((MetaTileEntity) this.mOutputHatches.get(i))) { - this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - } - - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 10000; - } - - @Override - public int getIdealStatus() { - return super.getIdealStatus() + 2; - } - - @Override - public int getRepairStatus() { - return super.getRepairStatus() + ((eCertainStatus == 0) ? 1 : 0) + (this.eParameters ? 1 : 0); - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (this.mEUt > 0) { - this.EMaddEnergyOutput((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); - return true; - } else if (this.mEUt < 0 && !this.EMdrainEnergyInput((long) (-this.mEUt) * getMaxEfficiency(aStack) / (long) Math.max(1000, this.mEfficiency), eAmpereFlow)) { - this.stopMachine(); - return false; - } else return true; - } - - @Deprecated - @Override - public final boolean addEnergyOutput(long EU) { - if (EU <= 0L) return true; - for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) - return true; - for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) - return true; - return false; - } - - //new method - public final boolean EMaddEnergyOutput(long EU, long Amperes) { - if (EU <= 0L || Amperes <= 0) return true; - long euVar = EU * Amperes; - long diff; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) explodeMultiblock(); - diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); - if (diff > 0) { - if (euVar > diff) { - tHatch.setEUVar(tHatch.maxEUStore()); - euVar -= diff; - } else if (euVar <= diff) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - return true; - } - } - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) explodeMultiblock(); - diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); - if (diff > 0) { - if (euVar > diff) { - tHatch.setEUVar(tHatch.maxEUStore()); - euVar -= diff; - } else if (euVar <= diff) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - return true; - } - } - } - } - return false; - } - - @Deprecated - @Override - public final boolean drainEnergyInput(long EU) { - if (EU <= 0L) return true; - for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) - return true; - for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) - return true; - return false; - } - - //new method - public final boolean EMdrainEnergyInput(long EU, long Amperes) { - if (EU <= 0L || Amperes <= 0) return true; - long euVar = EU * Amperes; - if (euVar > getEUVar() || - EU > maxEUinputMax || - (euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) { - if (TecTech.ModConfig.DEBUG_MODE) { - TecTech.Logger.debug("OMG1 " + euVar + " " + getEUVar() + " " + (euVar > getEUVar())); - TecTech.Logger.debug("OMG2 " + EU + " " + maxEUinputMax + " " + (EU > maxEUinputMax)); - TecTech.Logger.debug("OMG3 " + euVar + " " + eMaxAmpereFlow); - TecTech.Logger.debug("OMG4 " + ((euVar - 1) / maxEUinputMin + 1) + " " + eMaxAmpereFlow + " " + ((euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); - } - return false; - } - //sub eu - setEUVar(getEUVar() - euVar); - return true; - } - - //new method - public final boolean EMoverclockAndPutValuesIn(long EU, int time) { - if (EU == 0) { - mEUt = 0; - mMaxProgresstime = time; - return true; - } - long tempEUt = EU < V[1] ? V[1] : EU; - long tempTier = maxEUinputMax >> 2; - while (tempEUt < tempTier) { - tempEUt <<= 2; - time >>= 1; - EU = time == 0 ? EU >> 1 : EU << 2;//U know, if the time is less than 1 tick make the machine use less power - } - if (EU > Integer.MAX_VALUE || EU < Integer.MIN_VALUE) { - mEUt = Integer.MAX_VALUE - 1; - mMaxProgresstime = Integer.MAX_VALUE - 1; - return false; - } - mEUt = (int) EU; - mMaxProgresstime = time == 0 ? 1 : time; - return true; - }//Use in EM check recipe return statement if you want overclocking - - @Override - public final long getMaxInputVoltage() { - long rVoltage = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); - return rVoltage; - } - - //new Method - public final int getMaxEnergyInputTier() { - return GT_Utility.getTier(maxEUinputMax); - } - - //new Method - public final int getMinEnergyInputTier() { - return GT_Utility.getTier(maxEUinputMin); - } - - @Override - public final void stopMachine() { - mOutputItems = null; - mOutputFluids = null; - //mEUt = 0; - mEfficiency = 0; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - getBaseMetaTileEntity().disableWorking(); - - float mass = 0; - if (outputEM == null) return; - for (cElementalInstanceStackTree tree : outputEM) - mass += tree.getMass(); - if (mass > 0) { - if (eMufflerHatches.size() < 1) explodeMultiblock(); - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { - dump.overflowMatter += mass; - if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); - } - } - outputEM = null; - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; - } - - @Override - public void updateSlots() { - super.updateSlots(); - purgeAll(); - } - - private void purgeAll() { - float mass = 0; - for (GT_MetaTileEntity_Hatch_InputElemental tHatch : eInputHatches) { - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - mass += tHatch.overflowMatter; - tHatch.overflowMatter = 0; - } - for (GT_MetaTileEntity_Hatch_OutputElemental tHatch : eOutputHatches) { - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - mass += tHatch.overflowMatter; - tHatch.overflowMatter = 0; - } - if (mass > 0) { - if (eMufflerHatches.size() < 1) { - explodeMultiblock(); - return; - } - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { - dump.overflowMatter += mass; - if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); - } - } - } - - public void cleanHatchContent(GT_MetaTileEntity_Hatch_ElementalContainer target) { - float mass = target.getContainerHandler().getMass(); - if (mass > 0) { - if (eMufflerHatches.size() < 1) explodeMultiblock(); - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { - dump.overflowMatter += mass; - if (dump.overflowMatter > dump.overflowMax) explodeMultiblock(); - } - } - } - - @Override - public final boolean checkRecipe(ItemStack itemStack) {//do recipe checks, based on "machine content and state" - paramsUpdate(); - return EM_checkRecipe(itemStack); - } - - private void paramsUpdate() { - for (GT_MetaTileEntity_Hatch_Param param : eParamHatches) { - int paramID = param.param; - if (paramID < 0) continue; - eParamsIn[paramID] = param.value1f; - eParamsIn[paramID + 10] = param.value2f; - param.input1f = eParamsOut[paramID]; - param.input2f = eParamsOut[paramID + 10]; - } - EM_checkParams(); - for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) { - eCertainStatus = uncertainty.update(eCertainMode); - } - } - - @Override - public boolean isCorrectMachinePart(ItemStack itemStack) { - return true; - } - - @Override - public int getDamageToComponent(ItemStack itemStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack itemStack) { - return false; - } - - @Override - public void explodeMultiblock() {//BEST METHOD EVER!!! - if (!TecTech.ModConfig.BOOM_ENABLE) { - TecTech.proxy.broadcast("Multi Explode BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); - StackTraceElement[] ste = Thread.currentThread().getStackTrace(); - TecTech.proxy.broadcast("Multi Explode BOOM! " + ste[2].toString()); - return; - } - GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 600000); - mInventory[1] = null; - for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : eParamHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : eInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : eOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : eMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : eEnergyMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - for (MetaTileEntity tTileEntity : eUncertainHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - for (MetaTileEntity tTileEntity : eDynamoMulti) tTileEntity.getBaseMetaTileEntity().doExplosion(V[14]); - getBaseMetaTileEntity().doExplosion(V[15]); - } - - @Override - public final boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) - 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_Param) - 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_EnergyMulti) - return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); - return false; - } - - @Override - public final boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_MufflerElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eMufflerHatches.add((GT_MetaTileEntity_Hatch_MufflerElemental) aMetaTileEntity); - } - return false; - } - - @Override - public final boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } - return false; - } - - @Override - public final boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } - return false; - } - - @Deprecated - @Override - public final boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); - } - return false; - } - - @Deprecated - @Override - public final boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { - ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); - } - return false; - } - - //New Method - public final boolean addEnergyIOToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { - ((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addElementalInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - //((GT_MetaTileEntity_Hatch_Elemental) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return eInputHatches.add((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addElementalOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputElemental) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eOutputHatches.add((GT_MetaTileEntity_Hatch_OutputElemental) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addClassicInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addClassicOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addParametrizerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addUncertainToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); - } - return false; - } - - @Override - public final boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Param) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Uncertainty) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return eUncertainHatches.add((GT_MetaTileEntity_Hatch_Uncertainty) aMetaTileEntity); - } - return false; - } - - //NEW METHOD - public final boolean addClassicMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - return false; - } - - @Override - public String[] getInfoData() {//TODO Do it - long storedEnergy = 0; - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - - return new String[]{ - "Progress:", - EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - "Energy Hatches:", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU", - (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Integer.toString(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier()] + EnumChatFormatting.RESET + - " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", - "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid - }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - //Check Machine Structure based on string array array, ond offset of the controller - public static boolean stuctureCheck(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, - IGregTechTileEntity aBaseMetaTileEntity) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - - int x, y, z, a, c;//b is y no matter what - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - y = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block > '`') {//small characters allow to skip check a-1 skip, b-2 skips etc. - a += block - '`'; - } else { - //get x y z from rotation - switch (facing) {//translation - case 4: - x = c; - z = a; - break; - case 3: - x = a; - z = -c; - break; - case 5: - x = -c; - z = -a; - break; - case 2: - x = -a; - z = c; - break; - default: - return false; - } - //Check block - switch (block) { - case '-'://must be air - if (!aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; - break; - case '+'://must not be air - if (aBaseMetaTileEntity.getAirOffset(x, y, z)) return false; - break; - default: {//check for block (countable) - int pointer = block - '0'; - //countable air -> net.minecraft.block.BlockAir - if (aBaseMetaTileEntity.getBlockOffset(x, y, z) != blockType[pointer]) { - if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + aBaseMetaTileEntity.getBlockOffset(x, y, z) + " " + blockType[pointer]); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != blockMeta[pointer]) { - if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + aBaseMetaTileEntity.getMetaIDOffset(x, y, z) + " " + blockMeta[pointer]); - return false; - } - } - } - a++;//block in horizontal layer - } - } - y--;//horizontal layer - } - c++;//depth - } - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Nothing special just override me." - }; - } - - @Override - public void onRemoval() { - try { - if (eOutputHatches != null) { - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) - hatch_elemental.id = -1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) - hatch_elemental.id = -1; - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) - hatch.getBaseMetaTileEntity().setActive(false); - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) - hatch.getBaseMetaTileEntity().setActive(false); - } - if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock(); - else if (outputEM != null) - for (cElementalInstanceStackTree output : outputEM) - if (output.hasStacks()) { - explodeMultiblock(); - return; - } - } catch (Exception e) { - if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); - } - } - - protected boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { - if (!GregTech_API.sPostloadFinished) return false; - if (requiredFluidInputs.length > 0 && givenFluidInputs == null) return false; - int amt; - for (FluidStack tFluid : requiredFluidInputs) - if (tFluid != null) { - boolean temp = true; - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aFluid.amount; - if (amt < 1) { - temp = false; - break; - } - } - if (temp) return false; - } - - if (requiredInputs.length > 0 && givenInputs == null) return false; - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - boolean temp = true; - for (ItemStack aStack : givenInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) return false; - } - } - - if (aDecreaseStacksizeBySuccess) { - if (givenFluidInputs != null) { - for (FluidStack tFluid : requiredFluidInputs) { - if (tFluid != null) { - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - aFluid.amount -= amt; - break; - } - if (aFluid.amount < amt) { - amt -= aFluid.amount; - aFluid.amount = 0; - } else { - aFluid.amount -= amt; - amt = 0; - break; - } - } - } - } - } - } - - if (givenInputs != null) { - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - for (ItemStack aStack : givenInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { - if (aDontCheckStackSizes) { - aStack.stackSize -= amt; - break; - } - if (aStack.stackSize < amt) { - amt -= aStack.stackSize; - aStack.stackSize = 0; - } else { - aStack.stackSize -= amt; - amt = 0; - break; - } - } - } - } - } - } - } - - return true; - } - - /** - * finds a Recipe matching the aFluid and ItemStack Inputs. - * - * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs - * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param aFluids the Fluid Inputs - * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. - * @param aInputs the Item Inputs - * @return the Recipe it has found or null for no matching Recipe - */ - - //protected static GT_Recipe findRecipe(boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - // // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. - // // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. - // if (GregTech_API.sPostloadFinished) { - // if (mMinimalInputFluids > 0) { - // if (aFluids == null) return null; - // int tAmount = 0; - // for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; - // if (tAmount < mMinimalInputFluids) return null; - // } - // if (mMinimalInputItems > 0) { - // if (aInputs == null) return null; - // int tAmount = 0; - // for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - // if (tAmount < mMinimalInputItems) return null; - // } - // } - // // Unification happens here in case the Input isn't already unificated. - // if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); - // // Check the Recipe which has been used last time in order to not have to search for it again, if possible. - // if (aRecipe != null) - // if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; - // // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - // if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - // if (tStack != null) { - // Collection - // tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // } - // // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - // if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - // if (aFluid != null) { - // Collection - // tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - // if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - // if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - // return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - // } - // // And nothing has been found. - // return null; - //} -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java deleted file mode 100644 index 2ea5a0288d..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -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 net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import static gregtech.api.enums.GT_Values.V; - -/** - * Created by danie_000 on 16.12.2016. - */ -public class GT_MetaTileEntity_Hatch_DynamoMulti extends GT_MetaTileEntity_Hatch implements machineTT { - public final int Amperes; - - public GT_MetaTileEntity_Hatch_DynamoMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { - super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Extractor for Multiblocks"); - Amperes = aAmp; - } - - public GT_MetaTileEntity_Hatch_DynamoMulti(String aName, int aTier, int aAmp, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - Amperes = aAmp; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; - } - - @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 isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512 * Amperes; - } - - @Override - public long maxEUOutput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; - } - - @Override - public long maxAmperesOut() { - return Amperes; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_DynamoMulti(mName, mTier, Amperes, mDescription, mTextures); - } - - @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 String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription - //"Amperes Out: "+ EnumChatFormatting.AQUA+Amperes+" A" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java deleted file mode 100644 index 9405b888df..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -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 net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static gregtech.api.enums.GT_Values.V; - -/** - * Created by danie_000 on 16.12.2016. - */ -public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch implements machineTT { - public final int Amperes; - - public GT_MetaTileEntity_Hatch_EnergyMulti(int aID, String aName, String aNameRegional, int aTier, int aAmp) { - super(aID, aName, aNameRegional, aTier, 0, "Multiple Ampere Energy Injector for Multiblocks"); - Amperes = aAmp; - } - - public GT_MetaTileEntity_Hatch_EnergyMulti(String aName, int aTier, int aAmp, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - Amperes = aAmp; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_POWER[mTier]}; - } - - @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 isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isValidSlot(int aIndex) { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512L * Amperes; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; - } - - @Override - public long maxAmperesIn() { - return Amperes + (Amperes >> 2); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_EnergyMulti(mName, mTier, Amperes, mDescription, mTextures); - } - - @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 String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription, - "Amperes In: " + EnumChatFormatting.AQUA + maxAmperesIn() + " A" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java deleted file mode 100644 index 7d99da18af..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import com.github.technus.tectech.things.metaTileEntity.GT_MetaTileEntity_Hatch_ElementalContainer; - -/** - * Created by danie_000 on 27.10.2016. - */ -public class GT_MetaTileEntity_Hatch_InputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { - public GT_MetaTileEntity_Hatch_InputElemental(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Elemental Input for Multiblocks (" + 1000 * aTier * (aTier - 7) + "U, " + aTier * 2 + " stacks)"); - } - - public GT_MetaTileEntity_Hatch_InputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_InputElemental(mName, mTier, mDescription, mTextures); - } - - @Override - public boolean isInputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isOutputFacing(byte aSide) { - return false; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean canConnect(byte side) { - return isInputFacing(side); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java deleted file mode 100644 index c0be04c717..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -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.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.EnumSkyBlock; - -import static com.github.technus.tectech.elementalMatter.commonValues.disperseAt; -import static gregtech.api.enums.Dyes.MACHINE_METAL; -import static gregtech.api.enums.GT_Values.V; -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 implements machineTT { - private static Textures.BlockIcons.CustomIcon EM_T_SIDES; - private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; - private static Textures.BlockIcons.CustomIcon MufflerEM; - public float overflowMatter = 0f; - public final float overflowMax; - public final float overflowDisperse; - - 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); - } - - 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); - } - - @Override - 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"); - } - - @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(Textures.BlockIcons.OVERLAY_MUFFLER)}; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription, - "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c^2", - "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c^2)/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, 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) == disperseAt) { - 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()); - } - } 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.particles(getBaseMetaTileEntity(), getBaseMetaTileEntity().getFrontFacing()); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - //DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!) - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[]{ - "Contained mass:", - EnumChatFormatting.RED + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c^2 /", - EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c^2", - "Mass Disposal speed: " + EnumChatFormatting.BLUE + Double.toString(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c^2)/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()); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java deleted file mode 100644 index 2fde75c76a..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_Utility; - -/** - * Created by danie_000 on 27.10.2016. - */ -public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_Hatch_ElementalContainer { - public GT_MetaTileEntity_Hatch_OutputElemental(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Elemental Output for Multiblocks (" + 1000 * aTier * (aTier - 7) + "U, " + aTier * 2 + " stacks)"); - } - - public GT_MetaTileEntity_Hatch_OutputElemental(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_OutputElemental(mName, mTier, mDescription, mTextures); - } - - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isInputFacing(byte aSide) { - return false; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { - byte color = getBaseMetaTileEntity().getColorization(); - if (color < 0) return; - byte front = aBaseMetaTileEntity.getFrontFacing(); - byte opposite = GT_Utility.getOppositeSide(getBaseMetaTileEntity().getFrontFacing()); - for (byte dist = 1; dist < 16; dist++) { - IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSideAndDistance(front, dist); - if (tGTTileEntity != null && tGTTileEntity.getColorization() == color) { - IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null) { - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && - opposite == aMetaTileEntity.getBaseMetaTileEntity().getFrontFacing()) { - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); - content.clear(); - return; - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Pipe_EM) { - if (((GT_MetaTileEntity_Pipe_EM) aMetaTileEntity).connectionCount > 2) return; - } else return; - } else return; - } else return; - } - } - - @Override - public boolean canConnect(byte side) { - return isOutputFacing(side); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java deleted file mode 100644 index 9d24109e04..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.things.metaTileEntity.hatch.gui.GT_Container_Param; -import com.github.technus.tectech.things.metaTileEntity.hatch.gui.GT_GUIContainer_Param; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by danie_000 on 15.12.2016. - */ -public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch implements machineTT { - public int exponent = 0; - public int value2 = 0; - public int value1 = 0; - public int param = -1; - public float value1f = 0; - public float value2f = 0; - public float input1f = 0; - public float input2f = 0; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenOFF; - - public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks"); - } - - public GT_MetaTileEntity_Hatch_Param(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - super.registerIcons(aBlockIconRegister); - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/PARAM"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/PARAM_ACTIVE"); - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; - } - - //@Override - //public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // if (aBaseMetaTileEntity.isClientSide() && (aTick % 20L == 0L)) { - // //refresh casing on state change - // int Xpos = aBaseMetaTileEntity.getXCoord(); - // int Ypos = aBaseMetaTileEntity.getYCoord(); - // int Zpos = aBaseMetaTileEntity.getZCoord(); - // try { - // aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(Xpos , Ypos, Zpos , Xpos , Ypos, Zpos ); - // } catch (Exception e) {} - // } - // super.onPostTick(aBaseMetaTileEntity, aTick); - //} - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_Hatch_Param(mName, mTier, mDescription, mTextures); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[]{ - "Parameter ID: " + EnumChatFormatting.GREEN + param, - "Value 1: " + EnumChatFormatting.AQUA + value1f, - "Value 2: " + EnumChatFormatting.BLUE + value2f, - "Input 1: " + EnumChatFormatting.GOLD + input1f, - "Input 2: " + EnumChatFormatting.YELLOW + input2f - }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @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; - } - - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mEXP", exponent); - aNBT.setInteger("mV2", value2); - aNBT.setInteger("mV1", value1); - aNBT.setInteger("mParam", param); - //aNBT.setFloat("mI1",input1f);//no need to store this. - //aNBT.setFloat("mI2",input2f); - } - - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - exponent = aNBT.getInteger("mEXP"); - value2 = aNBT.getInteger("mV2"); - value1 = aNBT.getInteger("mV1"); - param = aNBT.getInteger("mParam"); - value1f = (float) (value1 * Math.pow(2, exponent)); - value2f = (float) (value2 * Math.pow(2, exponent)); - //input1f=aNBT.getFloat("mI1"); - //input2f=aNBT.getFloat("mI2"); - } - - @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 boolean isLiquidInput(byte aSide) { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return false; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=M*C^2" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java deleted file mode 100644 index b2ff50ed37..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.things.metaTileEntity.hatch.gui.GT_Container_Uncertainty; -import com.github.technus.tectech.things.metaTileEntity.hatch.gui.GT_GUIContainer_Uncertainty; -import com.github.technus.tectech.things.metaTileEntity.hatch.gui.GT_GUIContainer_UncertaintyAdv; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by danie_000 on 15.12.2016. - */ -public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch implements machineTT { - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static float errorMargin = 0.05f; - public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; - public byte selection = -1, mode = 0, status = -128; - - public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?"); - regenerate(); - } - - public GT_MetaTileEntity_Hatch_Uncertainty(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - regenerate(); - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - super.registerIcons(aBlockIconRegister); - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/UC"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/UC_ACTIVE"); - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 6) return new GT_GUIContainer_UncertaintyAdv(aPlayerInventory, aBaseMetaTileEntity); - return new GT_GUIContainer_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)}; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && (aTick & 15) == 0) { - shift(); - compute(); - if (mode == 0) aBaseMetaTileEntity.setActive(false); - else aBaseMetaTileEntity.setActive(true); - } - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_Hatch_Uncertainty(mName, mTier, mDescription, mTextures); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return new String[]{ - "Status: " + EnumChatFormatting.GOLD + status - }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @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; - } - - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("mSel", selection); - aNBT.setByte("mMode", mode); - aNBT.setByte("mStatus", status); - NBTTagCompound mat = new NBTTagCompound(); - for (int i = 0; i < 16; i++) - mat.setShort(Integer.toString(i), matrix[i]); - aNBT.setTag("mMat", mat); - } - - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - selection = aNBT.getByte("mSel"); - mode = aNBT.getByte("mMode"); - status = aNBT.getByte("mStatus"); - NBTTagCompound mat = aNBT.getCompoundTag("mMat"); - for (int i = 0; i < 16; i++) - matrix[i] = mat.getShort(Integer.toString(i)); - } - - @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 boolean isLiquidInput(byte aSide) { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return false; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Schrödinger equation in a box" - }; - } - - private float massOffset(int sideLenY, int sideLenX, short... masses) { - int mass = 0; - int massI = 0, massJ = 0; - for (int i = 0; i < sideLenY; i++) { - for (int j = 0; j < sideLenY * sideLenX; j += sideLenY) { - mass += masses[i + j]; - massI += ((float) i - ((float) sideLenY / 2f) + .5f) * masses[i + j]; - massJ += ((float) (j / sideLenY) - ((float) sideLenX / 2f) + .5f) * masses[i + j]; - } - } - return ((Math.abs(massI / (float) mass) / (float) sideLenY) + (Math.abs(massJ / (float) mass)) / (float) sideLenX); - } - - public void regenerate() { - for (int i = 0; i < matrix.length; i++) - matrix[i] = (short) TecTech.Rnd.nextInt(1000); - } - - public byte compute() { - int result = 0; - switch (mode) { - case 1://ooo oxo ooo - result = (massOffset(4, 4, matrix) < errorMargin) ? 0 : 1; - break; - case 2://ooo xox ooo - result += (massOffset(4, 2, - matrix[0], matrix[4], - matrix[1], matrix[5], - matrix[2], matrix[6], - matrix[3], matrix[7]) < errorMargin) ? 0 : 1; - result += (massOffset(4, 2, - matrix[8], matrix[12], - matrix[9], matrix[13], - matrix[10], matrix[14], - matrix[11], matrix[15]) < errorMargin) ? 0 : 2; - break; - case 3://oxo xox oxo - result += (massOffset(2, 4, - matrix[0], matrix[4], matrix[8], matrix[12], - matrix[1], matrix[5], matrix[9], matrix[13]) < errorMargin) ? 0 : 1; - result += (massOffset(4, 2, - matrix[0], matrix[4], - matrix[1], matrix[5], - matrix[2], matrix[6], - matrix[3], matrix[7]) < errorMargin) ? 0 : 2; - result += (massOffset(4, 2, - matrix[8], matrix[12], - matrix[9], matrix[13], - matrix[10], matrix[14], - matrix[11], matrix[15]) < errorMargin) ? 0 : 4; - result += (massOffset(2, 4, - matrix[2], matrix[6], matrix[10], matrix[14], - matrix[3], matrix[7], matrix[11], matrix[15]) < errorMargin) ? 0 : 8; - break; - case 4://xox ooo xox - result += (massOffset(2, 2, - matrix[0], matrix[4], - matrix[1], matrix[5]) < errorMargin) ? 0 : 1; - result += (massOffset(2, 2, - matrix[8], matrix[12], - matrix[9], matrix[13]) < errorMargin) ? 0 : 2; - result += (massOffset(2, 2, - matrix[2], matrix[6], - matrix[3], matrix[7]) < errorMargin) ? 0 : 4; - result += (massOffset(2, 2, - matrix[10], matrix[14], - matrix[11], matrix[15]) < errorMargin) ? 0 : 8; - break; - case 5://xox oxo xox - result += (massOffset(2, 2, - matrix[0], matrix[4], - matrix[1], matrix[5]) < errorMargin) ? 0 : 1; - result += (massOffset(2, 2, - matrix[8], matrix[12], - matrix[9], matrix[13]) < errorMargin) ? 0 : 2; - result += (massOffset(4, 4, matrix) < errorMargin) ? 0 : 4; - result += (massOffset(2, 2, - matrix[2], matrix[6], - matrix[3], matrix[7]) < errorMargin) ? 0 : 8; - result += (massOffset(2, 2, - matrix[10], matrix[14], - matrix[11], matrix[15]) < errorMargin) ? 0 : 16; - break; - } - return status = (byte) result; - } - - private void shift() {//TODO MAKE IT MORE EVIL - final int i = TecTech.Rnd.nextInt(16), j = TecTech.Rnd.nextInt(2); - matrix[i] += (((matrix[i] & 1) == 0) ? 2 : -2) * j; - switch (matrix[i]) { - case 1002: - matrix[i] -= 3; - break; - case 1001: - matrix[i] -= 1; - break; - case -1: - matrix[i] += 1; - break; - case -2: - matrix[i] += 3; - break; - } - } - - public byte update(int newMode) { - if (newMode == mode) return mode; - if (newMode < 0 || newMode > 5) newMode = 0; - mode = (byte) newMode; - regenerate(); - compute(); - return status; - } - - //@Override - //public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - // if(aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - // changeMode(++mode); - // GT_Utility.sendChatToPlayer(aPlayer, "Equation mode: "+mode); - // } - //} -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Param.java deleted file mode 100644 index a5d22870a6..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Param.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch.gui; - -import com.github.technus.tectech.things.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import java.util.Iterator; - -public final class GT_Container_Param extends GT_ContainerMetaTile_Machine { - public int exponent = 0; - public int value2 = 0; - public int value1 = 0; - public int param = 0; - public float value2f = 0; - public float value1f = 0; - public float input1f = 0; - private int input1Bits = 0; - public float input2f = 0; - private int input2Bits = 0; - - public GT_Container_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - boolean doStuff = true; - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); - switch (aSlotIndex) { - case 0: - paramH.param -= (aShifthold == 1 ? 512 : 64); - break; - case 1: - paramH.value1 -= (aShifthold == 1 ? 512 : 64); - break; - case 2: - paramH.value2 -= (aShifthold == 1 ? 512 : 64); - break; - case 3: - paramH.exponent -= (aShifthold == 1 ? 16 : 8); - break; - case 4: - paramH.param -= (aShifthold == 1 ? 16 : 1); - break; - case 5: - paramH.value1 -= (aShifthold == 1 ? 16 : 1); - break; - case 6: - paramH.value2 -= (aShifthold == 1 ? 16 : 1); - break; - case 7: - paramH.exponent -= (aShifthold == 1 ? 4 : 1); - break; - case 8: - paramH.param += (aShifthold == 1 ? 512 : 64); - break; - case 9: - paramH.value1 += (aShifthold == 1 ? 512 : 64); - break; - case 10: - paramH.value2 += (aShifthold == 1 ? 512 : 64); - break; - case 11: - paramH.exponent += (aShifthold == 1 ? 16 : 8); - break; - case 12: - paramH.param += (aShifthold == 1 ? 16 : 1); - break; - case 13: - paramH.value1 += (aShifthold == 1 ? 16 : 1); - break; - case 14: - paramH.value2 += (aShifthold == 1 ? 16 : 1); - break; - case 15: - paramH.exponent += (aShifthold == 1 ? 4 : 1); - break; - default: - doStuff = false; - } - if (doStuff) { - if (paramH.param > 9) paramH.param = 9; - if (paramH.param < -1) paramH.param = -1; - paramH.value1f = (float) (paramH.value1 * Math.pow(2, paramH.exponent)); - paramH.value2f = (float) (paramH.value2 * Math.pow(2, paramH.exponent)); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; - this.value1 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1; - this.value2 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value2; - this.exponent = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).exponent; - this.input1Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1f); - this.input2Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input2f); - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); - var1.sendProgressBarUpdate(this, 101, this.param >>> 16); - var1.sendProgressBarUpdate(this, 102, this.value1 & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.value1 >>> 16); - var1.sendProgressBarUpdate(this, 104, this.value2 & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, this.value2 >>> 16); - var1.sendProgressBarUpdate(this, 106, this.exponent & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, this.exponent >>> 16); - var1.sendProgressBarUpdate(this, 108, this.input1Bits & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, this.input1Bits >>> 16); - var1.sendProgressBarUpdate(this, 110, this.input2Bits & 0xFFFF); - var1.sendProgressBarUpdate(this, 111, this.input2Bits >>> 16); - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.param = (this.param & 0xFFFF0000 | par2); - return; - case 101: - this.param = (this.param & 0xFFFF | par2 << 16); - return; - case 102: - this.value1 = (this.value1 & 0xFFFF0000 | par2); - break; - case 103: - this.value1 = (this.value1 & 0xFFFF | par2 << 16); - break; - case 104: - this.value2 = (this.value2 & 0xFFFF0000 | par2); - break; - case 105: - this.value2 = (this.value2 & 0xFFFF | par2 << 16); - break; - case 106: - this.exponent = (this.exponent & 0xFFFF0000 | par2); - break; - case 107: - this.exponent = (this.exponent & 0xFFFF | par2 << 16); - break; - case 108: - this.input1Bits = (this.input1Bits & 0xFFFF0000 | par2); - this.input1f = Float.intBitsToFloat(input1Bits); - return; - case 109: - this.input1Bits = (this.input1Bits & 0xFFFF | par2 << 16); - this.input1f = Float.intBitsToFloat(input1Bits); - return; - case 110: - this.input2Bits = (this.input2Bits & 0xFFFF0000 | par2); - this.input2f = Float.intBitsToFloat(input2Bits); - return; - case 111: - this.input2Bits = (this.input2Bits & 0xFFFF | par2 << 16); - this.input2f = Float.intBitsToFloat(input2Bits); - return; - default: - return; - } - this.value1f = (float) (this.value1 * Math.pow(2, this.exponent)); - this.value2f = (float) (this.value2 * Math.pow(2, this.exponent)); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java deleted file mode 100644 index fc940d168e..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch.gui; - -import com.github.technus.tectech.things.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Uncertainty; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import java.util.Iterator; - -public final class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { - public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; - public byte selection = -1, mode = 0, status = -128; - - public GT_Container_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_Hatch_Uncertainty catH = (GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity(); - if (aSlotIndex < 16 && catH.matrix != null) { - if (catH.selection == -1) { - catH.selection = (byte) (aSlotIndex); - } else { - short temp = catH.matrix[catH.selection]; - catH.matrix[catH.selection] = catH.matrix[aSlotIndex]; - catH.matrix[aSlotIndex] = temp; - catH.selection = -1; - } - - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - - ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).compute(); - - if (this.matrix != null) - for (int i = 0; i < 16; i++) - this.matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).matrix[i]; - - this.selection = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).selection; - this.mode = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).mode; - this.status = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).status; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.selection); - var1.sendProgressBarUpdate(this, 101, this.mode); - var1.sendProgressBarUpdate(this, 102, this.status); - - if (this.matrix != null) - for (int i = 0; i < 16; i++) - var1.sendProgressBarUpdate(this, 103 + i, this.matrix[i]); - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.selection = (byte) par2; - break; - case 101: - this.mode = (byte) par2; - break; - case 102: - this.status = (byte) par2; - break; - default: - if (matrix != null && par1 >= 103 && par1 < 119) { - this.matrix[par1 - 103] = (short) par2; - break; - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java deleted file mode 100644 index 4564266040..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -import static com.github.technus.tectech.TecTech.proxy; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -public final class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { - public GT_GUIContainer_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_Param(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Parametrizer.png"); - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - if (this.mContainer != null) { - proxy.renderUnicodeString("Parametrizer: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input1f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2461\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input2f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value1f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2461\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value2f), 46, 41, 167, 0x0077ff); - proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value1, 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("M\u2461: " + ((GT_Container_Param) this.mContainer).value2, 46, 58, 167, 0x0077ff); - proxy.renderUnicodeString("E\u2460\u2461: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66, 167, 0x0033ff); - } else { - proxy.renderUnicodeString("Parametrizer", 46, 7, 167, 0xffffff); - } - //167 - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java deleted file mode 100644 index 834ba9c6da..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch.gui; - -import com.github.technus.tectech.TecTech; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import org.lwjgl.opengl.GL11; - -import static com.github.technus.tectech.TecTech.proxy; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine { - public GT_GUIContainer_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - proxy.renderUnicodeString("Schrödinger", 46, 7, 167, 0xffffff); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) - proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); - else - proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - final short bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; - x += 52; - y += 33; - final int state = ((GT_Container_Uncertainty) this.mContainer).status; - switch (((GT_Container_Uncertainty) this.mContainer).mode) { - case 1://ooo oxo ooo - drawTexturedModalRect(x + 12, y + 12, - rU + (state == 0 ? 76 : 12), - Vs + 12, 10, 10); - break; - case 2://ooo xox ooo - drawTexturedModalRect(x, y + 12, - rU + ((state & 1) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 2) == 0 ? 88 : 24), - Vs + 12, 10, 10); - break; - case 3://oxo xox oxo - drawTexturedModalRect(x + 12, y, - rU + ((state & 1) == 0 ? 76 : 12), - Vs, 10, 10); - drawTexturedModalRect(x, y + 12, - rU + ((state & 2) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 4) == 0 ? 88 : 24), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 12, y + 24, - rU + ((state & 8) == 0 ? 76 : 12), - Vs + 24, 10, 10); - break; - case 4://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 4) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 8) == 0 ? 88 : 24), - Vs + 24, 10, 10); - break; - case 5://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 4) == 0 ? 76 : 12), - Vs + 12, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 8) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 16) == 0 ? 88 : 24), - Vs + 24, 10, 10); - break; - } - x -= 6; - y -= 6; - for (int i = 0; i < 16; i++) - if (TecTech.Rnd.nextInt(1000) < ((GT_Container_Uncertainty) this.mContainer).matrix[i]) - drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), - fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); - if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) this.mContainer).selection; - drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), - bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java deleted file mode 100644 index 241630ddd4..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.hatch.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import org.lwjgl.opengl.GL11; - -import static com.github.technus.tectech.TecTech.proxy; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import static org.lwjgl.opengl.GL11.*; - -public final class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Machine { - protected static final short sX = 52, sY = 33, bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; - - public GT_GUIContainer_UncertaintyAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - proxy.renderUnicodeString("Schrödinger X", 46, 7, 167, 0xffffff); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) - proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); - else - proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - x += sX; - y += sY; - final int state = ((GT_Container_Uncertainty) this.mContainer).status; - switch (((GT_Container_Uncertainty) this.mContainer).mode) { - case 1://ooo oxo ooo - drawTexturedModalRect(x + 12, y + 12, - rU + (state == 0 ? 76 : 12), - Vs + 12, 10, 10); - break; - case 2://ooo xox ooo - drawTexturedModalRect(x, y + 12, - rU + ((state & 1) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 2) == 0 ? 88 : 24), - Vs + 12, 10, 10); - break; - case 3://oxo xox oxo - drawTexturedModalRect(x + 12, y, - rU + ((state & 1) == 0 ? 76 : 12), - Vs, 10, 10); - drawTexturedModalRect(x, y + 12, - rU + ((state & 2) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 4) == 0 ? 88 : 24), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 12, y + 24, - rU + ((state & 8) == 0 ? 76 : 12), - Vs + 24, 10, 10); - break; - case 4://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 4) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 8) == 0 ? 88 : 24), - Vs + 24, 10, 10); - break; - case 5://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 4) == 0 ? 76 : 12), - Vs + 12, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 8) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 16) == 0 ? 88 : 24), - Vs + 24, 10, 10); - break; - } - x -= 6; - y -= 6; - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - for (int i = 0; i < 16; i++) { - GL11.glColor4f(1f, 1f, 1f, (float) ((GT_Container_Uncertainty) this.mContainer).matrix[i] / 1000f); - drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), - fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); - } - glDisable(GL_BLEND); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) this.mContainer).selection; - drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), - bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java deleted file mode 100644 index e9742363f1..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.things.block.QuantumGlass; -import com.github.technus.tectech.things.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static gregtech.api.enums.GT_Values.E; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_EM { - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT - //Startcodes to startup - //per dim disable thingies - private static final String[] s = new String[]{ - "f202", "f020", "g0", "c5g5", "d55c55", "f0a0", "e21212", - "d00c00", "c0g0", "b0i0", "a20i02", "a02i20", "d0024200", - "c022c220", "b02g20", "02k20", "a03i30", "21k12" - }; - private static final String[][] S = new String[][]{ - {E, E, E, E, E, E, s[0], s[5], s[0]},//front - {E, E, E, E, s[2], s[0], s[6], "d0033300", s[6], s[0], s[2]}, - {E, E, E, s[2], s[1], s[1], s[7], "c033c330", s[7], s[1], s[1], s[2]}, - {E, E, s[2], s[1], s[4], s[4], s[8], "b03g30", s[8], s[4], s[4], s[1], s[2]}, - {E, s[2], s[1], s[4], s[3], s[3], s[9], s[16], s[9], s[3], s[3], s[4], s[1], s[2]}, - {E, s[0], s[1], s[4], s[3], s[3], s[10], s[16], s[10], s[3], s[3], s[4], s[1], s[0]}, - {s[0], s[6], s[7], s[8], s[9], s[10], s[17], "03k30", s[17], s[10], s[9], s[8], s[7], s[6], s[0]}, - {s[5], s[12], s[13], s[14], s[11], s[11], s[15], "a3k3", s[15], s[11], s[11], s[14], s[13], s[12], s[5]} - }; - private static final String[][] shape = new String[][]{ - S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], S[6], S[5], S[4], S[3], S[2], S[1], S[0] - }; - private static final Block[] blockType = new Block[]{ - GT_Container_CasingsTT.sBlockCasingsTT, - GT_Container_CasingsTT.sBlockCasingsTT, - GT_Container_CasingsTT.sBlockCasingsTT, - GT_Container_CasingsTT.sBlockCasingsTT, - GT_Container_CasingsTT.sBlockCasingsTT, - QuantumGlass.INSTANCE}; - private static final byte[] blockMeta = new byte[]{3, 4, 5, 6, 7, 0}; - - public GT_MetaTileEntity_EM_bhg(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_bhg(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_bhg(this.mName); - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return stuctureCheck(shape, blockType, blockMeta, 7, 7, 0, iGregTechTileEntity); - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Singularity decay based power generation.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java deleted file mode 100644 index f6ab3bd375..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM { - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - - //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_collider(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(this.mName); - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Collide matter at extreme velocities.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light!!!" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java deleted file mode 100644 index 71fa9a0600..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM { - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - public GT_MetaTileEntity_EM_computer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_computer(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_computer(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Processing quantum matter since...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java deleted file mode 100644 index e19291f538..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_crafter extends GT_MetaTileEntity_MultiblockBase_EM { - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - public GT_MetaTileEntity_EM_crafter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_crafter(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_crafter(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "The most precise way of making stuff.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java deleted file mode 100644 index e94673e5c7..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantifier.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.things.block.QuantumGlass; -import com.github.technus.tectech.things.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_dequantifier extends GT_MetaTileEntity_MultiblockBase_EM { - - public GT_MetaTileEntity_EM_dequantifier(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_dequantifier(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_dequantifier(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 99)) && - (!addElementalInputToMachineList(tTileEntity, 99)) && - (!addClassicOutputToMachineList(tTileEntity, 99)) && - (!addMufflerToMachineList(tTileEntity, 99)) && - (!addEnergyIOToMachineList(tTileEntity, 99))) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { - return false; - } - } - } - } - } - } - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Transform quantum form back to regular one...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "but why?" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java deleted file mode 100644 index 4d1524aed5..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.things.block.QuantumGlass; -import com.github.technus.tectech.things.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import static gregtech.api.enums.GT_Values.V; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM { - public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_junction(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_junction(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 99)) && - (!addElementalInputToMachineList(tTileEntity, 99)) && - (!addElementalOutputToMachineList(tTileEntity, 99)) && - (!addMufflerToMachineList(tTileEntity, 99)) && - (!addEnergyIOToMachineList(tTileEntity, 99))) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { - return false; - } - } - } - } - } - } - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Reroutes Matter", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Axis aligned movement!" - }; - } - - @Override - public void EM_checkParams() { - for (int i = 0; i < 10; i++) { - if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; - else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; - else if ((int) eParamsIn[i] > eInputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; - } - for (int i = 10; i < 20; i++) { - if (eParamsInStatus[i - 10] == PARAM_OK) { - if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; - else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_LOW; - else if ((int) eParamsIn[i] > eOutputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; - } else { - eParamsInStatus[i] = PARAM_UNUSED; - } - } - } - - @Override - public boolean EM_checkRecipe(ItemStack itemStack) { - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) - if (in.getContainerHandler().hasStacks()) { - mEUt = -(int) V[8]; - eAmpereFlow = 1 + ((eInputHatches.size() + eOutputHatches.size()) >> 1); - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - return true; - } - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - return false; - } - - @Override - public void EM_outputFunction() { - for (int i = 0; i < 10; i++) { - final int inIndex = (int) (eParamsIn[i]) - 1; - if (inIndex < 0 || inIndex > eInputHatches.size()) continue; - final int outIndex = (int) (eParamsIn[i + 10]) - 1; - GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); - if (outIndex == -1) { - cleanHatchContent(in); - } else { - GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); - out.getContainerHandler().putUnifyAll(in.getContainerHandler()); - in.getContainerHandler().clear(); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java deleted file mode 100644 index 9a25c057f1..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM { - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - 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(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Processing quantum matter since...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java deleted file mode 100644 index 719bb221ec..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_quantifier.java +++ /dev/null @@ -1,388 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.things.block.QuantumGlass; -import com.github.technus.tectech.things.casing.GT_Container_CasingsTT; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; -import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; -import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; - -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getBestUnstableIsotope; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getFirstStableIsotope; -import static gregtech.api.enums.GT_Values.V; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_quantifier extends GT_MetaTileEntity_MultiblockBase_EM { - public static HashMap itemBinds = new HashMap<>(32); - public static HashMap fluidBind = new HashMap<>(8); - private static float refMass, refUnstableMass; - - public GT_MetaTileEntity_EM_quantifier(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_quantifier(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_quantifier(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != QuantumGlass.INSTANCE) return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 99)) && - (!addClassicInputToMachineList(tTileEntity, 99)) && - (!addElementalOutputToMachineList(tTileEntity, 99)) && - (!addMufflerToMachineList(tTileEntity, 99)) && - (!addEnergyIOToMachineList(tTileEntity, 99))) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != GT_Container_CasingsTT.sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { - return false; - } - } - } - } - } - } - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Conveniently convert regular stuff into quantum form.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "To make it more inconvenient." - }; - } - - @Override - public boolean EM_checkRecipe(ItemStack itemStack) { - if (GregTech_API.sPostloadFinished) { - ItemStack[] inI = getStoredInputs().toArray(new ItemStack[0]); - if (inI.length > 0) { - for (ItemStack is : inI) { - int[] oreIDs = OreDictionary.getOreIDs(is); - if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Quantifier-recipe " + is.getItem().getUnlocalizedName() + "." + is.getItemDamage() + " " + is.getDisplayName()); - for (int ID : oreIDs) { - if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Quantifier-recipe " + is.getItem().getUnlocalizedName() + "." + is.getItemDamage() + " " + OreDictionary.getOreName(ID)); - cElementalDefinitionStack into = itemBinds.get(ID); - if (into != null && isInputEqual(true, false, - nothingF, new ItemStack[]{new ItemStack(is.getItem(), 1, is.getItemDamage())}, null, inI)) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - float mass = into.getMass(); - float euMult = mass / refMass; - eAmpereFlow = (int) Math.ceil(euMult); - if (mass > refUnstableMass) { - mEUt = (int) -V[9]; - } else { - mEUt = (int) -V[8]; - } - outputEM = new cElementalInstanceStackTree[1]; - outputEM[0] = new cElementalInstanceStackTree(new cElementalInstanceStack(into)); - return true; - } - } - } - } - FluidStack[] inF = getStoredFluids().toArray(new FluidStack[0]); - if (inF.length > 0) { - for (FluidStack fs : inF) { - cElementalDefinitionStack into = fluidBind.get(fs.getFluid().getID()); - if (into != null && fs.amount >= 144 && isInputEqual(true, false, - new FluidStack[]{new FluidStack(fs.getFluid(), 144)}, nothingI, inF, (ItemStack[]) null)) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - float mass = into.getMass(); - float euMult = mass / refMass; - eAmpereFlow = (int) Math.ceil(euMult); - if (mass > refUnstableMass) { - mEUt = (int) -V[9]; - } else { - mEUt = (int) -V[8]; - } - outputEM = new cElementalInstanceStackTree[1]; - outputEM[0] = new cElementalInstanceStackTree(new cElementalInstanceStack(into)); - return true; - } - } - } - } - mEfficiencyIncrease = 0; - mMaxProgresstime = 0; - return false; - } - - @Override - public void EM_outputFunction() { - if (eOutputHatches.size() < 1) { - stopMachine(); - return; - } - eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); - } - - private static int getID(OrePrefixes prefix, Materials material) { - return OreDictionary.getOreID(prefix.name() + material.name()); - } - - public static void run() { - refMass = getFirstStableIsotope(1).getMass() * 144F; - fluidBind.put(Materials.Hydrogen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(1), 144)); - fluidBind.put(Materials.Helium.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(2), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Lithium), - new cElementalDefinitionStack(getFirstStableIsotope(3), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Beryllium), - new cElementalDefinitionStack(getFirstStableIsotope(4), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Boron), - new cElementalDefinitionStack(getFirstStableIsotope(5), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Carbon), - new cElementalDefinitionStack(getFirstStableIsotope(6), 144)); - fluidBind.put(Materials.Nitrogen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(7), 144)); - fluidBind.put(Materials.Oxygen.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(8), 144)); - fluidBind.put(Materials.Fluorine.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(9), 144)); - //fluidBind.put(Materials.Neon.mGas.getID(),new cElementalDefinitionStack(getFirstStableIsotope(10),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Sodium), - new cElementalDefinitionStack(getFirstStableIsotope(11), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Magnesium), - new cElementalDefinitionStack(getFirstStableIsotope(12), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Aluminium), - new cElementalDefinitionStack(getFirstStableIsotope(13), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Silicon), - new cElementalDefinitionStack(getFirstStableIsotope(14), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Phosphorus), - new cElementalDefinitionStack(getFirstStableIsotope(15), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Sulfur), - new cElementalDefinitionStack(getFirstStableIsotope(16), 144)); - fluidBind.put(Materials.Chlorine.mFluid.getID(), new cElementalDefinitionStack(getFirstStableIsotope(17), 144)); - fluidBind.put(Materials.Argon.mGas.getID(), new cElementalDefinitionStack(getFirstStableIsotope(18), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Potassium), - new cElementalDefinitionStack(getFirstStableIsotope(19), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Calcium), - new cElementalDefinitionStack(getFirstStableIsotope(20), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Scandium), - new cElementalDefinitionStack(getFirstStableIsotope(21), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Titanium), - new cElementalDefinitionStack(getFirstStableIsotope(22), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Vanadium), - new cElementalDefinitionStack(getFirstStableIsotope(23), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Chrome), - new cElementalDefinitionStack(getFirstStableIsotope(24), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Manganese), - new cElementalDefinitionStack(getFirstStableIsotope(25), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Iron), - new cElementalDefinitionStack(getFirstStableIsotope(26), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.IronMagnetic), - new cElementalDefinitionStack(getFirstStableIsotope(26), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Cobalt), - new cElementalDefinitionStack(getFirstStableIsotope(27), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Nickel), - new cElementalDefinitionStack(getFirstStableIsotope(28), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Copper), - new cElementalDefinitionStack(getFirstStableIsotope(29), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Zinc), - new cElementalDefinitionStack(getFirstStableIsotope(30), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Gallium), - new cElementalDefinitionStack(getFirstStableIsotope(31), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Germanium), - // new cElementalDefinitionStack(getFirstStableIsotope(32),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Arsenic), - new cElementalDefinitionStack(getFirstStableIsotope(33), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Selenium), - // new cElementalDefinitionStack(getFirstStableIsotope(34),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Bromine), - // new cElementalDefinitionStack(getFirstStableIsotope(35),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Krypton), - // new cElementalDefinitionStack(getFirstStableIsotope(36),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Rubidium), - new cElementalDefinitionStack(getFirstStableIsotope(37), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Strontium), - new cElementalDefinitionStack(getFirstStableIsotope(38), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Yttrium), - new cElementalDefinitionStack(getFirstStableIsotope(39), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Zirconium), - // new cElementalDefinitionStack(getFirstStableIsotope(40),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Niobium), - new cElementalDefinitionStack(getFirstStableIsotope(41), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Molybdenum), - new cElementalDefinitionStack(getFirstStableIsotope(42), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Technetium), - // new cElementalDefinitionStack(getFirstStableIsotope(43),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Ruthenium), - // new cElementalDefinitionStack(getFirstStableIsotope(44),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Rhodium), - // new cElementalDefinitionStack(getFirstStableIsotope(45),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Palladium), - new cElementalDefinitionStack(getFirstStableIsotope(46), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Silver), - new cElementalDefinitionStack(getFirstStableIsotope(47), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Cadmium), - new cElementalDefinitionStack(getFirstStableIsotope(48), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Indium), - new cElementalDefinitionStack(getFirstStableIsotope(49), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Tin), - new cElementalDefinitionStack(getFirstStableIsotope(50), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Antimony), - new cElementalDefinitionStack(getFirstStableIsotope(51), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Tellurium), - new cElementalDefinitionStack(getFirstStableIsotope(52), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Iodine), - // new cElementalDefinitionStack(getFirstStableIsotope(53),144)); - //fluidBind.put(Materials.Xenon.mGas.getID(),new cElementalDefinitionStack(getFirstStableIsotope(54),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Caesium), - new cElementalDefinitionStack(getFirstStableIsotope(55), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Barium), - new cElementalDefinitionStack(getFirstStableIsotope(56), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Lanthanum), - new cElementalDefinitionStack(getFirstStableIsotope(57), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Cerium), - new cElementalDefinitionStack(getFirstStableIsotope(58), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Praseodymium), - new cElementalDefinitionStack(getFirstStableIsotope(59), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Neodymium), - new cElementalDefinitionStack(getFirstStableIsotope(60), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.NeodymiumMagnetic), - new cElementalDefinitionStack(getFirstStableIsotope(60), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Promethium), - new cElementalDefinitionStack(getFirstStableIsotope(61), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Samarium), - new cElementalDefinitionStack(getFirstStableIsotope(62), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.SamariumMagnetic), - // new cElementalDefinitionStack(getFirstStableIsotope(62),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Europium), - new cElementalDefinitionStack(getFirstStableIsotope(63), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Gadolinium), - new cElementalDefinitionStack(getFirstStableIsotope(64), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Terbium), - new cElementalDefinitionStack(getFirstStableIsotope(65), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Dysprosium), - new cElementalDefinitionStack(getFirstStableIsotope(66), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Holmium), - new cElementalDefinitionStack(getFirstStableIsotope(67), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Erbium), - new cElementalDefinitionStack(getFirstStableIsotope(68), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Thulium), - new cElementalDefinitionStack(getFirstStableIsotope(69), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Ytterbium), - new cElementalDefinitionStack(getFirstStableIsotope(70), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Lutetium), - new cElementalDefinitionStack(getFirstStableIsotope(71), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Hafnum), - // new cElementalDefinitionStack(getFirstStableIsotope(72),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Tantalum), - new cElementalDefinitionStack(getFirstStableIsotope(73), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Tungsten), - new cElementalDefinitionStack(getFirstStableIsotope(74), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Rhenium), - // new cElementalDefinitionStack(getFirstStableIsotope(75),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Osmium), - new cElementalDefinitionStack(getFirstStableIsotope(76), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Iridium), - new cElementalDefinitionStack(getFirstStableIsotope(77), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Platinum), - new cElementalDefinitionStack(getFirstStableIsotope(78), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Gold), - new cElementalDefinitionStack(getFirstStableIsotope(79), 144)); - fluidBind.put(Materials.Mercury.mFluid.getID(), new cElementalDefinitionStack(getFirstStableIsotope(80), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Thalium), - // new cElementalDefinitionStack(getFirstStableIsotope(81),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Lead), - new cElementalDefinitionStack(getFirstStableIsotope(82), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Bismuth), - new cElementalDefinitionStack(getFirstStableIsotope(83), 144)); - //UNSTABLE ATOMS - refUnstableMass = getFirstStableIsotope(83).getMass() * 144F; - //itemBinds.put(getID(OrePrefixes.dust, Materials.Polonium), - // new cElementalDefinitionStack(getBestUnstableIsotope(84),144)); - //fluidBind.put(Materials.Astatine.mPlasma.getID(),new cElementalDefinitionStack(getBestUnstableIsotope(85),144)); - fluidBind.put(Materials.Radon.mGas.getID(), new cElementalDefinitionStack(getBestUnstableIsotope(86), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Francium), - // new cElementalDefinitionStack(getBestUnstableIsotope(87),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Radium), - // new cElementalDefinitionStack(getBestUnstableIsotope(88),144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Actinium), - // new cElementalDefinitionStack(getBestUnstableIsotope(89),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Thorium), - new cElementalDefinitionStack(getBestUnstableIsotope(90), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Protactinium), - // new cElementalDefinitionStack(getBestUnstableIsotope(91),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Uranium), - new cElementalDefinitionStack(getBestUnstableIsotope(92), 144)); - //itemBinds.put(getID(OrePrefixes.dust, Materials.Neptunium), - // new cElementalDefinitionStack(getBestUnstableIsotope(93),144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Plutonium), - new cElementalDefinitionStack(getBestUnstableIsotope(94), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Americium), - new cElementalDefinitionStack(getBestUnstableIsotope(95), 144)); - /* ... */ - itemBinds.put(getID(OrePrefixes.ingotHot, Materials.Neutronium), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 100000)); - - try { - fluidBind.put(Materials.Deuterium.mGas.getID(), new cElementalDefinitionStack( - new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1 - ), 144)); - fluidBind.put(Materials.Tritium.mGas.getID(), new cElementalDefinitionStack( - new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2 - ), 144)); - fluidBind.put(Materials.Helium_3.mGas.getID(), new cElementalDefinitionStack( - new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 2), - dHadronDefinition.hadron_p2, - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 3) - ), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Uranium235), - new cElementalDefinitionStack(new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) - ), 144)); - itemBinds.put(getID(OrePrefixes.dust, Materials.Plutonium241), - new cElementalDefinitionStack(new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 149) - ), 144)); - } catch (tElementalException e) { - if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace(); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java deleted file mode 100644 index 7de3f1db0b..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM { - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_scanner(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_scanner(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "What is existing here?", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I HAVE NO IDEA (yet)!" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java deleted file mode 100644 index 2886e782e2..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import static com.github.technus.tectech.things.casing.GT_Container_CasingsTT.sBlockCasingsTT; -import static com.github.technus.tectech.elementalMatter.commonValues.multiCheckAt; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM { - public GT_MetaTileEntity_EM_transformer(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } - - public GT_MetaTileEntity_EM_transformer(String aName) { - super(aName); - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_transformer(this.mName); - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (iGregTechTileEntity.getBlockOffset(xDir, yDir, zDir) != sBlockCasingsTT || iGregTechTileEntity.getMetaIDOffset(xDir, yDir, zDir) != 6) - return false; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((i != 0 || j != 0 || h != 0)/*exclude center*/ && (xDir + i != 0 || yDir + h != 0 || zDir + j != 0)/*exclude this*/) { - IGregTechTileEntity tTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + i, yDir + h, zDir + j); - if (!addEnergyIOToMachineList(tTileEntity, 99)) { - if (iGregTechTileEntity.getBlockOffset(xDir + i, yDir + h, zDir + j) != sBlockCasingsTT || - iGregTechTileEntity.getMetaIDOffset(xDir + i, yDir + h, zDir + j) != 3) { - return false; - } - } - } - } - } - } - return true; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "Power substation", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "All the transformation!", - EnumChatFormatting.AQUA + "SafeVoid button = Soft Hammer!", - EnumChatFormatting.BLUE + "Only 0.78125% power loss, HAYO!", - }; - } - - @Override - public boolean EM_checkRecipe(ItemStack itemStack) { - if (ePowerPass) { - mEfficiencyIncrease = 10000; - mMaxProgresstime = 20; - } else { - mEfficiencyIncrease = 0; - mMaxProgresstime = 0; - } - eAmpereFlow = 0; - mEUt = 0; - eDismatleBoom = ePowerPass; - return ePowerPass; - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((aTick % 20) == multiCheckAt) { - if (eSafeVoid) { - eSafeVoid = false; - if (aBaseMetaTileEntity.isAllowedToWork()) - aBaseMetaTileEntity.disableWorking(); - else aBaseMetaTileEntity.enableWorking(); - } - ePowerPass = aBaseMetaTileEntity.isAllowedToWork(); - } - } - - @Override - public boolean doRandomMaintenanceDamage() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java deleted file mode 100644 index e5e5db4caf..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi; - -import com.github.technus.tectech.elementalMatter.commonValues; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockBase_EM { - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - - //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind - }; - private static final int[] casingRequirements = new int[]{}; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; - - public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_wormhole(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_wormhole(this.mName); - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH_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.CASING_BLOCKS[99], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[99]}; - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - commonValues.tecMark, - "It is not full of worms.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "It is full of anti-worms!!!" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java deleted file mode 100644 index 3b4ec72338..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi.gui; - -import com.github.technus.tectech.things.metaTileEntity.GT_MetaTileEntity_MultiblockBase_EM; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { - public byte[] eParamsInStatus = new byte[20];//unused 0,G ok 1, B too low 2, R too high 3, Y blink dangerous 4,5 - public byte[] eParamsOutStatus = new byte[20]; - public byte eCertainMode = 5, eCertainStatus = 127; - public boolean ePowerPass = false, eSafeVoid = false; - - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 152, -21)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 0, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 21, false, false, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity(); - switch (aSlotIndex) { - case 1: - base.ePowerPass ^= true; - break; - case 2: - base.eSafeVoid ^= true; - break; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null) || (this.eParamsInStatus == null)) - return;//INTELLIJ IS TALKING BULLSHIT HERE IT CAN BE NULL!!! - this.eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsInStatus; - this.eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsOutStatus; - this.eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainMode; - this.eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainStatus; - this.ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).ePowerPass; - this.eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eSafeVoid; - - for (Object crafter : this.crafters) { - ICrafting var1 = (ICrafting) crafter; - int i = 100; - for (int j = 0; j < eParamsInStatus.length; j++) - var1.sendProgressBarUpdate(this, i++, eParamsInStatus[j] | (eParamsOutStatus[j] << 8)); - var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); - var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0)); - } - } - - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - if (this.eParamsInStatus == null) return; - if (par1 >= 100 && par1 < 120) { - this.eParamsInStatus[par1 - 100] = (byte) (par2 & 0xff); - this.eParamsOutStatus[par1 - 100] = (byte) (par2 >>> 8); - } else if (par1 == 120) { - this.eCertainMode = (byte) (par2 & 0xff); - this.eCertainStatus = (byte) (par2 >>> 8); - } else if (par1 == 121) { - this.ePowerPass = (par2 & 1) == 1; - this.eSafeVoid = (par2 & 2) == 2; - } - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java deleted file mode 100644 index b246239cc1..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.multi.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import org.lwjgl.opengl.GL11; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -/** - * Created by Tec on 21.02.2017. - */ - -public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { - String mName = ""; - private static byte cntr = 0; - - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, -18, 16448255); - - if (mContainer != null) { - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 1) != 0) - fontRendererObj.drawString("Pipe is loose.", 10, -10, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 2) != 0) - fontRendererObj.drawString("Screws are missing.", 10, -2, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 4) != 0) - fontRendererObj.drawString("Something is stuck.", 10, 6, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 8) != 0) - fontRendererObj.drawString("Platings are dented.", 10, 14, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 16) != 0) - fontRendererObj.drawString("Circuitry burned out.", 10, 22, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 32) != 0) - fontRendererObj.drawString("That doesn't belong there.", 10, 30, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString("Incomplete Structure.", 10, 38, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 128) != 0) - fontRendererObj.drawString("Too Uncertain.", 10, 46, 16448255); - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 256) != 0) - fontRendererObj.drawString("Invalid Parameters.", 10, 54, 16448255); - - if (((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode == 0) { - if (((GT_Container_MultiMachineEM) mContainer).mActive == 0) { - fontRendererObj.drawString("Hit with Soft Hammer", 10, -10, 16448255); - fontRendererObj.drawString("to (re-)start the Machine", 10, -2, 16448255); - fontRendererObj.drawString("if it doesn't start.", 10, 6, 16448255); - } else { - fontRendererObj.drawString("Running perfectly.", 10, -10, 16448255); - } - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - y -= 26; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize + 26); - if (this.mContainer != null && ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus != null) { - cntr = (byte) ((1 + cntr) % 6); - GL11.glColor4f(1f, 1f, 1f, 1f); - - if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) - drawTexturedModalRect(x + 151, y + 25, 183, 25, 18, 18); - - if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) - drawTexturedModalRect(x + 151, y + 46, 183, 46, 18, 18); - - x += 11; - y += 96; - for (int i = 0; i < 20; ) { - byte j = (byte) (i >>> 1); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j]); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j + 10]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j + 10]); - } - - final short rU = 183, Vs = 77; - x += 140; - y -= 19; - final byte state = ((GT_Container_MultiMachineEM) this.mContainer).eCertainStatus; - switch (((GT_Container_MultiMachineEM) this.mContainer).eCertainMode) { - case 1://ooo oxo ooo - drawTexturedModalRect(x + 6, y + 6, - rU + (state == 0 ? 38 : 6), - Vs + 6, 6, 6); - break; - case 2://ooo xox ooo - drawTexturedModalRect(x, y + 6, - rU + ((state & 1) == 0 ? 32 : 0), - Vs + 6, 6, 6); - drawTexturedModalRect(x + 12, y + 6, - rU + ((state & 2) == 0 ? 44 : 12), - Vs + 6, 6, 6); - break; - case 3://oxo xox oxo - drawTexturedModalRect(x + 6, y, - rU + ((state & 1) == 0 ? 38 : 6), - Vs, 6, 6); - drawTexturedModalRect(x, y + 6, - rU + ((state & 2) == 0 ? 32 : 0), - Vs + 6, 6, 6); - drawTexturedModalRect(x + 12, y + 6, - rU + ((state & 4) == 0 ? 44 : 12), - Vs + 6, 6, 6); - drawTexturedModalRect(x + 6, y + 12, - rU + ((state & 8) == 0 ? 38 : 6), - Vs + 12, 6, 6); - break; - case 4://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 32 : 0), - Vs, 6, 6); - drawTexturedModalRect(x + 12, y, - rU + ((state & 2) == 0 ? 44 : 12), - Vs, 6, 6); - drawTexturedModalRect(x, y + 12, - rU + ((state & 4) == 0 ? 32 : 0), - Vs + 12, 6, 6); - drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 8) == 0 ? 44 : 12), - Vs + 12, 6, 6); - break; - case 5://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 32 : 0), - Vs, 6, 6); - drawTexturedModalRect(x + 12, y, - rU + ((state & 2) == 0 ? 44 : 12), - Vs, 6, 6); - drawTexturedModalRect(x + 6, y + 6, - rU + ((state & 4) == 0 ? 38 : 6), - Vs + 6, 6, 6); - drawTexturedModalRect(x, y + 12, - rU + ((state & 8) == 0 ? 32 : 0), - Vs + 12, 6, 6); - drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 16) == 0 ? 44 : 12), - Vs + 12, 6, 6); - break; - } - } - } - - private void LEDdrawP(int x, int y, int i, int j, byte status) { - final int v = 192, su = 8, sv = 6, u = 11; - switch (status) { - case 6: - if (cntr < 2) { - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); - break; - } else if (cntr < 4) { - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); - break; - } - case 1://ok - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (4 + j), su, sv); - break; - case 2://too low blink - if (cntr < 3) { - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); - break; - } - case 3:// too low - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (2 + j), su, sv); - break; - case 4://too high blink - if (cntr < 3) { - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); - break; - } - case 5:// too high - drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); - break; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/things/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/things/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java deleted file mode 100644 index 05cd562460..0000000000 --- a/src/main/java/com/github/technus/tectech/things/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.github.technus.tectech.things.metaTileEntity.pipe; - -import com.github.technus.tectech.things.machineTT; -import com.github.technus.tectech.elementalMatter.commonValues; -import com.github.technus.tectech.elementalMatter.interfaces.iConnectsToEMpipe; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IColoredTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Client; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import static gregtech.api.enums.Dyes.MACHINE_METAL; - -/** - * Created by Tec on 26.02.2017. - */ -public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnectsToEMpipe, machineTT { - private static Textures.BlockIcons.CustomIcon EMpipe; - private static Textures.BlockIcons.CustomIcon EMcandy; - public byte connectionCount = 0; - - public GT_MetaTileEntity_Pipe_EM(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 0); - } - - public GT_MetaTileEntity_Pipe_EM(String aName) { - super(aName, 0); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_Pipe_EM(mName); - } - - @Override - public float getThickNess() { - return 0.5F; - } - - @Override - public void registerIcons(IIconRegister aBlockIconRegister) { - EMpipe = new Textures.BlockIcons.CustomIcon("iconsets/EM_PIPE"); - EMcandy = new Textures.BlockIcons.CustomIcon("iconsets/EM_CANDY"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - return new ITexture[]{new GT_RenderedTexture(EMpipe), new GT_RenderedTexture(EMcandy, Dyes.getModulation(aColorIndex, MACHINE_METAL.getRGBA()))}; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { - return false; - } - - @Override - public void loadNBTData(NBTTagCompound nbtTagCompound) { - } - - @Override - public void saveNBTData(NBTTagCompound nbtTagCompound) { - } - - @Override - public boolean renderInside(byte b) { - return false; - } - - @Override - public byte getTileEntityBaseType() { - return 4; - } - - @Override - public String[] getDescription() { - String tecMark; - return new String[]{ - commonValues.tecMark, - "Quantum tunneling device.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not cross,split or turn" - }; - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if ((aTick & 31) == 0) { - byte mOld = 0; - mConnections = 0; - connectionCount = 0; - if (aBaseMetaTileEntity.getColorization() < 0) return; - for (byte i = 0, j; i < 6; i++) { - j = GT_Utility.getOppositeSide(i); - if (!aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); - if (tTileEntity instanceof IColoredTileEntity) { - //if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); - if (tColor != aBaseMetaTileEntity.getColorization()) continue; - //} - } - if (tTileEntity instanceof iConnectsToEMpipe && (((iConnectsToEMpipe) tTileEntity).canConnect(j))) { - mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } - continue; - } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { - if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || - ((iConnectsToEMpipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { - mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } - } - } - } else { - mConnections |= (1 << i); - if (mOld != mConnections) { - connectionCount++; - mOld = mConnections; - } - } - - } - } - - } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { - aBaseMetaTileEntity.issueTextureUpdate(); - } - } - - @Override - public boolean canConnect(byte side) { - return true; - } -} -- cgit