From f3606c5305584bcdb5aabd39e9876e7e3ea801cd Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 13 Dec 2020 16:23:59 -0800 Subject: Cache steam fluid IDs on startup and use those instead of string comparisions everywhere. NOTE: Also drops MFR steam compat --- src/main/java/gregtech/api/util/GT_ModHandler.java | 48 ++++++++++++++++++++-- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 5cfcac0a89..bfa3f86e77 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -6,7 +6,12 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OreDictNames; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.ToolDictNames; import gregtech.api.interfaces.IDamagableItem; import gregtech.api.interfaces.IItemContainer; import gregtech.api.interfaces.internal.IGT_CraftingRecipe; @@ -31,7 +36,11 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.*; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.world.World; @@ -40,11 +49,26 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.stream.Collectors; -import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.DW; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.RA; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.W; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -125,6 +149,8 @@ public class GT_ModHandler { public static List sVanillaRecipeList_warntOutput = new ArrayList(50); public static final List sSingleNonBlockDamagableRecipeList_verified = new ArrayList(1000); private static Cache sSmeltingRecipeCache = CacheBuilder.newBuilder().maximumSize(1000).build(); + public static List sAnySteamFluidIDs = new ArrayList<>(); + public static List sSuperHeatedSteamFluidIDs = new ArrayList<>(); static { sNativeRecipeClasses.add(ShapedRecipes.class.getName()); @@ -216,6 +242,20 @@ public class GT_ModHandler { return aFluid.isFluidEqual(getSteam(1)); } + /** + * Returns if that Liquid is Any Steam (including other mods) + */ + public static boolean isAnySteam(FluidStack aFluid) { + return(aFluid != null && (isSteam(aFluid) || sAnySteamFluidIDs.contains(aFluid.getFluidID()))); + } + + /** + * Returns if that Liquid is Super Heated Steam (including other mods) + */ + public static boolean isSuperHeatedSteam(FluidStack aFluid) { + return(aFluid != null && sSuperHeatedSteamFluidIDs.contains(aFluid.getFluidID())); + } + /** * Returns a Liquid Stack with given amount of Steam. */ -- cgit