aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java22
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java325
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java14
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java278
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java31
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java10
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java17
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java107
10 files changed, 303 insertions, 513 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
index f17626cdd8..399c536b9f 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
@@ -1,6 +1,6 @@
package gregtech.api.metatileentity.implementations;
-import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sAssemblerRecipes;
+import static gregtech.api.recipe.RecipeMaps.assemblerRecipes;
import static gregtech.api.util.GT_RecipeBuilder.SECONDS;
import static gregtech.api.util.GT_RecipeBuilder.TICKS;
import static gregtech.api.util.GT_Utility.calculateRecipeEU;
@@ -54,7 +54,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
.itemOutputs(getStackForm(1))
.duration(3 * SECONDS + 4 * TICKS)
.eut(calculateRecipeEU(aMaterial, 7))
- .addTo(sAssemblerRecipes);
+ .addTo(assemblerRecipes);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
index 93bbdd2d18..897f9dad6f 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
@@ -15,14 +15,17 @@ import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.RecipeMapWorkable;
import gregtech.api.objects.ItemData;
+import gregtech.api.recipe.RecipeMap;
+import gregtech.api.recipe.maps.FuelBackend;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
-public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank {
+public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank
+ implements RecipeMapWorkable {
public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription,
ITexture... aTextures) {
@@ -273,7 +276,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
public abstract int getPollution();
- public abstract GT_Recipe_Map getRecipes();
+ @Override
+ public abstract RecipeMap<?> getRecipeMap();
public abstract int getEfficiency();
@@ -287,8 +291,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
public long getFuelValue(FluidStack aLiquid, boolean aLong) {
- GT_Recipe_Map tRecipes = getRecipes();
- if (aLiquid == null || !(tRecipes instanceof GT_Recipe.GT_Recipe_Map_Fuel tFuels)) return 0;
+ RecipeMap<?> tRecipes = getRecipeMap();
+ if (aLiquid == null || !(tRecipes.getBackend() instanceof FuelBackend tFuels)) return 0;
GT_Recipe tFuel = tFuels.findFuel(aLiquid);
if (tFuel == null) return 0;
@@ -301,8 +305,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
public long getFuelValue(ItemStack aStack, boolean aLong) {
- if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0;
- GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
+ if (GT_Utility.isStackInvalid(aStack) || getRecipeMap() == null) return 0;
+ GT_Recipe tFuel = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
if (tFuel == null) return 0;
long liters = 10L; // 1000mb/100
@@ -310,8 +314,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
public ItemStack getEmptyContainer(ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return null;
- GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
+ if (GT_Utility.isStackInvalid(aStack) || getRecipeMap() == null) return null;
+ GT_Recipe tFuel = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack);
if (tFuel != null) return GT_Utility.copyOrNull(tFuel.getOutput(0));
return GT_Utility.getContainerItem(aStack, true);
}
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 0e86829027..ba8c865301 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
@@ -14,6 +14,8 @@ import static gregtech.api.metatileentity.BaseTileEntity.STALLED_STUTTERING_TOOL
import static gregtech.api.metatileentity.BaseTileEntity.STALLED_VENT_TOOLTIP;
import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import static gregtech.api.metatileentity.BaseTileEntity.UNUSED_SLOT_TOOLTIP;
+import static gregtech.api.util.GT_RecipeConstants.EXPLODE;
+import static gregtech.api.util.GT_RecipeConstants.ON_FIRE;
import static gregtech.api.util.GT_Utility.moveMultipleItemStacks;
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
import static net.minecraftforge.common.util.ForgeDirection.UNKNOWN;
@@ -23,6 +25,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@@ -39,7 +43,6 @@ import net.minecraftforge.fluids.IFluidHandler;
import org.apache.commons.lang3.tuple.Pair;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
-import com.gtnewhorizons.modularui.api.drawable.UITexture;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.math.Size;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -65,21 +68,24 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IOverclockDescriptionProvider;
+import gregtech.api.interfaces.tileentity.RecipeMapWorkable;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.recipe.check.FindRecipeResult;
+import gregtech.api.objects.overclockdescriber.EUOverclockDescriber;
+import gregtech.api.objects.overclockdescriber.OverclockDescriber;
+import gregtech.api.recipe.BasicUIProperties;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ClientPreference;
import gregtech.api.util.GT_CoverBehaviorBase;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_TooltipDataCache;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.GT_Waila;
import gregtech.common.gui.modularui.UIHelper;
-import gregtech.common.power.BasicMachineEUPower;
-import gregtech.common.power.Power;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -89,8 +95,8 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
* This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple
* Machine
*/
-public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank
- implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets {
+public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank implements RecipeMapWorkable,
+ IConfigurationCircuitSupport, IOverclockDescriptionProvider, IAddGregtechLogo, IAddUIWidgets {
/**
* return values for checkRecipe()
@@ -108,9 +114,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public int mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
public ForgeDirection mMainFacing = ForgeDirection.WEST;
public FluidStack mOutputFluid;
- @Deprecated
- public String mGUIName = "", mNEIName = "";
- protected final Power mPower;
+ protected final OverclockDescriber overclockDescriber;
/**
* Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have
@@ -147,29 +151,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mInputSlotCount = Math.max(0, aInputSlotCount);
mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
mAmperage = aAmperage;
- mPower = buildPower();
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine(int, String, String, int, int, String, int, int,
- * ITexture...)}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
- String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
- ITexture... aOverlays) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1,
- aDescription,
- aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mPower = buildPower();
+ overclockDescriber = createOverclockDescriber();
}
/**
@@ -188,42 +170,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mInputSlotCount = Math.max(0, aInputSlotCount);
mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
mAmperage = aAmperage;
- mPower = buildPower();
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine(int, String, String, int, int, String[], int, int,
- * ITexture...)}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage,
- String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName,
- ITexture... aOverlays) {
- super(
- aID,
- aName,
- aNameRegional,
- aTier,
- OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1,
- aDescription,
- aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mPower = buildPower();
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine(String, int, int, String[], ITexture[][][], int, int)}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String aDescription,
- ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mPower = buildPower();
+ overclockDescriber = createOverclockDescriber();
}
/**
@@ -235,27 +182,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mInputSlotCount = Math.max(0, aInputSlotCount);
mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
mAmperage = aAmperage;
- mPower = buildPower();
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine(String, int, int, String[], ITexture[][][], int, int)}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription,
- ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mPower = buildPower();
+ overclockDescriber = createOverclockDescriber();
}
/**
- * To be called by the constructor to initialize this instance's Power
+ * To be called by the constructor to initialize this instance's overclock behavior
*/
- protected Power buildPower() {
- return new BasicMachineEUPower(mTier, mAmperage);
+ protected OverclockDescriber createOverclockDescriber() {
+ return new EUOverclockDescriber(mTier, mAmperage);
}
protected boolean isValidMainFacing(ForgeDirection side) {
@@ -502,7 +436,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public boolean isFluidInputAllowed(FluidStack aFluid) {
- return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
+ return getFillableStack() != null || (getRecipeMap() != null && getRecipeMap().containsInput(aFluid));
}
@Override
@@ -780,20 +714,30 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false);
}
- protected void calculateOverclockedNess(GT_Recipe aRecipe) {
- calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
+ /**
+ * Calculates overclock based on {@link #overclockDescriber}.
+ */
+ protected void calculateCustomOverclock(GT_Recipe recipe) {
+ GT_OverclockCalculator calculator = overclockDescriber.createCalculator(
+ new GT_OverclockCalculator().setRecipeEUt(recipe.mEUt)
+ .setDuration(recipe.mDuration)
+ .setOneTickDiscount(true),
+ recipe);
+ calculator.calculate();
+ mEUt = (int) calculator.getConsumption();
+ mMaxProgresstime = calculator.getDuration();
}
/**
- * Calcualtes overclocked ness using long integers
- *
- * @param aEUt - recipe EUt
- * @param aDuration - recipe Duration
+ * Helper method for calculating simple overclock.
*/
- protected void calculateOverclockedNess(int aEUt, int aDuration) {
- mPower.computePowerUsageAndDuration(aEUt, aDuration);
- mEUt = mPower.getEuPerTick();
- mMaxProgresstime = mPower.getDurationTicks();
+ protected void calculateOverclockedNess(int eut, int duration) {
+ GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(eut)
+ .setDuration(duration)
+ .setOneTickDiscount(true)
+ .calculate();
+ mEUt = (int) calculator.getConsumption();
+ mMaxProgresstime = calculator.getDuration();
}
protected ItemStack getSpecialSlot() {
@@ -1063,10 +1007,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
return GregTech_API.getConfigurationCircuitList(mTier);
}
- /**
- * @return the Recipe List which is used for this Machine, this is a useful Default Handler
- */
- public GT_Recipe_Map getRecipeList() {
+ @Override
+ public RecipeMap<?> getRecipeMap() {
return null;
}
@@ -1115,26 +1057,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
* FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
*/
public int checkRecipe(boolean skipOC) {
- GT_Recipe_Map tMap = getRecipeList();
+ RecipeMap<?> tMap = getRecipeMap();
if (tMap == null) return DID_NOT_FIND_RECIPE;
- FindRecipeResult result = tMap.findRecipeWithResult(
- mLastRecipe,
- false,
- false,
- V[mTier],
- new FluidStack[] { getFillableStack() },
- getSpecialSlot(),
- getAllInputs());
- if (result.getState() == FindRecipeResult.State.EXPLODE && getBaseMetaTileEntity() != null) {
+ GT_Recipe tRecipe = tMap.findRecipeQuery()
+ .items(getAllInputs())
+ .fluids(getFillableStack())
+ .specialSlot(getSpecialSlot())
+ .voltage(V[mTier])
+ .cachedRecipe(mLastRecipe)
+ .find();
+ if (tRecipe == null) {
+ return DID_NOT_FIND_RECIPE;
+ }
+ if (tRecipe.getMetadataOrDefault(EXPLODE, false) && getBaseMetaTileEntity() != null) {
getBaseMetaTileEntity().doExplosion(V[mTier] * 4);
return DID_NOT_FIND_RECIPE;
}
- if (result.getState() == FindRecipeResult.State.ON_FIRE && getBaseMetaTileEntity() != null) {
+ if (tRecipe.getMetadataOrDefault(ON_FIRE, false) && getBaseMetaTileEntity() != null) {
getBaseMetaTileEntity().setOnFire();
return DID_NOT_FIND_RECIPE;
}
- if (!result.isSuccessful()) return DID_NOT_FIND_RECIPE;
- GT_Recipe tRecipe = result.getRecipeNonNull();
if (GT_Mod.gregtechproxy.mLowGravProcessing && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300)
&& !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId))
@@ -1169,7 +1111,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
mOutputFluid = tRecipe.getFluidOutput(0);
if (!skipOC) {
- calculateOverclockedNess(tRecipe);
+ calculateCustomOverclock(tRecipe);
// In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
@@ -1317,16 +1259,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
}
+ @Nonnull
@Override
- public Power getPower() {
- return mPower;
+ public OverclockDescriber getOverclockDescriber() {
+ return overclockDescriber;
}
// GUI stuff
@Override
public boolean useModularUI() {
- return getRecipeList() != null && getRecipeList().useModularUI;
+ return getRecipeMap() != null;
}
@Override
@@ -1341,8 +1284,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public void addGregTechLogo(ModularWindow.Builder builder) {
- if (getRecipeList() != null) {
- getRecipeList().addGregTechLogoUI(builder, new Pos2d(0, 0));
+ if (getRecipeMap() != null) {
+ getRecipeMap().getFrontend()
+ .addGregTechLogo(builder, new Pos2d(0, 0));
} else {
builder.widget(
new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo())
@@ -1358,22 +1302,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
builder.widget(createItemAutoOutputButton());
}
- addIOSlots(builder);
+ BasicUIProperties uiProperties = getUIProperties();
+ addIOSlots(builder, uiProperties);
builder.widget(createChargerSlot(79, 62));
- if (getRecipeList() != null) {
- builder.widget(
- setNEITransferRect(
- createProgressBar(
- isSteampowered() ? getRecipeList().getProgressBarTextureSteam(getSteamVariant())
- : getRecipeList().getProgressBarTexture(),
- getRecipeList().getProgressBarImageSize(),
- getRecipeList().progressBarDirection,
- getRecipeList().progressBarPos,
- getRecipeList().progressBarSize),
- getRecipeList().mNEIName));
- addProgressBarSpecialTextures(builder);
- }
+
+ addProgressBar(builder, uiProperties);
+
builder.widget(
createErrorStatusArea(
builder,
@@ -1381,29 +1316,82 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
/**
+ * Override to specify UI properties if this machine doesn't work with recipemap.
+ */
+ protected BasicUIProperties getUIProperties() {
+ if (getRecipeMap() != null) {
+ BasicUIProperties originalProperties = getRecipeMap().getFrontend()
+ .getUIProperties();
+ return originalProperties.toBuilder()
+ .maxItemInputs(mInputSlotCount)
+ .maxItemOutputs(mOutputItems.length)
+ .maxFluidInputs(Math.min(originalProperties.maxFluidInputs, 1))
+ .maxFluidOutputs(Math.min(originalProperties.maxFluidOutputs, 1))
+ .build();
+ }
+ return BasicUIProperties.builder()
+ .maxItemInputs(mInputSlotCount)
+ .maxItemOutputs(mOutputItems.length)
+ .maxFluidInputs(getCapacity() != 0 ? 1 : 0)
+ .maxFluidOutputs(0)
+ .build();
+ }
+
+ /**
* Adds item I/O, special item, and fluid I/O slots.
*/
- protected void addIOSlots(ModularWindow.Builder builder) {
- final boolean hasFluidInput = getRecipeList() != null ? (getRecipeList().hasFluidInputs())
- : (getCapacity() != 0);
- final boolean hasFluidOutput = getRecipeList() != null && getRecipeList().hasFluidOutputs();
+ protected void addIOSlots(ModularWindow.Builder builder, BasicUIProperties uiProperties) {
UIHelper.forEachSlots(
(i, backgrounds, pos) -> builder.widget(createItemInputSlot(i, backgrounds, pos)),
(i, backgrounds, pos) -> builder.widget(createItemOutputSlot(i, backgrounds, pos)),
- (i, backgrounds, pos) -> builder.widget(createSpecialSlot(backgrounds, pos)),
+ (i, backgrounds, pos) -> builder.widget(createSpecialSlot(backgrounds, pos, uiProperties)),
(i, backgrounds, pos) -> builder.widget(createFluidInputSlot(backgrounds, pos)),
(i, backgrounds, pos) -> builder.widget(createFluidOutputSlot(backgrounds, pos)),
getGUITextureSet().getItemSlot(),
getGUITextureSet().getFluidSlot(),
- getRecipeList(),
- mInputSlotCount,
- mOutputItems.length,
- hasFluidInput ? 1 : 0,
- hasFluidOutput ? 1 : 0,
+ uiProperties,
+ uiProperties.maxItemInputs,
+ uiProperties.maxItemOutputs,
+ uiProperties.maxFluidInputs,
+ uiProperties.maxFluidOutputs,
getSteamVariant(),
Pos2d.ZERO);
}
+ protected void addProgressBar(ModularWindow.Builder builder, BasicUIProperties uiProperties) {
+ boolean isSteamPowered = isSteampowered();
+ RecipeMap<?> recipeMap = getRecipeMap();
+ if (!isSteamPowered && uiProperties.progressBarTexture == null) {
+ if (recipeMap != null) {
+ // Require progress bar texture for machines working with recipemap, otherwise permit
+ throw new RuntimeException("Missing progressbar texture for " + recipeMap.unlocalizedName);
+ } else {
+ return;
+ }
+ }
+ if (isSteamPowered && uiProperties.progressBarTextureSteam == null) {
+ if (recipeMap != null) {
+ throw new RuntimeException("Missing steam progressbar texture for " + recipeMap.unlocalizedName);
+ } else {
+ return;
+ }
+ }
+
+ builder.widget(
+ setNEITransferRect(
+ new ProgressBar()
+ .setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0)
+ .setTexture(
+ isSteamPowered ? uiProperties.progressBarTextureSteam.get(getSteamVariant())
+ : uiProperties.progressBarTexture.get(),
+ uiProperties.progressBarImageSize)
+ .setDirection(uiProperties.progressBarDirection)
+ .setPos(uiProperties.progressBarPos)
+ .setSize(uiProperties.progressBarSize),
+ uiProperties.neiTransferRectId));
+ addProgressBarSpecialTextures(builder, uiProperties);
+ }
+
/**
* Override this as needed instead of calling.
*/
@@ -1425,13 +1413,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
/**
* Override this as needed instead of calling.
*/
- protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos) {
+ protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos, BasicUIProperties uiProperties) {
return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()).setAccess(true, true)
.disableShiftInsert()
.setGTTooltip(
- () -> mTooltipCache.getData(
- getRecipeList() != null && getRecipeList().usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP
- : UNUSED_SLOT_TOOLTIP))
+ () -> mTooltipCache.getData(uiProperties.useSpecialSlot ? SPECIAL_SLOT_TOOLTIP : UNUSED_SLOT_TOOLTIP))
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setBackground(backgrounds)
.setPos(pos);
@@ -1478,40 +1464,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
.setSize(18, 18);
}
- protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction,
- Pos2d pos, Size size) {
- final ProgressBar ret = new ProgressBar();
- ret.setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0)
- .setTexture(texture, imageSize)
- .setDirection(direction)
- .setPos(pos)
- .setSize(size);
- return ret;
- }
-
- public boolean hasNEITransferRect() {
- return getRecipeList() != null;
- }
-
protected Widget setNEITransferRect(Widget widget, String transferRectID) {
- if (hasNEITransferRect()) {
- final Power powerInfo = getPower();
- final String transferRectTooltip;
- if (isSteampowered()) {
- transferRectTooltip = StatCollector
- .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString());
- } else {
- transferRectTooltip = StatCollector
- .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString());
- }
- widget.setNEITransferRect(transferRectID, new Object[] { powerInfo }, transferRectTooltip);
+ if (GT_Utility.isStringInvalid(transferRectID)) {
+ return widget;
+ }
+ final String transferRectTooltip;
+ if (isSteampowered()) {
+ transferRectTooltip = StatCollector
+ .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, overclockDescriber.getTierString());
+ } else {
+ transferRectTooltip = StatCollector
+ .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, overclockDescriber.getTierString());
}
+ widget.setNEITransferRect(transferRectID, new Object[] { overclockDescriber }, transferRectTooltip);
return widget;
}
- protected void addProgressBarSpecialTextures(ModularWindow.Builder builder) {
+ protected void addProgressBarSpecialTextures(ModularWindow.Builder builder, BasicUIProperties uiProperties) {
if (isSteampowered()) {
- for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTexturesSteam) {
+ for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : uiProperties.specialTexturesSteam) {
builder.widget(
new DrawableWidget().setDrawable(
specialTexture.getLeft()
@@ -1524,7 +1495,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
.getRight()));
}
} else {
- for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTextures) {
+ for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : uiProperties.specialTextures) {
builder.widget(
new DrawableWidget().setDrawable(specialTexture.getLeft())
.setSize(
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
index e1321c144f..5eb648d560 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java
@@ -35,13 +35,13 @@ import gregtech.api.gui.modularui.GUITextureSet;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.overclockdescriber.OverclockDescriber;
+import gregtech.api.objects.overclockdescriber.SteamOverclockDescriber;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
-import gregtech.common.power.Power;
-import gregtech.common.power.SteamPower;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -70,8 +70,8 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
}
@Override
- public Power buildPower() {
- return new SteamPower(mTier, 1, 2);
+ public OverclockDescriber createOverclockDescriber() {
+ return new SteamOverclockDescriber(SteamVariant.BRONZE, 1, 2);
}
@Override
@@ -189,11 +189,11 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
@Override
public int checkRecipe() {
- GT_Recipe tRecipe = getRecipeList().findRecipe(getBaseMetaTileEntity(), false, TierEU.LV, null, getAllInputs());
+ GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, TierEU.LV, null, getAllInputs());
if ((tRecipe != null) && (canOutput(tRecipe.mOutputs))
&& (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0);
- calculateOverclockedNess(tRecipe);
+ calculateCustomOverclock(tRecipe);
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
return DID_NOT_FIND_RECIPE;
@@ -380,7 +380,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
String[] description = Arrays.copyOf(mDescriptionArray, mDescriptionArray.length + 1);
description[mDescriptionArray.length] = StatCollector.translateToLocal(TT_machineType) + ": "
+ EnumChatFormatting.YELLOW
- + StatCollector.translateToLocal(this.getRecipeList().mUnlocalizedName)
+ + StatCollector.translateToLocal(this.getRecipeMap().unlocalizedName)
+ EnumChatFormatting.RESET;
return description;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
index 3297490b51..8bba0fee25 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
@@ -5,7 +5,6 @@ import static gregtech.api.enums.GT_Values.VN;
import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.GT_Values.ticksBetweenSounds;
import static gregtech.api.enums.Mods.BartWorks;
-import static gregtech.api.enums.Mods.GregTech;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import static net.minecraftforge.common.util.ForgeDirection.UP;
@@ -21,9 +20,6 @@ import net.minecraftforge.oredict.OreDictionary;
import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
-import com.gtnewhorizons.modularui.api.math.Pos2d;
-import com.gtnewhorizons.modularui.api.math.Size;
-import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -39,10 +35,11 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.recipe.BasicUIProperties;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.ExternalMaterials;
import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
import ic2.core.Ic2Items;
@@ -55,20 +52,19 @@ import ic2.core.Ic2Items;
*/
public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_BasicMachine {
- private final GT_Recipe.GT_Recipe_Map mRecipes;
+ private final RecipeMap<?> mRecipes;
private final int mTankCapacity;
private final SpecialEffects mSpecialEffect;
private final ResourceLocation mSoundResourceLocation;
- private final boolean mSharedTank, mRequiresFluidForFiltering;
private FallbackableUITexture progressBarTexture;
+ private int recipeCatalystPriority;
/**
* Registers machine with single-line description, specific tank capacity, and sound specified by ResourceLocation.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- ResourceLocation aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
+ String aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ ResourceLocation aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -80,8 +76,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aOutputSlots,
aTankCapacity,
aSound,
- aSharedTank,
- aRequiresFluidForFiltering,
aSpecialEffect,
aOverlays,
aRecipe);
@@ -91,15 +85,14 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Registers machine with multi-line descriptions, specific tank capacity, and sound specified by ResourceLocation.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- ResourceLocation aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
+ String[] aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ ResourceLocation aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
super(
aID,
aName,
aNameRegional,
aTier,
- aRecipes.mAmperage,
+ aRecipes.getAmperage(),
aDescription,
aInputSlots,
aOutputSlots,
@@ -176,13 +169,12 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
"basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_GLOW")))
.glow()
.build()));
- this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
this.mSpecialEffect = aSpecialEffect;
- this.mRequiresFluidForFiltering = aRequiresFluidForFiltering;
this.mRecipes = aRecipes;
this.mSoundResourceLocation = aSound;
- this.progressBarTexture = mRecipes.getProgressBarTextureRaw();
+ this.progressBarTexture = mRecipes.getFrontend()
+ .getUIProperties().progressBarTexture;
// TODO: CHECK
if (aRecipe != null) {
@@ -447,9 +439,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Registers machine with single-line description, auto-scaled fluid tank, and sound specified by SoundResource.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
- SoundResource aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
+ String aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
+ SoundResource aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -461,35 +452,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aOutputSlots,
usesFluids ? getCapacityForTier(aTier) : 0,
aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
- aSpecialEffect,
- aOverlays,
- aRecipe);
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(int, String, String, int, String,
- * GT_Recipe.GT_Recipe_Map, int, int, boolean, SoundResource, boolean, boolean, SpecialEffects, String, Object[])}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
- int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank,
- boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
- this(
- aID,
- aName,
- aNameRegional,
- aTier,
- aDescription,
- aRecipes,
- aInputSlots,
- aOutputSlots,
- usesFluids ? getCapacityForTier(aTier) : 0,
- aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
aSpecialEffect,
aOverlays,
aRecipe);
@@ -499,9 +461,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Registers machine with multi-line descriptions, auto-scaled fluid tank, and sound specified by SoundResource.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
- SoundResource aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
+ String[] aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
+ SoundResource aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -513,35 +474,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aOutputSlots,
usesFluids ? getCapacityForTier(aTier) : 0,
aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
- aSpecialEffect,
- aOverlays,
- aRecipe);
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(int, String, String, int, String[],
- * GT_Recipe.GT_Recipe_Map, int, int, boolean, SoundResource, boolean, boolean, SpecialEffects, String, Object[])}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, boolean usesFluids,
- int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank,
- boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
- this(
- aID,
- aName,
- aNameRegional,
- aTier,
- aDescription,
- aRecipes,
- aInputSlots,
- aOutputSlots,
- usesFluids ? getCapacityForTier(aTier) : 0,
- aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
aSpecialEffect,
aOverlays,
aRecipe);
@@ -551,9 +483,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Registers machine with single-line description, specific tank capacity, and sound specified by SoundResource.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- SoundResource aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
+ String aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ SoundResource aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -565,35 +496,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aOutputSlots,
aTankCapacity,
aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
- aSpecialEffect,
- aOverlays,
- aRecipe);
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(int, String, String, int, String,
- * GT_Recipe.GT_Recipe_Map, int, int, int, SoundResource, boolean, boolean, SpecialEffects, String, Object[])}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank,
- boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
- this(
- aID,
- aName,
- aNameRegional,
- aTier,
- aDescription,
- aRecipes,
- aInputSlots,
- aOutputSlots,
- aTankCapacity,
- aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
aSpecialEffect,
aOverlays,
aRecipe);
@@ -603,36 +505,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
* Registers machine with multi-line descriptions, specific tank capacity, and sound specified by SoundResource.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- SoundResource aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect,
- String aOverlays, Object[] aRecipe) {
- this(
- aID,
- aName,
- aNameRegional,
- aTier,
- aDescription,
- aRecipes,
- aInputSlots,
- aOutputSlots,
- aTankCapacity,
- aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
- aSpecialEffect,
- aOverlays,
- aRecipe);
- }
-
- /**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(int, String, String, int, String[],
- * GT_Recipe.GT_Recipe_Map, int, int, int, SoundResource, boolean, boolean, SpecialEffects, String, Object[])}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank,
- boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
+ String[] aDescription, RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
+ SoundResource aSound, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) {
this(
aID,
aName,
@@ -644,52 +518,20 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aOutputSlots,
aTankCapacity,
aSound.resourceLocation,
- aSharedTank,
- aRequiresFluidForFiltering,
aSpecialEffect,
aOverlays,
aRecipe);
}
/**
- * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe(int, String, String, int, String,
- * GT_Recipe.GT_Recipe_Map, int, int, int, ResourceLocation, boolean, boolean, SpecialEffects, String, Object[])}
- */
- @Deprecated
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity,
- int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank,
- boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) {
- this(
- aID,
- aName,
- aNameRegional,
- aTier,
- aDescription,
- aRecipes,
- aInputSlots,
- aOutputSlots,
- aTankCapacity,
- new ResourceLocation(aSound),
- aSharedTank,
- aRequiresFluidForFiltering,
- SpecialEffects.fromId(aSpecialEffect),
- aOverlays,
- aRecipe);
- }
-
- /**
* For {@link #newMetaEntity}.
*/
public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription,
- GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
- ITexture[][][] aTextures, ResourceLocation aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering,
- SpecialEffects aSpecialEffect) {
+ RecipeMap<?> aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
+ ITexture[][][] aTextures, ResourceLocation aSound, SpecialEffects aSpecialEffect) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots);
- this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
this.mSpecialEffect = aSpecialEffect;
- this.mRequiresFluidForFiltering = aRequiresFluidForFiltering;
this.mRecipes = aRecipes;
this.mSoundResourceLocation = aSound;
}
@@ -707,9 +549,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
this.mAmperage,
this.mTextures,
this.mSoundResourceLocation,
- this.mSharedTank,
- this.mRequiresFluidForFiltering,
- this.mSpecialEffect).setProgressBarTexture(this.progressBarTexture);
+ this.mSpecialEffect).setProgressBarTexture(this.progressBarTexture)
+ .setRecipeCatalystPriority(this.recipeCatalystPriority);
}
public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTexture(FallbackableUITexture progressBarTexture) {
@@ -718,8 +559,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name, UITexture fallback) {
- return setProgressBarTexture(
- new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback));
+ return setProgressBarTexture(GT_UITextures.fallbackableProgressbar(name, fallback));
}
public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name) {
@@ -735,9 +575,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
return false;
}
case 1 -> {
- if (this.getFillableStack() == null) return !this.mRequiresFluidForFiltering && this.getRecipeList()
+ if (this.getFillableStack() == null) return this.getRecipeMap()
.containsInput(aStack);
- else return this.getRecipeList()
+ else return this.getRecipeMap()
.findRecipe(
this.getBaseMetaTileEntity(),
this.mLastRecipe,
@@ -750,25 +590,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
!= null;
}
case 2 -> {
- return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null)
- && (((this.getInputAt(0) != null && this.getInputAt(1) != null)
- || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList()
+ return ((this.getInputAt(0) != null && this.getInputAt(1) != null)
+ || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeMap()
+ .containsInput(aStack)
+ : (this.getRecipeMap()
.containsInput(aStack)
- : (this.getRecipeList()
- .containsInput(aStack)
- && this.getRecipeList()
- .findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- true,
- true,
- V[this.mTier],
- new FluidStack[] { this.getFillableStack() },
- this.getSpecialSlot(),
- aIndex == this.getInputSlot()
- ? appendSelectedCircuit(aStack, this.getInputAt(1))
- : appendSelectedCircuit(this.getInputAt(0), aStack))
- != null))));
+ && this.getRecipeMap()
+ .findRecipe(
+ this.getBaseMetaTileEntity(),
+ this.mLastRecipe,
+ true,
+ true,
+ V[this.mTier],
+ new FluidStack[] { this.getFillableStack() },
+ this.getSpecialSlot(),
+ aIndex == this.getInputSlot() ? appendSelectedCircuit(aStack, this.getInputAt(1))
+ : appendSelectedCircuit(this.getInputAt(0), aStack))
+ != null)));
}
default -> {
int tID = this.getBaseMetaTileEntity()
@@ -786,7 +624,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
.startsWith("circuit")) return true;
}
}
- return this.getRecipeList()
+ return this.getRecipeMap()
.containsInput(aStack);
}
}
@@ -889,11 +727,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
@Override
- public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ public RecipeMap<?> getRecipeMap() {
return this.mRecipes;
}
@Override
+ public int getRecipeCatalystPriority() {
+ return recipeCatalystPriority;
+ }
+
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe setRecipeCatalystPriority(int recipeCatalystPriority) {
+ this.recipeCatalystPriority = recipeCatalystPriority;
+ return this;
+ }
+
+ @Override
public int getCapacity() {
return this.mTankCapacity;
}
@@ -922,20 +770,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
@Override
- public FluidStack getFillableStack() {
- return this.mSharedTank ? this.getDrainableStack() : super.getFillableStack();
- }
-
- @Override
- public FluidStack setFillableStack(FluidStack aFluid) {
- return this.mSharedTank ? this.setDrainableStack(aFluid) : super.setFillableStack(aFluid);
- }
-
- @Override
- protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction,
- Pos2d pos, Size size) {
- return super.createProgressBar(texture, imageSize, direction, pos, size)
- .setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize());
+ protected BasicUIProperties getUIProperties() {
+ return super.getUIProperties().toBuilder()
+ .progressBarTexture(progressBarTexture)
+ .build();
}
public enum X {
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
index eae713d28a..d6ae385430 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java
@@ -12,9 +12,9 @@ import gregtech.api.enums.Dyes;
import gregtech.api.enums.SteamVariant;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IGetTitleColor;
+import gregtech.api.objects.overclockdescriber.OverclockDescriber;
+import gregtech.api.objects.overclockdescriber.SteamOverclockDescriber;
import gregtech.api.render.TextureFactory;
-import gregtech.common.power.Power;
-import gregtech.common.power.SteamPower;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -36,8 +36,8 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn
}
@Override
- public Power buildPower() {
- return new SteamPower(mTier, 2, 1);
+ public OverclockDescriber createOverclockDescriber() {
+ return new SteamOverclockDescriber(SteamVariant.STEEL, 2, 1);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
index 85fb98cafd..6f351fb5ab 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java
@@ -20,6 +20,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.util.GT_ExoticEnergyInputHelper;
+import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_Utility;
/**
@@ -54,29 +55,13 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT
@Override
protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage,
boolean perfectOC) {
- // 5% space for cable loss
- long zMaxInputVoltage = maxInputVoltage / 100L * 95L;
- long zTime = aDuration;
- long zEUt = aEUt;
- while (zEUt < zMaxInputVoltage) {
- zEUt = zEUt << 2;
- zTime = zTime >> (perfectOC ? 2 : 1);
- if (zTime <= 0) {
- break;
- }
- }
- if (zTime <= 0) {
- zTime = 1;
- }
- if (zEUt > zMaxInputVoltage) {
- zEUt = zEUt >> 2;
- zTime = zTime << (perfectOC ? 2 : 1);
- }
- if (zTime > Integer.MAX_VALUE - 1) {
- zTime = Integer.MAX_VALUE - 1;
- }
- this.lEUt = zEUt;
- this.mMaxProgresstime = (int) zTime;
+ GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(aEUt)
+ .setEUt(maxInputVoltage * mAmperage)
+ .setDuration(aDuration)
+ .setDurationDecreasePerOC(perfectOC ? 2 : 1)
+ .calculate();
+ lEUt = calculator.getConsumption();
+ mMaxProgresstime = calculator.getDuration();
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
index b6eb19b5aa..18aef371b6 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
@@ -14,13 +14,13 @@ import gregtech.api.gui.modularui.GT_UIInfos;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.render.TextureFactory;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
- public GT_Recipe_Map mRecipeMap = null;
+ public RecipeMap<?> mRecipeMap = null;
public GT_MetaTileEntity_Hatch_Input(int aID, String aName, String aNameRegional, int aTier) {
this(
@@ -112,13 +112,15 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- if (mRecipeMap != null) aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier);
+ if (mRecipeMap != null) {
+ aNBT.setString("recipeMap", mRecipeMap.unlocalizedName);
+ }
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- mRecipeMap = GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("recipeMap"), null);
+ mRecipeMap = RecipeMap.getFromOldIdentifier(aNBT.getString("recipeMap"));
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
index 5769cd82c2..f4c4eb6a14 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java
@@ -30,23 +30,22 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ClientPreference;
import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_TooltipDataCache;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.extensions.ArrayExt;
-import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch;
public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
- implements IConfigurationCircuitSupport, IAddUIWidgets, IRecipeProcessingAwareHatch {
+ implements IConfigurationCircuitSupport, IAddUIWidgets {
private static final String SORTING_MODE_TOOLTIP = "GT5U.machines.sorting_mode.tooltip";
private static final String ONE_STACK_LIMIT_TOOLTIP = "GT5U.machines.one_stack_limit.tooltip";
private static final int BUTTON_SIZE = 18;
- public GT_Recipe_Map mRecipeMap = null;
+ public RecipeMap<?> mRecipeMap = null;
public boolean disableSort;
public boolean disableFilter = true;
public boolean disableLimited = true;
@@ -204,7 +203,9 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
aNBT.setBoolean("disableSort", disableSort);
aNBT.setBoolean("disableFilter", disableFilter);
aNBT.setBoolean("disableLimited", disableLimited);
- if (mRecipeMap != null) aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier);
+ if (mRecipeMap != null) {
+ aNBT.setString("recipeMap", mRecipeMap.unlocalizedName);
+ }
}
@Override
@@ -212,8 +213,10 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch
super.loadNBTData(aNBT);
disableSort = aNBT.getBoolean("disableSort");
disableFilter = aNBT.getBoolean("disableFilter");
- if (aNBT.hasKey("disableLimited")) disableLimited = aNBT.getBoolean("disableLimited");
- mRecipeMap = GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("recipeMap"), null);
+ if (aNBT.hasKey("disableLimited")) {
+ disableLimited = aNBT.getBoolean("disableLimited");
+ }
+ mRecipeMap = RecipeMap.getFromOldIdentifier(aNBT.getString("recipeMap"));
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 767695658c..d2d3c347a0 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -72,15 +72,16 @@ import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.recipe.check.SingleRecipeCheck;
import gregtech.api.util.GT_ClientPreference;
import gregtech.api.util.GT_ExoticEnergyInputHelper;
import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_ParallelHelper;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.GT_Waila;
import gregtech.api.util.OutputHatchWrapper;
@@ -785,9 +786,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
IDualInputInventory slot = it.next();
processingLogic.setInputItems(slot.getItemInputs());
processingLogic.setInputFluids(slot.getFluidInputs());
- result = processingLogic.process();
- if (result.wasSuccessful()) {
- return result;
+ CheckRecipeResult foundResult = processingLogic.process();
+ if (foundResult.wasSuccessful()) {
+ return foundResult;
+ }
+ if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) {
+ // Recipe failed in interesting way, so remember that and continue searching
+ result = foundResult;
}
}
}
@@ -808,9 +813,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
inputItems.add(getControllerSlot());
}
processingLogic.setInputItems(inputItems.toArray(new ItemStack[0]));
- result = processingLogic.process();
- if (result.wasSuccessful()) {
- return result;
+ CheckRecipeResult foundResult = processingLogic.process();
+ if (foundResult.wasSuccessful()) {
+ return foundResult;
+ }
+ if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) {
+ // Recipe failed in interesting way, so remember that and continue searching
+ result = foundResult;
}
}
} else {
@@ -819,7 +828,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
inputItems.add(getControllerSlot());
}
processingLogic.setInputItems(inputItems);
- result = processingLogic.process();
+ CheckRecipeResult foundResult = processingLogic.process();
+ if (foundResult.wasSuccessful()) {
+ return foundResult;
+ }
+ if (foundResult != CheckRecipeResultRegistry.NO_RECIPE) {
+ // Recipe failed in interesting way, so remember that
+ result = foundResult;
+ }
}
return result;
}
@@ -1119,50 +1135,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
*/
protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage,
boolean perfectOC) {
- byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage));
- if (mTier == 0) {
- // Long time calculation
- long xMaxProgresstime = ((long) aDuration) << 1;
- if (xMaxProgresstime > Integer.MAX_VALUE - 1) {
- // make impossible if too long
- mEUt = Integer.MAX_VALUE - 1;
- mMaxProgresstime = Integer.MAX_VALUE - 1;
- } else {
- mEUt = GT_Utility.safeInt(aEUt >> 2);
- mMaxProgresstime = (int) xMaxProgresstime;
- }
- } else {
- // Long EUt calculation
- long xEUt = aEUt;
- // Isnt too low EUt check?
- long tempEUt = Math.max(xEUt, V[1]);
-
- mMaxProgresstime = aDuration;
-
- final int ocTimeShift = perfectOC ? 2 : 1;
-
- while (tempEUt <= V[mTier - 1] * mAmperage) {
- tempEUt <<= 2; // this actually controls overclocking
- // xEUt *= 4;//this is effect of everclocking
- int oldTime = mMaxProgresstime;
- mMaxProgresstime >>= ocTimeShift; // this is effect of overclocking
- if (mMaxProgresstime < 1) {
- if (oldTime == 1) break;
- xEUt *= (long) oldTime * (perfectOC ? 1 : 2);
- break;
- } else {
- xEUt <<= 2;
- }
- }
- if (xEUt > Integer.MAX_VALUE - 1) {
- mEUt = Integer.MAX_VALUE - 1;
- mMaxProgresstime = Integer.MAX_VALUE - 1;
- } else {
- mEUt = (int) xEUt;
- if (mEUt == 0) mEUt = 1;
- if (mMaxProgresstime == 0) mMaxProgresstime = 1; // set time to 1 tick
- }
- }
+ GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(aEUt)
+ .setEUt(maxInputVoltage * mAmperage)
+ .setDuration(aDuration)
+ .setDurationDecreasePerOC(perfectOC ? 2 : 1)
+ .calculate();
+ mEUt = (int) calculator.getConsumption();
+ mMaxProgresstime = calculator.getDuration();
}
@Deprecated
@@ -1234,7 +1213,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
public boolean depleteInput(FluidStack aLiquid, boolean simulate) {
if (aLiquid == null) return false;
for (GT_MetaTileEntity_Hatch_Input tHatch : filterValidMTEs(mInputHatches)) {
- tHatch.mRecipeMap = getRecipeMap();
+ setHatchRecipeMap(tHatch);
FluidStack tLiquid = tHatch.drain(ForgeDirection.UNKNOWN, aLiquid, false);
if (tLiquid != null && tLiquid.amount >= aLiquid.amount) {
if (simulate) {
@@ -1274,7 +1253,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true);
if (aLiquid != null) return depleteInput(aLiquid);
for (GT_MetaTileEntity_Hatch_Input tHatch : filterValidMTEs(mInputHatches)) {
- tHatch.mRecipeMap = getRecipeMap();
+ setHatchRecipeMap(tHatch);
if (GT_Utility.areStacksEqual(
aStack,
tHatch.getBaseMetaTileEntity()
@@ -1336,7 +1315,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
ArrayList<FluidStack> rList = new ArrayList<>();
for (GT_MetaTileEntity_Hatch_Input tHatch : filterValidMTEs(mInputHatches)) {
- tHatch.mRecipeMap = getRecipeMap();
+ setHatchRecipeMap(tHatch);
if (tHatch instanceof GT_MetaTileEntity_Hatch_MultiInput) {
for (FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) {
if (tFluid != null) {
@@ -1393,7 +1372,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
@Override
- public GT_Recipe_Map getRecipeMap() {
+ public RecipeMap<?> getRecipeMap() {
return null;
}
@@ -1414,7 +1393,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
protected void startRecipeProcessing() {
for (GT_MetaTileEntity_Hatch_InputBus hatch : filterValidMTEs(mInputBusses)) {
- hatch.startRecipeProcessing();
+ if (hatch instanceof IRecipeProcessingAwareHatch aware) {
+ aware.startRecipeProcessing();
+ }
}
for (GT_MetaTileEntity_Hatch_Input hatch : filterValidMTEs(mInputHatches)) {
if (hatch instanceof IRecipeProcessingAwareHatch aware) {
@@ -1431,7 +1412,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
};
for (GT_MetaTileEntity_Hatch_InputBus hatch : filterValidMTEs(mInputBusses)) {
- setResultIfFailure.accept(hatch.endRecipeProcessing(this));
+ if (hatch instanceof IRecipeProcessingAwareHatch aware) {
+ setResultIfFailure.accept(aware.endRecipeProcessing(this));
+ }
}
for (GT_MetaTileEntity_Hatch_Input hatch : filterValidMTEs(mInputHatches)) {
if (hatch instanceof IRecipeProcessingAwareHatch aware) {
@@ -1453,7 +1436,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
return mDualInputHatches.add(hatch);
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
- ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ setHatchRecipeMap((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
@@ -1587,7 +1570,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input hatch) {
hatch.updateTexture(aBaseCasingIndex);
hatch.updateCraftingIcon(this.getMachineCraftingIcon());
- hatch.mRecipeMap = getRecipeMap();
+ setHatchRecipeMap(hatch);
return mInputHatches.add(hatch);
}
return false;
@@ -1605,6 +1588,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
return false;
}
+ protected void setHatchRecipeMap(GT_MetaTileEntity_Hatch_Input hatch) {
+ hatch.mRecipeMap = getRecipeMap();
+ }
+
@Override
public String[] getInfoData() {
int mPollutionReduction = 0;