From 467e6ba02286fa97b2cbd407158227958756032b Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 15 May 2017 08:13:34 +0200 Subject: [PATCH] 1ddc91a --- .../GT_MetaTileEntity_BasicMachine.java | 24 +++++++++++++- .../GT_MetaTileEntity_ProcessingArray.java | 32 ++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index fc4ecfee..81948bb5 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -741,11 +741,33 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * @return see constants above */ public int checkRecipe() { + return checkRecipe(false); + } + + public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId){ + return //TODO check or get a better solution + DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") || + DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation"); + } + + + /** + * + * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... + * @return + */ + public int checkRecipe(boolean skipOC){ GT_Recipe_Map tMap = getRecipeList(); if (tMap == null) return DID_NOT_FIND_RECIPE; GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && !(DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Orbit")||DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Space"))) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { mOutputBlocked++; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index db8462f7..b45c0da6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -22,6 +23,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; + public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase { GT_Recipe mLastRecipe; @@ -64,7 +67,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl public GT_Recipe.GT_Recipe_Map getRecipeMap() { if (mInventory[1] == null) return null; - String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt.blockmachines.basicmachine.", ""); + String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicmachine\\.", ""); if (tmp.startsWith("centrifuge")) { return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; } else if (tmp.startsWith("electrolyzer")) { @@ -131,8 +134,25 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl return GT_Recipe.GT_Recipe_Map.sPolarizerRecipes; } else if(tmp.startsWith("press")){ return GT_Recipe.GT_Recipe_Map.sPressRecipes; + } else if (tmp.startsWith("plasmaarcfurnace")) { + return GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes; + } else if (tmp.startsWith("printer")) { + return GT_Recipe.GT_Recipe_Map.sPrinterRecipes; + } else if (tmp.startsWith("press")) { + return GT_Recipe.GT_Recipe_Map.sPressRecipes; + } else if (tmp.startsWith("fluidcanner")) { + return GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes; + } else if (tmp.startsWith("fluidheater")) { + return GT_Recipe.GT_Recipe_Map.sFluidHeaterRecipes; + } else if (tmp.startsWith("distillery")) { + return GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; + } else if (tmp.startsWith("slicer")) { + return GT_Recipe.GT_Recipe_Map.sSlicerRecipes; + } else if (tmp.startsWith("amplifier")) { + return GT_Recipe.GT_Recipe_Map.sAmplifiers; + } else if (tmp.startsWith("circuitassembler")) { + return GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes; } - return null; } @@ -153,9 +173,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl return false; } GT_Recipe.GT_Recipe_Map map = getRecipeMap(); - if (map == null) { - return false; - } + if (map == null) return false; ArrayList tInputList = getStoredInputs(); int tTier = 0; if (mInventory[1].getUnlocalizedName().endsWith("1")) { @@ -186,6 +204,10 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl if (tInputList.size() > 0 || tFluids.length > 0) { GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return false; + mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null;