Memoize isModLoaded lookups
This commit is contained in:
@@ -41,9 +41,6 @@ import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.blamejared.recipestages.recipes.RecipeStage;
|
||||
import net.darkhax.gamestages.GameStageHelper;
|
||||
import net.darkhax.itemstages.ItemStages;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -53,9 +50,6 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -157,8 +151,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||
protected IRecipe findRecipe(InventoryCrafting ic, World world, EntityPlayer player) {
|
||||
if (this.container instanceof ContainerCraftingTerm) {
|
||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||
if (this.container instanceof ContainerCraftingTerm containerTerminal) {
|
||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if (recipe != null && recipe.matches(ic, world)) {
|
||||
@@ -171,9 +164,8 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
||||
|
||||
// Returns null in case this recipe is not yet unlocked
|
||||
private IRecipe handleRecipe(InventoryCrafting ic, IRecipe recipe, EntityPlayer player) {
|
||||
if (Loader.isModLoaded("recipestages")) {
|
||||
if (recipe instanceof RecipeStage) {
|
||||
final RecipeStage staged = (RecipeStage) recipe;
|
||||
if (Platform.isModLoaded("recipestages")) {
|
||||
if (recipe instanceof RecipeStage staged) {
|
||||
if (!staged.isGoodForCrafting(ic))
|
||||
return null;
|
||||
}
|
||||
@@ -185,8 +177,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||
@Override
|
||||
protected NonNullList<ItemStack> getRemainingItems(InventoryCrafting ic, World world) {
|
||||
if (this.container instanceof ContainerCraftingTerm) {
|
||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||
if (this.container instanceof ContainerCraftingTerm containerTerminal) {
|
||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if (recipe != null && recipe.matches(ic, world)) {
|
||||
|
||||
Reference in New Issue
Block a user