aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-21 17:17:34 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-21 17:17:34 +0000
commiteff844b6e222b578bc0baadbe84f94912cb819f7 (patch)
treea08b01116fd4e44b873e9158885f30db83ab635d /src/main/java/gtPlusPlus/xmod/gregtech/common
parent82f2d61465c1fcacfb5104115238c23da0783d0b (diff)
downloadGT5-Unofficial-eff844b6e222b578bc0baadbe84f94912cb819f7.tar.gz
GT5-Unofficial-eff844b6e222b578bc0baadbe84f94912cb819f7.tar.bz2
GT5-Unofficial-eff844b6e222b578bc0baadbe84f94912cb819f7.zip
Add Multiblock Forge Hammer.
Add base for Multiblock Molecular Transformer.
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java6
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java327
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java312
4 files changed, 649 insertions, 1 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
index 61c71ba552..841ea582ad 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -32,7 +32,8 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Sparge Tower Exterior Casing"); // Sparge Tower Casing
TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 4));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Forge Casing"); // Forge Hammer Casing
+ TAE.registerTexture(1, 11, new GT_CopiedBlockTexture(this, 6, 6));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
@@ -48,6 +49,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2));
GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3));
GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_IndustrialForgeHammer.set(new ItemStack(this, 1, 6));
}
@Override
@@ -69,6 +71,8 @@ extends GregtechMetaCasingBlocksAbstract {
return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon();
case 4:
return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon();
+ case 6:
+ return TexturesGtBlock.TEXTURE_TECH_PANEL_H.getIcon();
}
}
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
index 518ffe0eae..59e4f2e4b3 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -494,6 +494,11 @@ public class TexturesGtBlock {
public static final CustomIcon TEXTURE_TECH_PANEL_B = new CustomIcon("metro/TEXTURE_TECH_PANEL_B");
public static final CustomIcon TEXTURE_TECH_PANEL_C = new CustomIcon("metro/TEXTURE_TECH_PANEL_C");
public static final CustomIcon TEXTURE_TECH_PANEL_D = new CustomIcon("metro/TEXTURE_TECH_PANEL_D");
+ public static final CustomIcon TEXTURE_TECH_PANEL_E = new CustomIcon("metro/TEXTURE_TECH_PANEL_E");
+ public static final CustomIcon TEXTURE_TECH_PANEL_F = new CustomIcon("metro/TEXTURE_TECH_PANEL_F");
+ public static final CustomIcon TEXTURE_TECH_PANEL_G = new CustomIcon("metro/TEXTURE_TECH_PANEL_G");
+ public static final CustomIcon TEXTURE_TECH_PANEL_H = new CustomIcon("metro/TEXTURE_TECH_PANEL_H");
+ public static final CustomIcon TEXTURE_TECH_PANEL_I = new CustomIcon("metro/TEXTURE_TECH_PANEL_I");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE = new CustomIcon("TileEntities/DecayablesChest_bottom");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE_ALT = new CustomIcon("TileEntities/DecayablesChest_top");
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
new file mode 100644
index 0000000000..03197c47ca
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
@@ -0,0 +1,327 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+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_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_MultiBlockBase {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialForgeHammer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Forge Hammer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Forge Hammer")
+ .addInfo("Speed: 100% x Anvil Tier | Eu Usage: 100% | Parallel: Tier x 8")
+ .addInfo("T1 - Vanilla Anvil");
+ if (LoadedMods.Railcraft) {
+ tt.addInfo("T2 - Steel Anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ tt.addInfo("T3 - Dark Steel Anvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ tt.addInfo("T3 - Thaumic Anvil");
+ tt.addInfo("T4 - Void Anvil");
+ }
+ tt.addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Forge Casing", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialForgeHammer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "CAC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings5Misc, 6
+ )
+ )
+ )
+ )
+ .addElement(
+ 'A',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings5Misc, 6
+ )
+ )
+ )
+ )
+
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialForgeHammerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(1);
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(1, 11)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(1, 11))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MaterialPress";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sHammerRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ Block aAnvil = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (aAnvil != null) {
+ int aAnvilTier = getAnvilTier(aAnvil);
+ if (aAnvilTier > 0) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), new FluidStack[]{}, getMaxParallelRecipes(), 100, 100 * aAnvilTier, 10000)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialForgeHammer;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private static Block sAnvil;
+ private static Block sSteelAnvil;
+ private static Block sDarkSteelAnvil;
+ private static Block sThaumiumAnvil;
+ private static Block sVoidAnvil;
+
+ private static void setAnvilBlocks() {
+ if (sAnvil == null) {
+ sAnvil = Blocks.anvil;
+ if (LoadedMods.Railcraft) {
+ sSteelAnvil = GameRegistry.findBlock("Railcraft", "anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ sDarkSteelAnvil = GameRegistry.findBlock("EnderIO", "blockDarkSteelAnvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ sThaumiumAnvil = GameRegistry.findBlock("thaumicbases", "thaumicAnvil");
+ sVoidAnvil = GameRegistry.findBlock("thaumicbases", "voidAnvil");
+ }
+ }
+ }
+
+ public static boolean isBlockAnvil(Block aBlock) {
+ setAnvilBlocks();
+ if (sAnvil == aBlock) {
+ return true;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock || sVoidAnvil == aBlock) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static int getAnvilTier(Block aBlock) {
+ if (isBlockAnvil(aBlock)) {
+ if (sAnvil == aBlock) {
+ return 1;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return 2;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return 3;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock) {
+ return 3;
+ }
+ if (sVoidAnvil == aBlock) {
+ return 4;
+ }
+ }
+ }
+ return 0;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
new file mode 100644
index 0000000000..b8e8a904b7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
@@ -0,0 +1,312 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+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.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMolecularTransformer> {
+
+ public static int CASING_TEXTURE_ID;
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> STRUCTURE_DEFINITION = null;
+
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final String aName) {
+ super(aName);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMolecularTransformer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Molecular Transformer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Advanced Vacuum Freezer")
+ .addInfo("Speed: 200% | Eu Usage: 100% | Parallel: 4")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("CASING", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addInputHatch("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMolecularTransformer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialMolecularTransformer::addIndustrialVacuumFreezerList, CASING_TEXTURE_ID, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings3Misc, 10
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialVacuumFreezerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "VacuumFreezer";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sMolecularTransformerRecipes;
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return this.checkRecipeGeneric(4, 100, 100);
+ }
+
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ ItemStack[] tInputs = getCompactedInputs();
+ FluidStack[] tFluids = new FluidStack[] {};
+
+ if (tInputs.length <= 0) {
+ log("Error 1");
+ return false;
+ }
+
+ long tVoltage = getMaxInputVoltage();
+ log("Voltage: "+tVoltage);
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ log("Tier: "+tTier);
+ GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+
+ if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) {
+ log("Error 2");
+ return false;
+ }
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ calculateOverclockedNessMulti(tRecipe.mEUt*tRecipe.mSpecialValue, tRecipe.mDuration, 1, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) {
+ log("Error 3");
+ return false;
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ log("EU/t: "+this.mEUt);
+ this.mMaxProgresstime = Math.max(mMaxProgresstime/tRecipe.mSpecialValue, 1);
+ log("Total Time: "+this.mMaxProgresstime);
+ if (tRecipe.mOutputs.length > 0) {
+ this.mOutputItems = tRecipe.mOutputs.clone();
+ }
+ updateSlots();
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("Running");
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialVacuumFreezer;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean drainEnergyInput(long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public long getMaxInputVoltage() {
+ long rVoltage = 0;
+ for (GT_MetaTileEntity_Hatch tHatch : mAllEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
+ }
+ }
+ return rVoltage;
+ }
+
+ /**
+ * Called every tick the Machine runs
+ */
+ @Override
+ public boolean onRunningTick(ItemStack aStack) {
+ if (mEUt < 0) {
+ if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
+ criticalStopMachine();
+ return false;
+ }
+ }
+ return true;
+ }
+
+} \ No newline at end of file