This commit is contained in:
Technus 2017-05-15 08:13:34 +02:00 committed by Blood-Asp
parent 9a3fa2e42c
commit 467e6ba022
2 changed files with 50 additions and 6 deletions

View file

@ -741,11 +741,33 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
* @return see constants above * @return see constants above
*/ */
public int checkRecipe() { 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(); GT_Recipe_Map tMap = getRecipeList();
if (tMap == null) return DID_NOT_FIND_RECIPE; if (tMap == null) return DID_NOT_FIND_RECIPE;
GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs()); GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());
if (tRecipe == null) return DID_NOT_FIND_RECIPE; 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 (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
if (!canOutput(tRecipe)) { if (!canOutput(tRecipe)) {
mOutputBlocked++; mOutputBlocked++;

View file

@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.multi; package gregtech.common.tileentities.machines.multi;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@ -22,6 +23,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity;
public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase { public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase {
GT_Recipe mLastRecipe; GT_Recipe mLastRecipe;
@ -64,7 +67,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
public GT_Recipe.GT_Recipe_Map getRecipeMap() { public GT_Recipe.GT_Recipe_Map getRecipeMap() {
if (mInventory[1] == null) return null; 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")) { if (tmp.startsWith("centrifuge")) {
return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes;
} else if (tmp.startsWith("electrolyzer")) { } 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; return GT_Recipe.GT_Recipe_Map.sPolarizerRecipes;
} else if(tmp.startsWith("press")){ } else if(tmp.startsWith("press")){
return GT_Recipe.GT_Recipe_Map.sPressRecipes; 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; return null;
} }
@ -153,9 +173,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
return false; return false;
} }
GT_Recipe.GT_Recipe_Map map = getRecipeMap(); GT_Recipe.GT_Recipe_Map map = getRecipeMap();
if (map == null) { if (map == null) return false;
return false;
}
ArrayList<ItemStack> tInputList = getStoredInputs(); ArrayList<ItemStack> tInputList = getStoredInputs();
int tTier = 0; int tTier = 0;
if (mInventory[1].getUnlocalizedName().endsWith("1")) { 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) { if (tInputList.size() > 0 || tFluids.length > 0) {
GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
if (tRecipe != null) { if (tRecipe != null) {
if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 &&
!isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId))
return false;
mLastRecipe = tRecipe; mLastRecipe = tRecipe;
this.mEUt = 0; this.mEUt = 0;
this.mOutputItems = null; this.mOutputItems = null;