diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index 0d57fc6d5f9..05053d6fbb8 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -7,6 +7,8 @@ import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.oredict.OreDictionary; +import org.jetbrains.annotations.ApiStatus; + import java.time.LocalDate; import java.util.Random; import java.util.function.Supplier; @@ -120,10 +122,14 @@ public class GTValues { "Overpowered Voltage", "Maximum Voltage" }; /** - * ModID strings, since they are quite common parameters + * GregTech Mod ID */ - public static final String MODID = "gregtech", - MODID_FR = "forestry", + public static final String MODID = "gregtech"; + + /** @deprecated Use {@link gregtech.api.util.Mods} instead */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static final String MODID_FR = "forestry", MODID_CT = "crafttweaker", MODID_TOP = "theoneprobe", MODID_CTM = "ctm", diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index 4818c4a933a..ba4ac712a03 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -1,6 +1,6 @@ package gregtech.api.block; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import gregtech.client.model.ActiveVariantBlockBakedModel; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; @@ -22,7 +22,6 @@ import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -135,7 +134,7 @@ public IExtendedBlockState getExtendedState(@NotNull IBlockState state, @NotNull .withProperty(ACTIVE, Minecraft.getMinecraft().world != null && isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos)); - if (Loader.isModLoaded(GTValues.MODID_CTM)) { + if (Mods.CTM.isModLoaded()) { // if the Connected Textures Mod is loaded we wrap our IExtendedBlockState with their wrapper, // so that the CTM renderer can render the block properly. return new CTMExtendedState(ext, world, pos); diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index 6c23ce8c5f5..d45dfdf1e1d 100644 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -1,6 +1,5 @@ package gregtech.api.block.machines; -import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.BlockCustomParticle; import gregtech.api.block.UnlistedIntegerProperty; @@ -15,6 +14,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pipenet.IBlockAppearance; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.client.renderer.handler.MetaTileEntityRenderer; import gregtech.common.creativetab.GTCreativeTabs; import gregtech.common.items.MetaItems; @@ -56,7 +56,6 @@ import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -282,7 +281,7 @@ public void onBlockPlacedBy(World worldIn, @NotNull BlockPos pos, @NotNull IBloc } } } - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { if (metaTileEntity.getProxy() != null) { metaTileEntity.getProxy().setOwner((EntityPlayer) placer); } diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index f7a75111cc4..a7c9d6528ef 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -1,6 +1,5 @@ package gregtech.api.fluids; -import gregtech.api.GTValues; import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.store.FluidStorageKey; @@ -12,13 +11,13 @@ import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import net.minecraft.block.material.MaterialLiquid; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.common.Loader; import com.google.common.base.Preconditions; import io.github.drmanganese.topaddons.reference.Colors; @@ -380,7 +379,7 @@ private static int convertViscosity(double viscosity) { } // register cross mod compat for colors - if (Loader.isModLoaded(GTValues.MODID_TOP_ADDONS)) { + if (Mods.TOPAddons.isModLoaded()) { int displayColor = isColorEnabled || material == null ? color : material.getMaterialRGB(); Colors.FLUID_NAME_COLOR_MAP.put(name, displayColor); } diff --git a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java index d053c49e7d1..2c491d18ecc 100644 --- a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java @@ -1,14 +1,13 @@ package gregtech.api.gui.widgets; +import gregtech.api.util.Mods; + import net.minecraft.client.settings.KeyBinding; -import net.minecraftforge.fml.common.Loader; import java.util.function.Consumer; public class SortingButtonWidget extends ClickButtonWidget { - private static boolean inventoryTweaksChecked; - private static boolean inventoryTweaksPresent; private static KeyBinding sortKeyBinding; public SortingButtonWidget(int xPosition, int yPosition, int width, int height, String displayText, @@ -43,13 +42,10 @@ public boolean keyTyped(char charTyped, int keyCode) { } private static int getInvTweaksSortCode() { - if (!inventoryTweaksChecked) { - inventoryTweaksChecked = true; - inventoryTweaksPresent = Loader.isModLoaded("inventorytweaks"); - } - if (!inventoryTweaksPresent) { + if (!Mods.InventoryTweaks.isModLoaded()) { return 0; } + try { if (sortKeyBinding == null) { Class proxyClass = Class.forName("invtweaks.forge.ClientProxy"); diff --git a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java index 91bd1b739da..bf336ec4676 100644 --- a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java +++ b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java @@ -6,6 +6,7 @@ import gregtech.api.capability.IElectricItem; import gregtech.api.capability.impl.ElectricItem; import gregtech.api.items.metaitem.stats.*; +import gregtech.api.util.Mods; import gregtech.common.ConfigHolder; import gregtech.integration.baubles.BaublesModule; @@ -25,7 +26,6 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.common.Loader; import java.time.Duration; import java.time.Instant; @@ -75,7 +75,7 @@ public void onUpdate(ItemStack itemStack, Entity entity) { IInventory inventoryPlayer = entityPlayer.inventory; long transferLimit = electricItem.getTransferLimit(); - if (Loader.isModLoaded(GTValues.MODID_BAUBLES)) { + if (Mods.Baubles.isModLoaded()) { inventoryPlayer = BaublesModule.getBaublesWrappedInventory(entityPlayer); } diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java index 4fd8b940a93..f2674add426 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java @@ -30,6 +30,7 @@ import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.util.GTUtility; import gregtech.api.util.LocalizationUtils; +import gregtech.api.util.Mods; import gregtech.client.utils.ToolChargeBarRenderer; import gregtech.common.ConfigHolder; import gregtech.common.creativetab.GTCreativeTabs; @@ -110,7 +111,9 @@ * {@code addItem(0, "test_item").addStats(new ElectricStats(10000, 1, false)) } This will add single-use (not * rechargeable) LV battery with initial capacity 10000 EU */ -@Optional.Interface(modid = GTValues.MODID_ECORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") +@Optional.Interface( + modid = Mods.Names.ENDER_CORE, + iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") public abstract class MetaItem.MetaValueItem> extends Item implements ItemUIFactory, IOverlayRenderAware { diff --git a/src/main/java/gregtech/api/items/toolitem/IGTTool.java b/src/main/java/gregtech/api/items/toolitem/IGTTool.java index 4c3ba369341..94ae45effb9 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTTool.java @@ -24,6 +24,7 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.api.util.TextFormattingUtil; import gregtech.client.utils.ToolChargeBarRenderer; import gregtech.client.utils.TooltipHelper; @@ -89,14 +90,21 @@ * Backing of every variation of a GT Tool */ @Optional.InterfaceList({ - @Optional.Interface(modid = GTValues.MODID_APPENG, iface = "appeng.api.implementations.items.IAEWrench"), - @Optional.Interface(modid = GTValues.MODID_BC, iface = "buildcraft.api.tools.IToolWrench"), - @Optional.Interface(modid = GTValues.MODID_COFH, iface = "cofh.api.item.IToolHammer"), - @Optional.Interface(modid = GTValues.MODID_EIO, iface = "crazypants.enderio.api.tool.ITool"), - @Optional.Interface(modid = GTValues.MODID_FR, iface = "forestry.api.arboriculture.IToolGrafter"), - @Optional.Interface(modid = GTValues.MODID_PROJRED_CORE, iface = "mrtjp.projectred.api.IScrewdriver"), - @Optional.Interface(modid = GTValues.MODID_RC, iface = "mods.railcraft.api.items.IToolCrowbar"), - @Optional.Interface(modid = GTValues.MODID_ECORE, + @Optional.Interface(modid = Mods.Names.APPLIED_ENERGISTICS2, + iface = "appeng.api.implementations.items.IAEWrench"), + @Optional.Interface(modid = Mods.Names.BUILD_CRAFT_CORE, + iface = "buildcraft.api.tools.IToolWrench"), + @Optional.Interface(modid = Mods.Names.COFH_CORE, + iface = "cofh.api.item.IToolHammer"), + @Optional.Interface(modid = Mods.Names.ENDER_IO, + iface = "crazypants.enderio.api.tool.ITool"), + @Optional.Interface(modid = Mods.Names.FORESTRY, + iface = "forestry.api.arboriculture.IToolGrafter"), + @Optional.Interface(modid = Mods.Names.PROJECT_RED_CORE, + iface = "mrtjp.projectred.api.IScrewdriver"), + @Optional.Interface(modid = Mods.Names.RAILCRAFT, + iface = "mods.railcraft.api.items.IToolCrowbar"), + @Optional.Interface(modid = Mods.Names.ENDER_CORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") }) public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter, IOverlayRenderAware, IScrewdriver, IToolCrowbar { diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 96bb366b87d..2ba29cb597d 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -30,6 +30,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; @@ -1547,17 +1548,17 @@ public boolean canVoidRecipeFluidOutputs() { } @NotNull - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return AECableType.NONE; } @Nullable - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AENetworkProxy getProxy() { return null; } - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public void gridChanged() {} } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index 9d5662a1153..5c6487e6180 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity; -import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; import gregtech.api.capability.GregtechDataCodes; @@ -8,6 +7,7 @@ import gregtech.api.gui.IUIHolder; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.api.util.TextFormattingUtil; import gregtech.client.particle.GTNameTagParticle; import gregtech.client.particle.GTParticleManager; @@ -29,7 +29,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional.Interface; import net.minecraftforge.fml.common.Optional.InterfaceList; import net.minecraftforge.fml.common.Optional.Method; @@ -54,10 +53,11 @@ @InterfaceList(value = { @Interface(iface = "appeng.api.networking.security.IActionHost", - modid = GTValues.MODID_APPENG, + modid = Mods.Names.APPLIED_ENERGISTICS2, striprefs = true), - @Interface(iface = "appeng.me.helpers.IGridProxyable", modid = GTValues.MODID_APPENG, striprefs = true), -}) + @Interface(iface = "appeng.me.helpers.IGridProxyable", + modid = Mods.Names.APPLIED_ENERGISTICS2, + striprefs = true) }) public class MetaTileEntityHolder extends TickableTileEntityBase implements IGregTechTileEntity, IUIHolder, IWorldNameable, IActionHost, IGridProxyable { @@ -138,7 +138,7 @@ public void readFromNBT(@NotNull NBTTagCompound compound) { } else { GTLog.logger.error("Failed to load MetaTileEntity with invalid ID " + metaTileEntityIdRaw); } - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { readFromNBT_AENetwork(compound); } } @@ -154,7 +154,7 @@ public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { NBTTagCompound metaTileEntityData = new NBTTagCompound(); metaTileEntity.writeToNBT(metaTileEntityData); compound.setTag("MetaTileEntity", metaTileEntityData); - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { writeToNBT_AENetwork(compound); } } @@ -167,7 +167,7 @@ public void invalidate() { metaTileEntity.invalidate(); } super.invalidate(); - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { invalidateAE(); } } @@ -375,7 +375,7 @@ public void onChunkUnload() { if (metaTileEntity != null) { metaTileEntity.onUnload(); } - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { onChunkUnloadAE(); } } @@ -505,7 +505,7 @@ public ITextComponent getDisplayName() { @Nullable @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public IGridNode getGridNode(@NotNull AEPartLocation part) { // Forbid it connects the faces it shouldn't connect. if (this.getCableConnectionType(part) == AECableType.NONE) { @@ -517,44 +517,44 @@ public IGridNode getGridNode(@NotNull AEPartLocation part) { @NotNull @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return metaTileEntity == null ? AECableType.NONE : metaTileEntity.getCableConnectionType(part); } @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public void securityBreak() {} @NotNull @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public IGridNode getActionableNode() { AENetworkProxy proxy = getProxy(); return proxy == null ? null : proxy.getNode(); } @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AENetworkProxy getProxy() { return metaTileEntity == null ? null : metaTileEntity.getProxy(); } @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public DimensionalCoord getLocation() { return new DimensionalCoord(this); } @Override - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public void gridChanged() { if (metaTileEntity != null) { metaTileEntity.gridChanged(); } } - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public void readFromNBT_AENetwork(NBTTagCompound data) { AENetworkProxy proxy = getProxy(); if (proxy != null) { @@ -562,7 +562,7 @@ public void readFromNBT_AENetwork(NBTTagCompound data) { } } - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public void writeToNBT_AENetwork(NBTTagCompound data) { AENetworkProxy proxy = getProxy(); if (proxy != null) { @@ -570,7 +570,7 @@ public void writeToNBT_AENetwork(NBTTagCompound data) { } } - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) void onChunkUnloadAE() { AENetworkProxy proxy = getProxy(); if (proxy != null) { @@ -578,7 +578,7 @@ void onChunkUnloadAE() { } } - @Method(modid = GTValues.MODID_APPENG) + @Method(modid = Mods.Names.APPLIED_ENERGISTICS2) void invalidateAE() { AENetworkProxy proxy = getProxy(); if (proxy != null) { diff --git a/src/main/java/gregtech/api/recipes/ModHandler.java b/src/main/java/gregtech/api/recipes/ModHandler.java index 010d1c22346..1fe7ce05f07 100644 --- a/src/main/java/gregtech/api/recipes/ModHandler.java +++ b/src/main/java/gregtech/api/recipes/ModHandler.java @@ -16,6 +16,7 @@ import gregtech.api.util.DummyContainer; import gregtech.api.util.GTLog; import gregtech.api.util.LocalizationUtils; +import gregtech.api.util.Mods; import gregtech.api.util.world.DummyWorld; import gregtech.common.ConfigHolder; import gregtech.common.crafting.FluidReplaceRecipe; @@ -679,8 +680,6 @@ public static Pair getRecipeOutput(@Nullable World world, @N * disable the config and remove the recipes manually */ public static void removeSmeltingEBFMetals() { - boolean isCTLoaded = Loader.isModLoaded(GTValues.MODID_CT); - Field actionAddFurnaceRecipe$output = null; Map furnaceList = FurnaceRecipes.instance().getSmeltingList(); @@ -702,7 +701,7 @@ public static void removeSmeltingEBFMetals() { ItemStack ingot = OreDictUnifier.get(OrePrefix.ingot, material); // Check if the inputs are actually dust -> ingot if (ingot.isItemEqual(output) && dust.isItemEqual(input)) { - if (isCTLoaded) { + if (Mods.CraftTweaker.isModLoaded()) { if (actionAddFurnaceRecipe$output == null) { try { actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class diff --git a/src/main/java/gregtech/api/recipes/RecipeBuilder.java b/src/main/java/gregtech/api/recipes/RecipeBuilder.java index dd5fee598df..87175224c5d 100644 --- a/src/main/java/gregtech/api/recipes/RecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/RecipeBuilder.java @@ -22,6 +22,7 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.api.util.ValidationResult; import gregtech.common.ConfigHolder; import gregtech.integration.groovy.GroovyScriptModule; @@ -607,12 +608,12 @@ public R chancedFluidOutputLogic(@NotNull ChancedOutputLogic logic) { return (R) this; } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) public R inputs(IIngredient ingredient) { return input(ofGroovyIngredient(ingredient)); } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) public R inputs(IIngredient... ingredients) { for (IIngredient ingredient : ingredients) { inputs(ingredient); @@ -620,7 +621,7 @@ public R inputs(IIngredient... ingredients) { return (R) this; } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) public R inputs(Collection ingredients) { for (IIngredient ingredient : ingredients) { inputs(ingredient); @@ -628,12 +629,12 @@ public R inputs(Collection ingredients) { return (R) this; } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) public R notConsumable(IIngredient ingredient) { return notConsumable(ofGroovyIngredient(ingredient)); } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) private static GTRecipeInput ofGroovyIngredient(IIngredient ingredient) { if (ingredient instanceof OreDictIngredient) { return new GTRecipeOreInput(((OreDictIngredient) ingredient).getOreDict(), ingredient.getAmount()); @@ -857,7 +858,7 @@ protected EnumValidationResult validate() { return recipeStatus; } - @Optional.Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Optional.Method(modid = Mods.Names.GROOVY_SCRIPT) protected void validateGroovy(GroovyLog.Msg errorMsg) { errorMsg.add(EUt == 0, () -> "EU/t must not be to 0"); errorMsg.add(duration <= 0, () -> "Duration must not be less or equal to 0"); diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index 2f9417afe27..1103deef462 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -27,6 +27,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import gregtech.api.util.LocalizationUtils; +import gregtech.api.util.Mods; import gregtech.api.util.ValidationResult; import gregtech.common.ConfigHolder; import gregtech.integration.crafttweaker.CTRecipeHelper; @@ -942,7 +943,7 @@ private boolean shouldShiftWidgets() { return false; } - @Method(modid = GTValues.MODID_GROOVYSCRIPT) + @Method(modid = Mods.Names.GROOVY_SCRIPT) private VirtualizedRecipeMap getGroovyScriptRecipeMap() { return ((VirtualizedRecipeMap) grsVirtualizedRecipeMap); } @@ -1291,7 +1292,7 @@ public Collection getRecipeList() { } @ZenMethod("findRecipe") - @Method(modid = GTValues.MODID_CT) + @Method(modid = Mods.Names.CRAFT_TWEAKER) @Nullable public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { @@ -1304,7 +1305,7 @@ public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidSt } @ZenGetter("recipes") - @Method(modid = GTValues.MODID_CT) + @Method(modid = Mods.Names.CRAFT_TWEAKER) public List ctGetRecipeList() { return getRecipeList().stream().map(recipe -> new CTRecipe(this, recipe)).collect(Collectors.toList()); } @@ -1393,7 +1394,7 @@ public R recipeBuilder() { } @ZenMethod("recipeBuilder") - @Method(modid = GTValues.MODID_CT) + @Method(modid = Mods.Names.CRAFT_TWEAKER) public CTRecipeBuilder ctRecipeBuilder() { return new CTRecipeBuilder(recipeBuilder()); } diff --git a/src/main/java/gregtech/api/terminal/TerminalRegistry.java b/src/main/java/gregtech/api/terminal/TerminalRegistry.java index 6da73912e23..e842eb0c7a9 100644 --- a/src/main/java/gregtech/api/terminal/TerminalRegistry.java +++ b/src/main/java/gregtech/api/terminal/TerminalRegistry.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.hardware.Hardware; import gregtech.api.util.FileUtility; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.common.terminal.app.VirtualTankApp; @@ -131,7 +132,7 @@ public static void init() { .upgrade(1, MetaItems.EMITTER_HV.getStackForm(4), MetaItems.WORKSTATION_EV.getStackForm(2)) .defaultApp() .build(); - if (Loader.isModLoaded(GTValues.MODID_JEI)) { + if (Mods.JustEnoughItems.isModLoaded()) { AppRegistryBuilder.create(new RecipeChartApp()) .battery(GTValues.LV, 160) .upgrade(0, new ItemStack(Items.PAPER, 32)) diff --git a/src/main/java/gregtech/api/unification/ore/StoneType.java b/src/main/java/gregtech/api/unification/ore/StoneType.java index f92bb9c68bf..9e87a43a0b8 100644 --- a/src/main/java/gregtech/api/unification/ore/StoneType.java +++ b/src/main/java/gregtech/api/unification/ore/StoneType.java @@ -1,9 +1,9 @@ package gregtech.api.unification.ore; -import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTControlledRegistry; +import gregtech.api.util.Mods; import gregtech.common.ConfigHolder; import gregtech.integration.jei.basic.OreByProduct; @@ -11,7 +11,6 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import net.minecraftforge.fml.common.Loader; import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; @@ -50,7 +49,7 @@ public StoneType(int id, String name, SoundType soundType, OrePrefix processingP this.predicate = predicate::test; this.shouldBeDroppedAsItem = shouldBeDroppedAsItem || ConfigHolder.worldgen.allUniqueStoneTypes; STONE_TYPE_REGISTRY.register(id, name, this); - if (Loader.isModLoaded(GTValues.MODID_JEI) && this.shouldBeDroppedAsItem) { + if (Mods.JustEnoughItems.isModLoaded() && this.shouldBeDroppedAsItem) { OreByProduct.addOreByProductPrefix(this.processingPrefix); } } diff --git a/src/main/java/gregtech/api/util/CapesRegistry.java b/src/main/java/gregtech/api/util/CapesRegistry.java index 50972a56236..7d0acaa0ba6 100644 --- a/src/main/java/gregtech/api/util/CapesRegistry.java +++ b/src/main/java/gregtech/api/util/CapesRegistry.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.client.renderer.texture.Textures; import gregtech.core.network.packets.PacketNotifyCapeChange; @@ -214,13 +213,13 @@ public static void addFreeCape(ResourceLocation cape) { private static final List> ctRegisterCapes = new ArrayList<>(); private static final List ctFreeCapes = new ArrayList<>(); - @Optional.Method(modid = GTValues.MODID_CT) + @Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) @ZenMethod public static void registerCape(String advancement, String cape) { ctRegisterCapes.add(new Tuple<>(new ResourceLocation(advancement), new ResourceLocation(cape))); } - @Optional.Method(modid = GTValues.MODID_CT) + @Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) @ZenMethod public static void registerFreeCape(String cape) { ctFreeCapes.add(new ResourceLocation(cape)); diff --git a/src/main/java/gregtech/api/util/ModIncompatibilityException.java b/src/main/java/gregtech/api/util/ModIncompatibilityException.java new file mode 100644 index 00000000000..c21439cc5fe --- /dev/null +++ b/src/main/java/gregtech/api/util/ModIncompatibilityException.java @@ -0,0 +1,35 @@ +package gregtech.api.util; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiErrorScreen; +import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.List; + +@SideOnly(Side.CLIENT) +public class ModIncompatibilityException extends CustomModLoadingErrorDisplayException { + + @SuppressWarnings("all") + private static final long serialVersionUID = 1L; + + private final List messages; + + public ModIncompatibilityException(List messages) { + this.messages = messages; + } + + @Override + public void initGui(GuiErrorScreen guiErrorScreen, FontRenderer fontRenderer) {} + + @Override + public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseX, int mouseY, float time) { + int x = errorScreen.width / 2; + int y = 75; + for (String message : messages) { + errorScreen.drawCenteredString(fontRenderer, message, x, y, 0xFFFFFF); + y += 15; + } + } +} diff --git a/src/main/java/gregtech/api/util/Mods.java b/src/main/java/gregtech/api/util/Mods.java new file mode 100644 index 00000000000..c022672f095 --- /dev/null +++ b/src/main/java/gregtech/api/util/Mods.java @@ -0,0 +1,252 @@ +package gregtech.api.util; + +import gregtech.api.GTValues; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.relauncher.FMLLaunchHandler; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +public enum Mods { + + AdvancedRocketry(Names.ADVANCED_ROCKETRY), + AppliedEnergistics2(Names.APPLIED_ENERGISTICS2), + Baubles(Names.BAUBLES), + BinnieCore(Names.BINNIE_CORE), + BiomesOPlenty(Names.BIOMES_O_PLENTY), + BuildCraftCore(Names.BUILD_CRAFT_CORE), + Chisel(Names.CHISEL), + CoFHCore(Names.COFH_CORE), + CTM(Names.CONNECTED_TEXTURES_MOD), + CubicChunks(Names.CUBIC_CHUNKS), + CraftTweaker(Names.CRAFT_TWEAKER), + EnderCore(Names.ENDER_CORE), + EnderIO(Names.ENDER_IO), + ExtraBees(Names.EXTRA_BEES), + ExtraTrees(Names.EXTRA_TREES), + ExtraUtilities2(Names.EXTRA_UTILITIES2), + Forestry(Names.FORESTRY), + ForestryApiculture(Names.FORESTRY, forestryModule(Names.FORESTRY_APICULTURE)), + ForestryArboriculture(Names.FORESTRY, forestryModule(Names.FORESTRY_ARBORICULTURE)), + ForestryLepidopterology(Names.FORESTRY, forestryModule(Names.FORESTRY_LEPIDOPTEROLOGY)), + GalacticraftCore(Names.GALACTICRAFT_CORE), + Genetics(Names.GENETICS), + GregTech(Names.GREGTECH), + GregTechFoodOption(Names.GREGTECH_FOOD_OPTION), + GroovyScript(Names.GROOVY_SCRIPT), + GTCE2OC(Names.GTCE_2_OC), + HWYLA(Names.HWYLA), + ImmersiveEngineering(Names.IMMERSIVE_ENGINEERING), + IndustrialCraft2(Names.INDUSTRIAL_CRAFT2), + InventoryTweaks(Names.INVENTORY_TWEAKS), + JourneyMap(Names.JOURNEY_MAP), + JustEnoughItems(Names.JUST_ENOUGH_ITEMS), + MagicBees(Names.MAGIC_BEES), + Nothirium(Names.NOTHIRIUM), + NuclearCraft(Names.NUCLEAR_CRAFT, versionExcludes("2o")), + NuclearCraftOverhauled(Names.NUCLEAR_CRAFT, versionContains("2o")), + OpenComputers(Names.OPEN_COMPUTERS), + ProjectRedCore(Names.PROJECT_RED_CORE), + Railcraft(Names.RAILCRAFT), + RefinedStorage(Names.REFINED_STORAGE), + TechReborn(Names.TECH_REBORN), + TheOneProbe(Names.THE_ONE_PROBE), + TinkersConstruct(Names.TINKERS_CONSTRUCT), + TOPAddons(Names.TOP_ADDONS), + VoxelMap(Names.VOXEL_MAP), + XaerosMinimap(Names.XAEROS_MINIMAP), + + // Special Optifine handler, but consolidated here for simplicity + Optifine(null) { + + @Override + public boolean isModLoaded() { + if (this.modLoaded == null) { + try { + Class c = Class.forName("net.optifine.shaders.Shaders"); + Field f = c.getDeclaredField("shaderPackLoaded"); + f.setAccessible(true); + this.modLoaded = f.getBoolean(null); + } catch (Exception ignored) { + this.modLoaded = false; + } + } + return this.modLoaded; + } + }; + + public static class Names { + + public static final String ADVANCED_ROCKETRY = "advancedrocketry"; + public static final String APPLIED_ENERGISTICS2 = "appliedenergistics2"; + public static final String BAUBLES = "baubles"; + public static final String BINNIE_CORE = "binniecore"; + public static final String BIOMES_O_PLENTY = "biomesoplenty"; + public static final String BUILD_CRAFT_CORE = "buildcraftcore"; + public static final String CHISEL = "chisel"; + public static final String COFH_CORE = "cofhcore"; + public static final String CONNECTED_TEXTURES_MOD = "ctm"; + public static final String CUBIC_CHUNKS = "cubicchunks"; + public static final String CRAFT_TWEAKER = "crafttweaker"; + public static final String ENDER_CORE = "endercore"; + public static final String ENDER_IO = "enderio"; + public static final String EXTRA_BEES = "extrabees"; + public static final String EXTRA_TREES = "extratrees"; + public static final String EXTRA_UTILITIES2 = "extrautils2"; + public static final String FORESTRY = "forestry"; + public static final String FORESTRY_APICULTURE = "apiculture"; + public static final String FORESTRY_ARBORICULTURE = "arboriculture"; + public static final String FORESTRY_LEPIDOPTEROLOGY = "lepidopterology"; + public static final String GALACTICRAFT_CORE = "galacticraftcore"; + public static final String GENETICS = "genetics"; + public static final String GREGTECH = GTValues.MODID; + public static final String GREGTECH_FOOD_OPTION = "gregtechfoodoption"; + public static final String GROOVY_SCRIPT = "groovyscript"; + public static final String GTCE_2_OC = "gtce2oc"; + public static final String HWYLA = "hwyla"; + public static final String IMMERSIVE_ENGINEERING = "immersiveengineering"; + public static final String INDUSTRIAL_CRAFT2 = "ic2"; + public static final String INVENTORY_TWEAKS = "inventorytweaks"; + public static final String JOURNEY_MAP = "journeymap"; + public static final String JUST_ENOUGH_ITEMS = "jei"; + public static final String MAGIC_BEES = "magicbees"; + public static final String NOTHIRIUM = "nothirium"; + public static final String NUCLEAR_CRAFT = "nuclearcraft"; + public static final String OPEN_COMPUTERS = "opencomputers"; + public static final String PROJECT_RED_CORE = "projred-core"; + public static final String RAILCRAFT = "railcraft"; + public static final String REFINED_STORAGE = "refinedstorage"; + public static final String TECH_REBORN = "techreborn"; + public static final String THE_ONE_PROBE = "theoneprobe"; + public static final String TINKERS_CONSTRUCT = "tconstruct"; + public static final String TOP_ADDONS = "topaddons"; + public static final String VOXEL_MAP = "voxelmap"; + public static final String XAEROS_MINIMAP = "xaerominimap"; + } + + private final String ID; + private final Function extraCheck; + protected Boolean modLoaded; + + Mods(String ID) { + this.ID = ID; + this.extraCheck = null; + } + + /** + * @param extraCheck A supplier that can be used to test additional factors, such as + * checking if a mod is at a specific version, or a sub-mod is loaded. + * Used in cases like NC vs NCO, where the mod id is the same + * so the version has to be parsed to test which is loaded. + * Another case is checking for specific Forestry modules, checking + * if Forestry is loaded and if a specific module is enabled. + */ + Mods(String ID, Function extraCheck) { + this.ID = ID; + this.extraCheck = extraCheck; + } + + public boolean isModLoaded() { + if (this.modLoaded == null) { + this.modLoaded = Loader.isModLoaded(this.ID); + if (this.modLoaded) { + if (this.extraCheck != null && !this.extraCheck.apply(this)) { + this.modLoaded = false; + } + } + } + return this.modLoaded; + } + + /** + * Throw an exception if this mod is found to be loaded. + * This must be called in or after + * {@link net.minecraftforge.fml.common.event.FMLPreInitializationEvent}! + */ + public void throwIncompatibilityIfLoaded(String... customMessages) { + if (isModLoaded()) { + String modName = TextFormatting.BOLD + ID + TextFormatting.RESET; + List messages = new ArrayList<>(); + messages.add(modName + " mod detected, this mod is incompatible with GregTech CE Unofficial."); + messages.addAll(Arrays.asList(customMessages)); + if (FMLLaunchHandler.side() == Side.SERVER) { + throw new RuntimeException(String.join(",", messages)); + } else { + throwClientIncompatibility(messages); + } + } + } + + @SideOnly(Side.CLIENT) + private static void throwClientIncompatibility(List messages) { + throw new ModIncompatibilityException(messages); + } + + public ItemStack getItem(@NotNull String name) { + return getItem(name, 0, 1, null); + } + + @NotNull + public ItemStack getItem(@NotNull String name, int meta) { + return getItem(name, meta, 1, null); + } + + @NotNull + public ItemStack getItem(@NotNull String name, int meta, int amount) { + return getItem(name, meta, amount, null); + } + + @NotNull + public ItemStack getItem(@NotNull String name, int meta, int amount, @Nullable String nbt) { + if (!isModLoaded()) { + return ItemStack.EMPTY; + } + return GameRegistry.makeItemStack(ID + ":" + name, meta, amount, nbt); + } + + // Helpers for the extra checker + + /** Test if the mod version string contains the passed value. */ + private static Function versionContains(String versionPart) { + return mod -> { + if (mod.ID == null) return false; + if (!mod.isModLoaded()) return false; + ModContainer container = Loader.instance().getIndexedModList().get(mod.ID); + if (container == null) return false; + return container.getVersion().contains(versionPart); + }; + } + + /** Test if the mod version string does not contain the passed value. */ + private static Function versionExcludes(String versionPart) { + return mod -> { + if (mod.ID == null) return false; + if (!mod.isModLoaded()) return false; + ModContainer container = Loader.instance().getIndexedModList().get(mod.ID); + if (container == null) return false; + return !container.getVersion().contains(versionPart); + }; + } + + /** Test if a specific Forestry module is enabled. */ + private static Function forestryModule(String moduleID) { + if (Forestry.isModLoaded()) { + return mod -> forestry.modules.ModuleHelper.isEnabled(moduleID); + } else { + return $ -> false; + } + } +} diff --git a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java index 2a30f9e1eeb..858f28bc328 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.util.FileUtility; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.api.worldgen.filler.BlacklistedBlockFiller; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.filler.LayeredBlockFiller; @@ -123,7 +124,7 @@ public void initializeRegistry() { } catch (IOException | RuntimeException exception) { GTLog.logger.fatal("Failed to initialize worldgen registry.", exception); } - if (Loader.isModLoaded("galacticraftcore")) { + if (Mods.GalacticraftCore.isModLoaded()) { try { Class transformerHooksClass = Class.forName("micdoodle8.mods.galacticraft.core.TransformerHooks"); Field otherModGeneratorsWhitelistField = transformerHooksClass diff --git a/src/main/java/gregtech/asm/GregTechTransformer.java b/src/main/java/gregtech/asm/GregTechTransformer.java index 4d98621cfa8..005ec295075 100644 --- a/src/main/java/gregtech/asm/GregTechTransformer.java +++ b/src/main/java/gregtech/asm/GregTechTransformer.java @@ -1,6 +1,6 @@ package gregtech.asm; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import gregtech.asm.util.ObfMapping; import gregtech.asm.util.TargetClassVisitor; import gregtech.asm.visitors.*; @@ -8,8 +8,6 @@ import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; @@ -136,13 +134,12 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - // fix NC recipe compat different depending on overhaul vs underhaul - ModContainer container = Loader.instance().getIndexedModList().get(GTValues.MODID_NC); - if (container.getVersion().contains("2o")) { // overhauled + // fix NC recipe compat different depending on overhaul vs normal + if (Mods.NuclearCraftOverhauled.isModLoaded()) { classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), 0); - } else { + } else if (Mods.NuclearCraft.isModLoaded()) { classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); } diff --git a/src/main/java/gregtech/asm/hooks/CTMHooks.java b/src/main/java/gregtech/asm/hooks/CTMHooks.java index eaf4f7ad51c..bf254934d5c 100644 --- a/src/main/java/gregtech/asm/hooks/CTMHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMHooks.java @@ -1,6 +1,6 @@ package gregtech.asm.hooks; -import gregtech.client.shader.Shaders; +import gregtech.api.util.Mods; import gregtech.client.utils.BloomEffectUtil; import net.minecraft.block.state.IBlockState; @@ -20,7 +20,7 @@ public class CTMHooks { public static ThreadLocal ENABLE = new ThreadLocal<>(); public static boolean checkLayerWithOptiFine(boolean canRenderInLayer, byte layers, BlockRenderLayer layer) { - if (Shaders.isOptiFineShaderPackLoaded()) { + if (Mods.Optifine.isModLoaded()) { if (canRenderInLayer) { if (layer == BloomEffectUtil.getBloomLayer()) return false; } else if ((layers >> BloomEffectUtil.getBloomLayer().ordinal() & 1) == 1 && @@ -34,7 +34,7 @@ public static boolean checkLayerWithOptiFine(boolean canRenderInLayer, byte laye public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, IBakedModel bakedModel, IBlockState state, EnumFacing side, long rand) { - if (Shaders.isOptiFineShaderPackLoaded() && CTMHooks.ENABLE.get() == null) { + if (Mods.Optifine.isModLoaded() && CTMHooks.ENABLE.get() == null) { if (layer == BloomEffectUtil.getBloomLayer()) { return Collections.emptyList(); } else if (layer == BloomEffectUtil.getEffectiveBloomLayer()) { diff --git a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java index f1b87a1fc12..750de53af3b 100644 --- a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java @@ -1,6 +1,6 @@ package gregtech.asm.visitors; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import gregtech.asm.util.ObfMapping; import net.minecraftforge.fml.common.Loader; @@ -28,7 +28,7 @@ public static void transform(Iterator methods) { callRenderLampOverlay.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", "renderLampOverlay", "(Lnet/minecraft/item/ItemStack;II)V", false)); - boolean enderCoreLoaded = Loader.instance().getIndexedModList().containsKey(GTValues.MODID_ECORE); + boolean enderCoreLoaded = Loader.instance().getIndexedModList().containsKey(Mods.Names.ENDER_CORE); // do not conflict with EnderCore's changes, which already do what we need InsnList callRenderElectricBar; diff --git a/src/main/java/gregtech/client/ClientProxy.java b/src/main/java/gregtech/client/ClientProxy.java index 2b7207a232d..7fb4773d478 100644 --- a/src/main/java/gregtech/client/ClientProxy.java +++ b/src/main/java/gregtech/client/ClientProxy.java @@ -10,6 +10,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.IBlockOre; +import gregtech.api.util.Mods; import gregtech.client.model.customtexture.CustomTextureModelHandler; import gregtech.client.model.customtexture.MetadataSectionCTM; import gregtech.client.renderer.handler.FacadeRenderer; @@ -52,7 +53,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -77,7 +77,7 @@ public void onPreLoad() { SoundSystemConfig.setNumberNormalChannels(ConfigHolder.client.maxNumSounds); - if (!Loader.isModLoaded(GTValues.MODID_CTM)) { + if (!Mods.CTM.isModLoaded()) { Minecraft.getMinecraft().metadataSerializer.registerMetadataSectionType(new MetadataSectionCTM.Serializer(), MetadataSectionCTM.class); MinecraftForge.EVENT_BUS.register(CustomTextureModelHandler.INSTANCE); diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java index 75f05440797..9f8580344ec 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java @@ -1,6 +1,6 @@ package gregtech.client.model.pipeline; -import gregtech.client.shader.Shaders; +import gregtech.api.util.Mods; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -134,7 +134,7 @@ protected void processQuad() { updateColor(normal[v], color[v], x, y, z, tint, multiplier); // When enabled this causes the rendering to be black with Optifine - if (!Shaders.isOptiFineShaderPackLoaded() && diffuse) { + if (!Mods.Optifine.isModLoaded() && diffuse) { float d = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); for (int i = 0; i < 3; i++) { color[v][i] *= d; diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java index 79b83e9998e..f1d6f852e3c 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java @@ -1,6 +1,6 @@ package gregtech.client.model.pipeline; -import gregtech.client.shader.Shaders; +import gregtech.api.util.Mods; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.math.MathHelper; @@ -15,7 +15,7 @@ public VertexLighterSmoothAoSpecial(BlockColors colors) { @Override protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { - if (Shaders.isOptiFineShaderPackLoaded()) { + if (Mods.Optifine.isModLoaded()) { super.updateLightmap(normal, lightmap, x, y, z); return; } @@ -28,7 +28,7 @@ protected void updateLightmap(float[] normal, float[] lightmap, float x, float y protected void updateColor(float[] normal, float[] color, float x, float y, float z, float tint, int multiplier) { super.updateColor(normal, color, x, y, z, tint, multiplier); - if (Shaders.isOptiFineShaderPackLoaded()) { + if (Mods.Optifine.isModLoaded()) { return; } @@ -146,7 +146,7 @@ protected float getAo(float x, float y, float z) { @Override public void updateBlockInfo() { - if (Shaders.isOptiFineShaderPackLoaded()) { + if (Mods.Optifine.isModLoaded()) { super.updateBlockInfo(); return; } diff --git a/src/main/java/gregtech/client/shader/Shaders.java b/src/main/java/gregtech/client/shader/Shaders.java index e1eb6ef0474..1d20438bbbb 100644 --- a/src/main/java/gregtech/client/shader/Shaders.java +++ b/src/main/java/gregtech/client/shader/Shaders.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.common.ConfigHolder; import net.minecraft.client.Minecraft; @@ -15,11 +16,10 @@ import codechicken.lib.render.shader.ShaderObject; import codechicken.lib.render.shader.ShaderProgram; +import org.jetbrains.annotations.ApiStatus; -import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; -import java.util.function.BooleanSupplier; import java.util.function.Consumer; import static codechicken.lib.render.shader.ShaderHelper.getStream; @@ -57,35 +57,12 @@ public class Shaders { public static ShaderObject S_BLUR; public static ShaderObject COMPOSITE; - // OptiFine - private static BooleanSupplier isShaderPackLoaded; - static { mc = Minecraft.getMinecraft(); FULL_IMAGE_PROGRAMS = new HashMap<>(); if (allowedShader()) { initShaders(); } - try { // hook optFine. thanks to Scannable. - final Class clazz = Class.forName("net.optifine.shaders.Shaders"); - final Field shaderPackLoaded = clazz.getDeclaredField("shaderPackLoaded"); - shaderPackLoaded.setAccessible(true); - isShaderPackLoaded = () -> { - try { - return shaderPackLoaded.getBoolean(null); - } catch (final IllegalAccessException e) { - GTLog.logger.warn( - "Failed reading field indicating whether shaders are enabled. Shader mod integration disabled."); - isShaderPackLoaded = null; - return false; - } - }; - GTLog.logger.info("Find optiFine mod loaded."); - } catch (ClassNotFoundException e) { - GTLog.logger.info("No optiFine mod found."); - } catch (NoSuchFieldException | NoClassDefFoundError e) { - GTLog.logger.warn("Failed integrating with shader mod. Ignoring."); - } } public static void initShaders() { @@ -128,8 +105,11 @@ public static boolean allowedShader() { return OpenGlHelper.shadersSupported && ConfigHolder.client.shader.useShader; } + /** @deprecated Use {@link Mods#Optifine} to check this instead. */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static boolean isOptiFineShaderPackLoaded() { - return isShaderPackLoaded != null && isShaderPackLoaded.getAsBoolean(); + return Mods.Optifine.isModLoaded(); } public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject frag, diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index d1ac6f07cc0..2dcc7d0be14 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -1,6 +1,7 @@ package gregtech.client.utils; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.Mods; import gregtech.client.particle.GTParticle; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.Shaders; @@ -20,7 +21,6 @@ import net.minecraft.launchwrapper.Launch; import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.common.util.EnumHelper; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -101,7 +101,7 @@ public static BlockRenderLayer getEffectiveBloomLayer() { */ @Contract("null -> _; !null -> !null") public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) { - return Shaders.isOptiFineShaderPackLoaded() ? fallback : bloom; + return Mods.Optifine.isModLoaded() ? fallback : bloom; } /** @@ -133,7 +133,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive) { */ @Contract("_, null -> _; _, !null -> !null") public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive, BlockRenderLayer fallback) { - return Shaders.isOptiFineShaderPackLoaded() || !isBloomActive ? fallback : bloom; + return Mods.Optifine.isModLoaded() || !isBloomActive ? fallback : bloom; } /** @@ -221,7 +221,7 @@ public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup @NotNull BloomType bloomType, @NotNull IBloomEffect render, @Nullable Predicate validityChecker) { - if (Shaders.isOptiFineShaderPackLoaded()) return null; + if (Mods.Optifine.isModLoaded()) return null; BloomRenderTicket ticket = new BloomRenderTicket(setup, bloomType, render, validityChecker); SCHEDULED_BLOOM_RENDERS.add(ticket); return ticket; @@ -253,7 +253,7 @@ public boolean test(BloomRenderTicket bloomRenderTicket) { public static void init() { bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[] { String.class }, "Bloom"); BLOOM = bloom; - if (Loader.isModLoaded("nothirium")) { + if (Mods.Nothirium.isModLoaded()) { try { // Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to // that too. @@ -285,7 +285,7 @@ public static int renderBloomBlockLayer(RenderGlobal renderGlobal, Minecraft mc = Minecraft.getMinecraft(); mc.profiler.endStartSection("BTLayer"); - if (Shaders.isOptiFineShaderPackLoaded()) { + if (Mods.Optifine.isModLoaded()) { return renderGlobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); } diff --git a/src/main/java/gregtech/client/utils/DepthTextureUtil.java b/src/main/java/gregtech/client/utils/DepthTextureUtil.java index 3aa59bf75b4..d3bd1c4f06d 100644 --- a/src/main/java/gregtech/client/utils/DepthTextureUtil.java +++ b/src/main/java/gregtech/client/utils/DepthTextureUtil.java @@ -1,6 +1,6 @@ package gregtech.client.utils; -import gregtech.client.shader.Shaders; +import gregtech.api.util.Mods; import gregtech.common.ConfigHolder; import net.minecraft.client.Minecraft; @@ -40,7 +40,7 @@ public class DepthTextureUtil { private static int lastWidth, lastHeight; private static boolean shouldRenderDepthTexture() { - return lastBind && !Shaders.isOptiFineShaderPackLoaded() && ConfigHolder.client.hookDepthTexture && + return lastBind && !Mods.Optifine.isModLoaded() && ConfigHolder.client.hookDepthTexture && OpenGlHelper.isFramebufferEnabled(); } diff --git a/src/main/java/gregtech/client/utils/ItemRenderCompat.java b/src/main/java/gregtech/client/utils/ItemRenderCompat.java index bff1b3e5cb9..4ea385c8910 100644 --- a/src/main/java/gregtech/client/utils/ItemRenderCompat.java +++ b/src/main/java/gregtech/client/utils/ItemRenderCompat.java @@ -1,12 +1,11 @@ package gregtech.client.utils; -import gregtech.api.GTValues; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.api.util.world.DummyWorld; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.fml.common.Loader; import appeng.items.misc.ItemEncodedPattern; import org.jetbrains.annotations.ApiStatus; @@ -74,7 +73,7 @@ public interface RepresentativeStackExtractor { private static final class AE2StackExtractor implements RepresentativeStackExtractor { public static @Nullable ItemRenderCompat.AE2StackExtractor create() { - if (!Loader.isModLoaded(GTValues.MODID_APPENG)) return null; + if (!Mods.AppliedEnergistics2.isModLoaded()) return null; GTLog.logger.info("AppliedEnergistics2 found; enabling render integration."); return new AE2StackExtractor(); } @@ -112,7 +111,7 @@ private RSStackExtractor(MethodHandle getPatternFromCacheHandle, MethodHandle ge } public static @Nullable ItemRenderCompat.RSStackExtractor create() { - if (!Loader.isModLoaded(GTValues.MODID_RS)) return null; + if (!Mods.RefinedStorage.isModLoaded()) return null; Class clazz; try { diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 6cda26f8ce5..69bf9e9640c 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,11 +1,11 @@ package gregtech.common.items.behaviors; -import gregtech.api.GTValues; import gregtech.api.items.metaitem.stats.IItemDurabilityManager; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GradientUtil; +import gregtech.api.util.Mods; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.Block; @@ -23,7 +23,6 @@ import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.common.Loader; import appeng.api.util.AEColor; import appeng.tile.networking.TileCableBus; @@ -93,7 +92,7 @@ private boolean tryPaintSpecialBlock(EntityPlayer player, World world, BlockPos world.setBlockState(pos, newBlockState); return true; } - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { TileEntity te = world.getTileEntity(pos); if (te instanceof TileCableBus) { TileCableBus cable = (TileCableBus) te; @@ -146,7 +145,7 @@ private static boolean tryStripBlockColor(EntityPlayer player, World world, Bloc } // AE2 cable special case - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { if (te instanceof TileCableBus) { TileCableBus cable = (TileCableBus) te; // do not try to strip color if it is already colorless diff --git a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java index 15a3ebc2599..f5ce22ba925 100644 --- a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java @@ -5,6 +5,7 @@ import gregtech.api.capability.IElectricItem; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.util.Mods; import gregtech.integration.baubles.BaublesModule; import net.minecraft.client.resources.I18n; @@ -26,7 +27,6 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; @@ -162,7 +162,7 @@ public void onItemToss(@NotNull ItemTossEvent event) { if (event.getPlayer() == null) return; IInventory inventory = event.getPlayer().inventory; - if (Loader.isModLoaded(GTValues.MODID_BAUBLES)) { + if (Mods.Baubles.isModLoaded()) { inventory = BaublesModule.getBaublesWrappedInventory(event.getPlayer()); } diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index c346ac65e23..28e89934d0e 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -13,6 +13,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -128,7 +129,6 @@ import gregtech.integration.jei.multiblock.MultiblockInfoCategory; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.Loader; import java.util.HashMap; import java.util.Map; @@ -1169,7 +1169,7 @@ public static void init() { // organization. // ME Hatches, IDs 1745-1748 - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { FLUID_EXPORT_HATCH_ME = registerMetaTileEntity(1745, new MetaTileEntityMEOutputHatch(gregtechId("me_export_fluid_hatch"))); ITEM_EXPORT_BUS_ME = registerMetaTileEntity(1746, @@ -1290,7 +1290,7 @@ public static T registerMetaTileEntity(int id, T samp if (sampleMetaTileEntity instanceof IMultiblockAbilityPart abilityPart) { MultiblockAbility.registerMultiblockAbility(abilityPart.getAbility(), sampleMetaTileEntity); } - if (sampleMetaTileEntity instanceof MultiblockControllerBase && Loader.isModLoaded(GTValues.MODID_JEI)) { + if (sampleMetaTileEntity instanceof MultiblockControllerBase && Mods.JustEnoughItems.isModLoaded()) { if (((MultiblockControllerBase) sampleMetaTileEntity).shouldShowInJei()) { MultiblockInfoCategory.registerMultiblock((MultiblockControllerBase) sampleMetaTileEntity); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index 926f7386174..f953dff1b4e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.IPassthroughHatch; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.util.Mods; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; @@ -19,7 +20,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import appeng.api.util.AECableType; @@ -89,21 +89,21 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public void update() { super.update(); - if (isFirstTick() && Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (isFirstTick() && Mods.AppliedEnergistics2.isModLoaded()) { if (getProxy() != null) getProxy().onReady(); } } @NotNull @Override - @Optional.Method(modid = GTValues.MODID_APPENG) + @Optional.Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return AECableType.SMART; } @Nullable @Override - @Optional.Method(modid = GTValues.MODID_APPENG) + @Optional.Method(modid = Mods.Names.APPLIED_ENERGISTICS2) public AENetworkProxy getProxy() { if (gridProxy == null && getHolder() instanceof MetaTileEntityHolder) { gridProxy = new AENetworkProxy((MetaTileEntityHolder) getHolder(), "proxy", getStackForm(), true); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java index 0c34ab575ec..c09b9b91203 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java @@ -28,6 +28,7 @@ import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.util.BlockInfo; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -64,7 +65,6 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -543,7 +543,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.7")); tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.8")); tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.9")); - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { tooltip.add(I18n.format(AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) ? "gregtech.machine.cleanroom.tooltip.ae2.channels" : "gregtech.machine.cleanroom.tooltip.ae2.no_channels")); diff --git a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java index 56a96fb43ca..1439a5c5554 100644 --- a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java +++ b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java @@ -13,6 +13,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pattern.*; +import gregtech.api.util.Mods; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; @@ -449,7 +450,7 @@ public static void addWallBlock(@NotNull Block block) { } @ZenMethod("addWallBlock") - @Optional.Method(modid = GTValues.MODID_CT) + @Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) @SuppressWarnings("unused") public static void addWallBlockCT(@NotNull IBlock block) { WALL_BLOCKS.add(CraftTweakerMC.getBlock(block)); diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java index 106b142c66f..ba42b1a29cc 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.prospector.widget; -import gregtech.api.GTValues; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.unification.OreDictUnifier; @@ -33,7 +32,6 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -308,8 +306,7 @@ public void drawInForeground(int mouseX, int mouseY) { } } - if (Loader.isModLoaded(GTValues.MODID_JOURNEYMAP) || Loader.isModLoaded(GTValues.MODID_VOXELMAP) || - Loader.isModLoaded(GTValues.MODID_XAERO_MINIMAP)) { + if (Mods.JourneyMap.isModLoaded() || Mods.VoxelMap.isModLoaded() || Mods.XaerosMinimap.isModLoaded()) { tooltips.add(I18n.format("terminal.prospector.waypoint.add")); } this.drawHoveringText(ItemStack.EMPTY, tooltips, 300, mouseX, mouseY); @@ -336,11 +333,11 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { boolean added = false; trimHoveredNames(); - if (Loader.isModLoaded(GTValues.MODID_JOURNEYMAP)) { + if (Mods.JourneyMap.isModLoaded()) { added = addJourneymapWaypoint(b); - } else if (Loader.isModLoaded(GTValues.MODID_VOXELMAP)) { + } else if (Mods.VoxelMap.isModLoaded()) { added = addVoxelMapWaypoint(b); - } else if (Loader.isModLoaded(GTValues.MODID_XAERO_MINIMAP)) { + } else if (Mods.XaerosMinimap.isModLoaded()) { added = addXaeroMapWaypoint(b); } if (added) { @@ -382,7 +379,7 @@ private String createVeinName() { return s.substring(1, s.length() - 1); } - @Optional.Method(modid = GTValues.MODID_JOURNEYMAP) + @Optional.Method(modid = Mods.Names.JOURNEY_MAP) private boolean addJourneymapWaypoint(BlockPos b) { journeymap.client.model.Waypoint journeyMapWaypoint = new journeymap.client.model.Waypoint(createVeinName(), b, @@ -396,7 +393,7 @@ private boolean addJourneymapWaypoint(BlockPos b) { return false; } - @Optional.Method(modid = GTValues.MODID_VOXELMAP) + @Optional.Method(modid = Mods.Names.VOXEL_MAP) private boolean addVoxelMapWaypoint(@NotNull BlockPos b) { Color c = new Color(color); TreeSet world = new TreeSet<>(); @@ -425,7 +422,7 @@ private boolean addVoxelMapWaypoint(@NotNull BlockPos b) { return false; } - @Optional.Method(modid = GTValues.MODID_XAERO_MINIMAP) + @Optional.Method(modid = Mods.Names.XAEROS_MINIMAP) private boolean addXaeroMapWaypoint(@NotNull BlockPos b) { int red = clampColor(color >> 16 & 0xFF); int green = clampColor(color >> 8 & 0xFF); diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java index f4b7fe6f2e1..8ead4466af8 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java @@ -17,6 +17,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.client.shader.Shaders; import gregtech.client.utils.DepthTextureUtil; import gregtech.client.utils.RenderBufferHelper; @@ -490,7 +491,7 @@ private static void renderScan(float getPartialTicks) { Minecraft mc = Minecraft.getMinecraft(); World world = mc.world; Entity viewer = mc.getRenderViewEntity(); - if (world != null && viewer != null && !Shaders.isOptiFineShaderPackLoaded()) { + if (world != null && viewer != null && !Mods.Optifine.isModLoaded()) { Framebuffer fbo = mc.getFramebuffer(); diff --git a/src/main/java/gregtech/integration/IntegrationModule.java b/src/main/java/gregtech/integration/IntegrationModule.java index 15d760b4a63..65f02e3c938 100644 --- a/src/main/java/gregtech/integration/IntegrationModule.java +++ b/src/main/java/gregtech/integration/IntegrationModule.java @@ -2,12 +2,12 @@ import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; +import gregtech.api.util.Mods; import gregtech.common.items.MetaItems; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -47,13 +47,13 @@ public List> getEventBusSubscribers() { public void init(FMLInitializationEvent event) { super.init(event); - if (Loader.isModLoaded(GTValues.MODID_IE)) { + if (Mods.ImmersiveEngineering.isModLoaded()) { BelljarHandler.registerBasicItemFertilizer(MetaItems.FERTILIZER.getStackForm(), 1.25f); logger.info("Registered Immersive Engineering Compat"); } } - @Optional.Method(modid = GTValues.MODID_EIO) + @Optional.Method(modid = Mods.Names.ENDER_IO) @SubscribeEvent public static void registerFertilizer(@NotNull RegistryEvent.Register event) { event.getRegistry().register(new Bonemeal(MetaItems.FERTILIZER.getStackForm())); diff --git a/src/main/java/gregtech/integration/IntegrationUtil.java b/src/main/java/gregtech/integration/IntegrationUtil.java index 88cfe6ec990..c25edab7be0 100644 --- a/src/main/java/gregtech/integration/IntegrationUtil.java +++ b/src/main/java/gregtech/integration/IntegrationUtil.java @@ -11,6 +11,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,9 +19,16 @@ import java.util.Arrays; import java.util.List; +@Deprecated public class IntegrationUtil { - /** Should only be called after {@link net.minecraftforge.fml.common.event.FMLPreInitializationEvent} */ + /** + * Should only be called after {@link net.minecraftforge.fml.common.event.FMLPreInitializationEvent} + * + * @deprecated Use {@link gregtech.api.util.Mods} instead for these features. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static void throwIncompatibilityIfLoaded(String modID, String... customMessages) { if (Loader.isModLoaded(modID)) { String modName = TextFormatting.BOLD + modID + TextFormatting.RESET; @@ -31,7 +39,13 @@ public static void throwIncompatibilityIfLoaded(String modID, String... customMe } } - /** Should only be called after {@link net.minecraftforge.fml.common.event.FMLPreInitializationEvent} */ + /** + * Should only be called after {@link net.minecraftforge.fml.common.event.FMLPreInitializationEvent} + * + * @deprecated Use {@link gregtech.api.util.Mods} instead for these features. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static void throwIncompatibility(List messages) { if (FMLLaunchHandler.side() == Side.SERVER) { throw new RuntimeException(String.join(",", messages)); @@ -40,16 +54,31 @@ public static void throwIncompatibility(List messages) { } } + /** + * @deprecated Use {@link gregtech.api.util.Mods} instead for these features. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @NotNull public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta) { return getModItem(modid, name, meta, 1, null); } + /** + * @deprecated Use {@link gregtech.api.util.Mods} instead for these features. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @NotNull public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount) { return getModItem(modid, name, meta, amount, null); } + /** + * @deprecated Use {@link gregtech.api.util.Mods} instead for these features. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @NotNull public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, @Nullable String nbt) { diff --git a/src/main/java/gregtech/integration/baubles/BaublesModule.java b/src/main/java/gregtech/integration/baubles/BaublesModule.java index 4371d5a032d..6f725211e8f 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesModule.java +++ b/src/main/java/gregtech/integration/baubles/BaublesModule.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; +import gregtech.api.util.Mods; import gregtech.common.items.MetaItems; import gregtech.integration.IntegrationSubmodule; import gregtech.modules.GregTechModules; @@ -24,7 +25,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_BAUBLES, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_BAUBLES, + modDependencies = Mods.Names.BAUBLES, name = "GregTech Baubles Integration", description = "Baubles Integration Module") public class BaublesModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/chisel/ChiselModule.java b/src/main/java/gregtech/integration/chisel/ChiselModule.java index c6dc3cafe05..c8a5f8d3416 100644 --- a/src/main/java/gregtech/integration/chisel/ChiselModule.java +++ b/src/main/java/gregtech/integration/chisel/ChiselModule.java @@ -5,6 +5,7 @@ import gregtech.api.modules.GregTechModule; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; +import gregtech.api.util.Mods; import gregtech.common.blocks.BlockColored; import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockWarningSign; @@ -31,7 +32,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_CHISEL, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_CHISEL, + modDependencies = Mods.Names.CHISEL, name = "GregTech Chisel Integration", description = "Chisel Integration Module") public class ChiselModule extends IntegrationSubmodule { @@ -110,7 +111,7 @@ private void addVariation(String group, Block block, int meta) { tag.setString("group", group); tag.setString("block", Objects.requireNonNull(block.getRegistryName()).toString()); tag.setInteger("meta", meta); - FMLInterModComms.sendMessage(GTValues.MODID_CHISEL, "add_variation", tag); + FMLInterModComms.sendMessage(Mods.Names.CHISEL, "add_variation", tag); } private boolean doesGroupExist(String group) { diff --git a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java index 400c41a1110..37fb6535fe5 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java +++ b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java @@ -4,6 +4,7 @@ import gregtech.api.items.metaitem.MetaOreDictItem; import gregtech.api.modules.GregTechModule; import gregtech.api.unification.material.event.MaterialEvent; +import gregtech.api.util.Mods; import gregtech.integration.IntegrationModule; import gregtech.integration.IntegrationSubmodule; import gregtech.integration.crafttweaker.recipe.MetaItemBracketHandler; @@ -27,7 +28,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_CT, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_CT, + modDependencies = Mods.Names.CRAFT_TWEAKER, name = "GregTech CraftTweaker Integration", description = "CraftTweaker Integration Module") public class CraftTweakerModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java index b8dc8e77a9b..d12a134adc5 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java @@ -1,6 +1,5 @@ package gregtech.integration.crafttweaker.material; -import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; import gregtech.api.fluids.store.FluidStorageKey; @@ -14,6 +13,7 @@ import gregtech.api.unification.material.properties.ToolProperty; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import net.minecraft.enchantment.Enchantment; @@ -264,7 +264,7 @@ public CTMaterialBuilder itemPipeProperties(int priority, float stacksPerSec) { } @ZenMethod - @net.minecraftforge.fml.common.Optional.Method(modid = GTValues.MODID_CT) + @net.minecraftforge.fml.common.Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) public CTMaterialBuilder addDefaultEnchant(IEnchantment enchantment) { Enchantment enchantmentType = (Enchantment) enchantment.getDefinition().getInternal(); backingBuilder.addDefaultEnchant(enchantmentType, enchantment.getLevel()); diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java index 3f8e854cb29..aeef7c2ac07 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java @@ -1,11 +1,11 @@ package gregtech.integration.crafttweaker.material; -import gregtech.api.GTValues; import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.properties.*; +import gregtech.api.util.Mods; import net.minecraft.enchantment.Enchantment; @@ -65,7 +65,7 @@ public static boolean isGaseous(Material m) { // TODO May need to move this to Material @ZenGetter("fluid") - @net.minecraftforge.fml.common.Optional.Method(modid = GTValues.MODID_CT) + @net.minecraftforge.fml.common.Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) public static ILiquidDefinition getFluid(Material m) { FluidProperty prop = m.getProperty(PropertyKey.FLUID); if (prop != null) { @@ -164,13 +164,13 @@ public static int toolEnchant(Material m) { } @ZenMethod - @net.minecraftforge.fml.common.Optional.Method(modid = GTValues.MODID_CT) + @net.minecraftforge.fml.common.Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) public static void addToolEnchantment(Material m, IEnchantment enchantment) { addScaledToolEnchantment(m, enchantment, 0); } @ZenMethod - @net.minecraftforge.fml.common.Optional.Method(modid = GTValues.MODID_CT) + @net.minecraftforge.fml.common.Optional.Method(modid = Mods.Names.CRAFT_TWEAKER) public static void addScaledToolEnchantment(Material m, IEnchantment enchantment, double levelGrowth) { if (checkFrozen("add tool enchantment")) return; ToolProperty prop = m.getProperty(PropertyKey.TOOL); diff --git a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java index 76d76eb64c9..287b9a9e647 100644 --- a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java +++ b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java @@ -1,6 +1,6 @@ package gregtech.integration.ctm; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; import team.chisel.ctm.api.IFacade; -@Optional.Interface(modid = GTValues.MODID_CTM, iface = "team.chisel.ctm.api.IFacade") +@Optional.Interface(modid = Mods.Names.CONNECTED_TEXTURES_MOD, iface = "team.chisel.ctm.api.IFacade") public interface IFacadeWrapper extends IFacade { @NotNull diff --git a/src/main/java/gregtech/integration/forestry/ForestryModule.java b/src/main/java/gregtech/integration/forestry/ForestryModule.java index de316640666..b938f4ab228 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryModule.java +++ b/src/main/java/gregtech/integration/forestry/ForestryModule.java @@ -15,6 +15,7 @@ import gregtech.api.unification.material.properties.OreProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.Mods; import gregtech.common.items.ToolItems; import gregtech.integration.IntegrationModule; import gregtech.integration.IntegrationSubmodule; @@ -31,7 +32,6 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -52,7 +52,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_FR, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_FR, + modDependencies = Mods.Names.FORESTRY, name = "GregTech Forestry Integration", description = "Forestry Integration Module") public class ForestryModule extends IntegrationSubmodule { @@ -100,7 +100,7 @@ public void preInit(FMLPreInitializationEvent event) { // GT Frames if (ForestryConfig.enableGTFrames) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { FRAME_ACCELERATED = new GTItemFrame(GTFrameType.ACCELERATED); FRAME_MUTAGENIC = new GTItemFrame(GTFrameType.MUTAGENIC); FRAME_WORKING = new GTItemFrame(GTFrameType.WORKING); @@ -126,7 +126,7 @@ public void preInit(FMLPreInitializationEvent event) { // GT Bees if (ForestryConfig.enableGTBees) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { DROPS = new GTDropItem(); COMBS = new GTCombItem(); } else { @@ -137,7 +137,7 @@ public void preInit(FMLPreInitializationEvent event) { // Remove duplicate/conflicting bees from other Forestry addons. // Done in init to have our changes applied before their registration, // since we load after other Forestry addons purposefully. - if (ForestryConfig.disableConflictingBees && ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.disableConflictingBees && Mods.ForestryApiculture.isModLoaded()) { BeeRemovals.init(); } @@ -154,7 +154,7 @@ public void init(FMLInitializationEvent event) { ForestryElectrodeRecipes.onInit(); } - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.harderForestryRecipes) { ForestryMiscRecipes.initRemoval(); } @@ -165,12 +165,12 @@ public void init(FMLInitializationEvent event) { } } - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { registerAlvearyMutators(); } if (event.getSide() == Side.CLIENT) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.enableGTBees) { Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { if (stack.getItem() instanceof IColoredItem coloredItem) { @@ -185,7 +185,7 @@ public void init(FMLInitializationEvent event) { @Override public void postInit(FMLPostInitializationEvent event) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { getLogger().info("Copying Forestry Centrifuge recipes to GT Centrifuge"); CombRecipes.initForestryCombs(); } @@ -196,7 +196,7 @@ public static void registerItems(RegistryEvent.Register event) { IForgeRegistry registry = event.getRegistry(); // GT Frames - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.enableGTFrames) { registry.register(FRAME_ACCELERATED); registry.register(FRAME_MUTAGENIC); @@ -222,20 +222,19 @@ public static void registerItems(RegistryEvent.Register event) { ELECTRODE_OBSIDIAN = forestryMetaItem.addItem(10, "electrode.obsidian"); ELECTRODE_TIN = forestryMetaItem.addItem(11, "electrode.tin"); - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Mods.IndustrialCraft2.isModLoaded() || Mods.BinnieCore.isModLoaded()) { ELECTRODE_IRON = forestryMetaItem.addItem(12, "electrode.iron"); } - if (Loader.isModLoaded(GTValues.MODID_XU2)) { + if (Mods.ExtraUtilities2.isModLoaded()) { ELECTRODE_ORCHID = forestryMetaItem.addItem(13, "electrode.orchid"); } - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || - Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Mods.IndustrialCraft2.isModLoaded() || Mods.TechReborn.isModLoaded() || Mods.BinnieCore.isModLoaded()) { ELECTRODE_RUBBER = forestryMetaItem.addItem(14, "electrode.rubber"); } } // GT Drops - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.enableGTBees) { registry.register(DROPS); registry.register(COMBS); @@ -246,7 +245,7 @@ public static void registerItems(RegistryEvent.Register event) { @SideOnly(Side.CLIENT) @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.enableGTFrames) { FRAME_ACCELERATED.registerModel(FRAME_ACCELERATED, ForestryAPI.modelManager); FRAME_MUTAGENIC.registerModel(FRAME_MUTAGENIC, ForestryAPI.modelManager); @@ -265,7 +264,7 @@ public static void registerModels(ModelRegistryEvent event) { @SubscribeEvent public static void registerRecipes(RegistryEvent.Register event) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { // GT Frames if (ForestryConfig.enableGTFrames) { ForestryFrameRecipes.init(); @@ -294,7 +293,7 @@ public static void registerRecipes(RegistryEvent.Register event) { @SubscribeEvent public static void registerMaterials(MaterialEvent event) { - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { if (ForestryConfig.enableGTFrames) { Materials.TreatedWood.addFlags(MaterialFlags.GENERATE_LONG_ROD); Materials.Uranium235.addFlags(MaterialFlags.GENERATE_LONG_ROD); diff --git a/src/main/java/gregtech/integration/forestry/ForestryUtil.java b/src/main/java/gregtech/integration/forestry/ForestryUtil.java index 32fff8e1e19..1bc2a8df6c0 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryUtil.java +++ b/src/main/java/gregtech/integration/forestry/ForestryUtil.java @@ -1,6 +1,6 @@ package gregtech.integration.forestry; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import gregtech.integration.IntegrationModule; import gregtech.integration.forestry.bees.GTCombType; import gregtech.integration.forestry.bees.GTDropType; @@ -11,52 +11,39 @@ import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAlleleFlowers; -import forestry.modules.ModuleHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ForestryUtil { - public static boolean apicultureEnabled() { - return ModuleHelper.isEnabled("apiculture"); - } - - public static boolean arboricultureEnabled() { - return ModuleHelper.isEnabled("arboriculture"); - } - - public static boolean lepidopterologyEnabled() { - return ModuleHelper.isEnabled("lepidopterology"); - } - @Nullable - public static IAlleleBeeEffect getEffect(@NotNull String modid, @NotNull String name) { - String s = switch (modid) { - case GTValues.MODID_EB -> "extrabees.effect." + name; - case GTValues.MODID_MB -> "magicbees.effect" + name; - case GTValues.MODID -> "gregtech.effect." + name; + public static IAlleleBeeEffect getEffect(@NotNull Mods mod, @NotNull String name) { + String s = switch (mod) { + case ExtraBees -> "extrabees.effect." + name; + case MagicBees -> "magicbees.effect" + name; + case GregTech -> "gregtech.effect." + name; default -> "forestry.effect" + name; }; return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s); } @Nullable - public static IAlleleFlowers getFlowers(@NotNull String modid, @NotNull String name) { - String s = switch (modid) { - case GTValues.MODID_EB -> "extrabees.flower." + name; - case GTValues.MODID_MB -> "magicbees.flower" + name; - case GTValues.MODID -> "gregtech.flower." + name; + public static IAlleleFlowers getFlowers(@NotNull Mods mod, @NotNull String name) { + String s = switch (mod) { + case ExtraBees -> "extrabees.flower." + name; + case MagicBees -> "magicbees.flower" + name; + case GregTech -> "gregtech.flower." + name; default -> "forestry.flowers" + name; }; return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s); } @Nullable - public static IAlleleBeeSpecies getSpecies(@NotNull String modid, @NotNull String name) { - String s = switch (modid) { - case GTValues.MODID_EB -> "extrabees.species." + name; - case GTValues.MODID_MB -> "magicbees.species" + name; - case GTValues.MODID -> "gregtech.species." + name; + public static IAlleleBeeSpecies getSpecies(@NotNull Mods mod, @NotNull String name) { + String s = switch (mod) { + case ExtraBees -> "extrabees.species." + name; + case MagicBees -> "magicbees.species" + name; + case GregTech -> "gregtech.species." + name; default -> "forestry.species" + name; }; return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s); @@ -74,7 +61,7 @@ public static ItemStack getCombStack(@NotNull GTCombType type, int amount) { .error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } - if (!apicultureEnabled()) { + if (!Mods.ForestryApiculture.isModLoaded()) { IntegrationModule.logger.error("Tried to get GregTech Comb stack, but Apiculture module is not enabled!"); return ItemStack.EMPTY; } @@ -93,7 +80,7 @@ public static ItemStack getDropStack(@NotNull GTDropType type, int amount) { .error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } - if (!apicultureEnabled()) { + if (!Mods.ForestryApiculture.isModLoaded()) { IntegrationModule.logger.error("Tried to get GregTech Drop stack, but Apiculture module is not enabled!"); return ItemStack.EMPTY; } diff --git a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java index 65546dfe020..39dcb08e103 100644 --- a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java +++ b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java @@ -1,10 +1,8 @@ package gregtech.integration.forestry.bees; -import gregtech.api.GTValues; +import gregtech.api.util.Mods; import gregtech.integration.IntegrationModule; -import net.minecraftforge.fml.common.Loader; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -16,10 +14,10 @@ public class BeeRemovals { private static final List EB_REMOVALS = new ArrayList<>(); public static void init() { - if (Loader.isModLoaded(GTValues.MODID_MB)) { + if (Mods.MagicBees.isModLoaded()) { removeMagicBees(); } - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { removeExtraBees(); } } diff --git a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java index 891a8277bc9..0bd8d25bf53 100644 --- a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java +++ b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java @@ -3,7 +3,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.machines.IScannerRecipeMap; -import gregtech.integration.forestry.ForestryUtil; +import gregtech.api.util.Mods; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -60,7 +60,7 @@ public List getRepresentativeRecipes() { List recipes = new ArrayList<>(); ItemStack outputStack; - if (ForestryUtil.apicultureEnabled()) { + if (Mods.ForestryApiculture.isModLoaded()) { outputStack = ModuleApiculture.getItems().beeDroneGE.getItemStack(); outputStack.setTagCompound(BeeDefinition.COMMON.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.drone"); @@ -98,7 +98,7 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); } - if (ForestryUtil.arboricultureEnabled()) { + if (Mods.ForestryArboriculture.isModLoaded()) { outputStack = ModuleArboriculture.getItems().sapling.getItemStack(); outputStack.setTagCompound(TreeDefinition.Oak.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.sapling"); @@ -118,7 +118,7 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); } - if (ForestryUtil.lepidopterologyEnabled()) { + if (Mods.ForestryLepidopterology.isModLoaded()) { outputStack = ModuleLepidopterology.getItems().butterflyGE.getItemStack(); outputStack .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java index 269e992be1b..d4a967e4bfe 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java @@ -5,9 +5,9 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; +import gregtech.api.util.Mods; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; -import gregtech.integration.IntegrationUtil; import gregtech.integration.forestry.ForestryModule; import gregtech.integration.forestry.ForestryUtil; @@ -15,7 +15,6 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import appeng.core.Api; @@ -48,7 +47,7 @@ public enum GTBeeDefinition implements IBeeDefinition { // Organic CLAY(GTBranchDefinition.GT_ORGANIC, "Lutum", true, 0xC8C8DA, 0x0000FF, beeSpecies -> { - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { beeSpecies.addProduct(getExtraBeesComb(22), 0.30f); // CLAY } else { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -56,8 +55,8 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.addProduct(new ItemStack(Items.CLAY_BALL), 0.15f); beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); - if (Loader.isModLoaded(GTValues.MODID_BOP)) { - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_BOP, "mudball", 0), 0.05f); + if (Mods.BiomesOPlenty.isModLoaded()) { + beeSpecies.addSpecialty(Mods.BiomesOPlenty.getItem("mudball", 0), 0.05f); } }, template -> { @@ -77,10 +76,9 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.addSpecialty(getGTComb(GTCombType.STICKY), 0.05f); beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); - if (Loader.isModLoaded(GTValues.MODID_TCON)) { - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_TCON, "edible", 1), 0.10f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), - 0.01f); + if (Mods.TinkersConstruct.isModLoaded()) { + beeSpecies.addProduct(Mods.TinkersConstruct.getItem("edible", 1), 0.10f); + beeSpecies.addSpecialty(Mods.TinkersConstruct.getItem("slime_congealed", 2), 0.01f); } else { beeSpecies.addSpecialty(new ItemStack(Blocks.SLIME_BLOCK), 0.01f); } @@ -90,9 +88,9 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.SLOWER); AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1); - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, - ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + ForestryUtil.getFlowers(Mods.ExtraBees, "water")); } }, dis -> { @@ -167,15 +165,15 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, - ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + ForestryUtil.getFlowers(Mods.ExtraBees, "water")); } }, dis -> dis.registerMutation(COAL, STICKYRESIN, 4)), ASH(GTBranchDefinition.GT_ORGANIC, "Cinis", true, 0x1E1A18, 0xC6C6C6, beeSpecies -> { - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { beeSpecies.addProduct(getExtraBeesComb(9), 0.30f); // SEED } else { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -197,7 +195,7 @@ public enum GTBeeDefinition implements IBeeDefinition { }), APATITE(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { beeSpecies.addProduct(getExtraBeesComb(9), 0.15f); // SEED } else { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.15f); @@ -211,9 +209,9 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, - ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); + ForestryUtil.getFlowers(Mods.ExtraBees, "rock")); } }, dis -> { @@ -239,7 +237,7 @@ public enum GTBeeDefinition implements IBeeDefinition { }), FERTILIZER(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { beeSpecies.addProduct(getExtraBeesComb(9), 0.15f); // SEED } else { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.15f); @@ -247,7 +245,7 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.addSpecialty(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash), 0.2f); beeSpecies.addSpecialty(OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh), 0.2f); beeSpecies.addSpecialty(MetaItems.FERTILIZER.getStackForm(), 0.3f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_compound", 0), 0.3f); + beeSpecies.addSpecialty(Mods.Forestry.getItem("fertilizer_compound", 0), 0.3f); beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.WARM); }, @@ -273,16 +271,12 @@ public enum GTBeeDefinition implements IBeeDefinition { }), SANDWICH(GTBranchDefinition.GT_ORGANIC, "Sandwico", true, 0x32CD32, 0xDAA520, beeSpecies -> { - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber - // Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion - // Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato - // Slice + beeSpecies.addProduct(Mods.GregTechFoodOption.getItem("gtfo_meta_item", 81), 0.05f); // Cucumber Slice + beeSpecies.addProduct(Mods.GregTechFoodOption.getItem("gtfo_meta_item", 80), 0.05f); // Onion Slice + beeSpecies.addProduct(Mods.GregTechFoodOption.getItem("gtfo_meta_item", 79), 0.05f); // Tomato Slice beeSpecies.addSpecialty(new ItemStack(Items.COOKED_PORKCHOP), 0.05f); beeSpecies.addSpecialty(new ItemStack(Items.COOKED_BEEF), 0.15f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar - // Slice + beeSpecies.addSpecialty(Mods.GregTechFoodOption.getItem("gtfo_meta_item", 97), 0.05f); // Cheddar Slice beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); }, @@ -296,14 +290,13 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); }, dis -> { - if (Loader.isModLoaded(GTValues.MODID_MB)) { - dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), - 10); + if (Mods.MagicBees.isModLoaded()) { + dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(Mods.MagicBees, "Batty"), 10); } else { dis.registerMutation(BeeDefinition.AGRARIAN, BeeDefinition.IMPERIAL, 10); } }, - () -> Loader.isModLoaded(GTValues.MODID_GTFO)), + Mods.GregTechFoodOption::isModLoaded), // Gems REDSTONE(GTBranchDefinition.GT_GEM, "Rubrumlapis", true, 0x7D0F0F, 0xD11919, @@ -357,7 +350,7 @@ public enum GTBeeDefinition implements IBeeDefinition { Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock() .ifPresent(block -> mutation.requireResource(block.getDefaultState())); }, - () -> Loader.isModLoaded(GTValues.MODID_APPENG)), + Mods.AppliedEnergistics2::isModLoaded), DIAMOND(GTBranchDefinition.GT_GEM, "Adamas", false, 0xCCFFFF, 0xA3CCCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -422,7 +415,7 @@ public enum GTBeeDefinition implements IBeeDefinition { }), SPARKLING(GTBranchDefinition.GT_GEM, "Vesperstella", true, 0x7A007A, 0xFFFFFF, beeSpecies -> { - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 3), 0.20f); + beeSpecies.addProduct(Mods.MagicBees.getItem("resource", 3), 0.20f); beeSpecies.addSpecialty(getGTComb(GTCombType.SPARKLING), 0.125f); beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); @@ -438,12 +431,12 @@ public enum GTBeeDefinition implements IBeeDefinition { }, dis -> { IBeeMutationBuilder mutation = dis.registerMutation( - ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), - ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); + ForestryUtil.getSpecies(Mods.MagicBees, "Withering"), + ForestryUtil.getSpecies(Mods.MagicBees, "Draconic"), 1); mutation.requireResource("blockNetherStar"); mutation.restrictBiomeType(BiomeDictionary.Type.END); }, - () -> Loader.isModLoaded(GTValues.MODID_MB)), + Mods.MagicBees::isModLoaded), // Metals COPPER(GTBranchDefinition.GT_METAL, "Cuprum", true, 0xFF6600, 0xE65C00, @@ -588,9 +581,9 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, TOLERATES_RAIN, true); }, dis -> { - if (Loader.isModLoaded(GTValues.MODID_MB) && Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.MagicBees.isModLoaded() && Mods.AppliedEnergistics2.isModLoaded()) { // MB Skystone bee is only registered if AE2 is also active - dis.registerMutation(IRON, ForestryUtil.getSpecies(GTValues.MODID_MB, "AESkystone"), 17); + dis.registerMutation(IRON, ForestryUtil.getSpecies(Mods.MagicBees, "AESkystone"), 17); } else { dis.registerMutation(IRON, BeeDefinition.IMPERIAL, 17); } @@ -768,7 +761,7 @@ public enum GTBeeDefinition implements IBeeDefinition { // Industrial ENERGY(GTBranchDefinition.GT_INDUSTRIAL, "Industria", false, 0xC11F1F, 0xEBB9B9, beeSpecies -> { - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { beeSpecies.addProduct(getExtraBeesComb(14), 0.30f); // STATIC } else { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.SIMMERING), 0.30f); @@ -789,9 +782,9 @@ public enum GTBeeDefinition implements IBeeDefinition { }, dis -> { IBeeMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { mutation = dis.registerMutation(BeeDefinition.DEMONIC, - ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); + ForestryUtil.getSpecies(Mods.ExtraBees, "volcanic"), 10); } else { mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.FIENDISH, 10); } @@ -988,8 +981,8 @@ public enum GTBeeDefinition implements IBeeDefinition { }, dis -> { IMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_EB)) { - mutation = dis.registerMutation(THORIUM, ForestryUtil.getSpecies(GTValues.MODID_EB, "rotten"), 1); + if (Mods.ExtraBees.isModLoaded()) { + mutation = dis.registerMutation(THORIUM, ForestryUtil.getSpecies(Mods.ExtraBees, "rotten"), 1); } else { mutation = dis.registerMutation(THORIUM, BeeDefinition.IMPERIAL, 1); } @@ -1041,9 +1034,9 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), dis -> { IBeeMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_MB)) { + if (Mods.MagicBees.isModLoaded()) { mutation = dis.registerMutation(STAINLESSSTEEL, - ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); + ForestryUtil.getSpecies(Mods.MagicBees, "Watery"), 10); } else { mutation = dis.registerMutation(STAINLESSSTEEL, BeeDefinition.INDUSTRIOUS, 10); } @@ -1060,9 +1053,8 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), dis -> { IBeeMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), - 8); + if (Mods.MagicBees.isModLoaded()) { + mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(Mods.MagicBees, "Supernatural"), 8); } else { mutation = dis.registerMutation(HELIUM, BeeDefinition.IMPERIAL, 8); } @@ -1092,9 +1084,8 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), dis -> { IBeeMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), - 4); + if (Mods.MagicBees.isModLoaded()) { + mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(Mods.MagicBees, "Supernatural"), 4); } else { mutation = dis.registerMutation(NEON, BeeDefinition.AVENGING, 4); } @@ -1139,8 +1130,8 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), dis -> { IBeeMutationBuilder mutation; - if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(OXYGEN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 15); + if (Mods.MagicBees.isModLoaded()) { + mutation = dis.registerMutation(OXYGEN, ForestryUtil.getSpecies(Mods.MagicBees, "Watery"), 15); } else { mutation = dis.registerMutation(OXYGEN, BeeDefinition.INDUSTRIOUS, 15); } @@ -1233,14 +1224,14 @@ private static ItemStack getForestryComb(EnumHoneyComb type) { return ModuleApiculture.getItems().beeComb.get(type, 1); } - @Optional.Method(modid = GTValues.MODID_EB) + @Optional.Method(modid = Mods.Names.EXTRA_BEES) private static ItemStack getExtraBeesComb(int meta) { - return IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_comb", meta); + return Mods.ExtraBees.getItem("honey_comb", meta); } - @Optional.Method(modid = GTValues.MODID_MB) + @Optional.Method(modid = Mods.Names.MAGIC_BEES) private static ItemStack getMagicBeesComb(int meta) { - return IntegrationUtil.getModItem(GTValues.MODID_MB, "beecomb", meta); + return Mods.MagicBees.getItem("beecomb", meta); } private static ItemStack getGTComb(GTCombType type) { diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java index 0769ad034bf..e037872f2cf 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry.bees; import gregtech.api.GTValues; +import gregtech.api.util.Mods; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -37,7 +38,7 @@ public GTCombItem() { public void registerModel(@NotNull Item item, IModelManager manager) { manager.registerItemModel(item, 0); for (int i = 0; i < GTCombType.values().length; i++) { - manager.registerItemModel(item, i, GTValues.MODID_FR, "gt.comb"); + manager.registerItemModel(item, i, Mods.Names.FORESTRY, "gt.comb"); } } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java index f774e6f68d0..e17fc00a429 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java @@ -1,8 +1,6 @@ package gregtech.integration.forestry.bees; -import gregtech.api.GTValues; - -import net.minecraftforge.fml.common.Loader; +import gregtech.api.util.Mods; public enum GTCombType { @@ -27,7 +25,7 @@ public enum GTCombType { // Gem STONE("stone", 0x808080, 0x999999), CERTUS("certus", 0x57CFFB, 0xBBEEFF), - FLUIX("fluix", 0xA375FF, 0xB591FF, Loader.isModLoaded(GTValues.MODID_APPENG)), + FLUIX("fluix", 0xA375FF, 0xB591FF, Mods.AppliedEnergistics2.isModLoaded()), REDSTONE("redstone", 0x7D0F0F, 0xD11919), RAREEARTH("rareearth", 0x555643, 0x343428), LAPIS("lapis", 0x1947D1, 0x476CDA), @@ -38,7 +36,7 @@ public enum GTCombType { EMERALD("emerald", 0x248F24, 0x2EB82E), PYROPE("pyrope", 0x763162, 0x8B8B8B), GROSSULAR("grossular", 0x9B4E00, 0x8B8B8B), - SPARKLING("sparkling", 0x7A007A, 0xFFFFFF, Loader.isModLoaded(GTValues.MODID_MB)), + SPARKLING("sparkling", 0x7A007A, 0xFFFFFF, Mods.MagicBees.isModLoaded()), // Metal SLAG("slag", 0xD4D4D4, 0x58300B), diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java index 45a67068b2a..a8453a6a151 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry.bees; import gregtech.api.GTValues; +import gregtech.api.util.Mods; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -44,7 +45,7 @@ private void setResearchSuitability(@Nullable ISpeciesRoot speciesRoot) { public void registerModel(@NotNull Item item, @NotNull IModelManager manager) { manager.registerItemModel(item, 0); for (int i = 0; i < GTDropType.VALUES.length; i++) { - manager.registerItemModel(item, i, GTValues.MODID_FR, "gt.honey_drop"); + manager.registerItemModel(item, i, Mods.Names.FORESTRY, "gt.honey_drop"); } } diff --git a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java index 088c5ed7e73..e8f9a46d45e 100644 --- a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java +++ b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry.frames; import gregtech.api.GTValues; +import gregtech.api.util.Mods; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.Item; @@ -62,7 +63,7 @@ public IBeeModifier getBeeModifier() { @SuppressWarnings("deprecation") @Override public void registerModel(@NotNull Item item, @NotNull IModelManager manager) { - manager.registerItemModel(item, 0, GTValues.MODID_FR, "gt.frame_" + type.getName().toLowerCase()); + manager.registerItemModel(item, 0, Mods.Names.FORESTRY, "gt.frame_" + type.getName().toLowerCase()); } public ItemStack getItemStack() { diff --git a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java index 66df87dc408..a7661982176 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java @@ -12,8 +12,8 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.common.items.MetaItems; -import gregtech.integration.IntegrationUtil; import gregtech.integration.forestry.ForestryUtil; import gregtech.integration.forestry.bees.GTCombItem; import gregtech.integration.forestry.bees.GTCombType; @@ -21,7 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.Loader; import appeng.core.Api; import com.google.common.collect.ImmutableMap; @@ -98,8 +97,8 @@ public static void initGTCombs() { ModuleCore.getItems().refractoryWax.getItemStack() }, new int[] { 20 * 100, 50 * 100 }, Voltage.HV, 196); ItemStack wax = ModuleCore.getItems().beeswax.getItemStack(); - if (Loader.isModLoaded(GTValues.MODID_MB)) { - wax = IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 2); + if (Mods.MagicBees.isModLoaded()) { + wax = Mods.MagicBees.getItem("wax", 2); } addCentrifugeToItemStack(GTCombType.LAPOTRON, new ItemStack[] { OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax }, @@ -271,11 +270,10 @@ public static void initGTCombs() { .cleanroom(CleanroomType.CLEANROOM) .duration(3000).EUt(Voltage.UV.getChemicalEnergy()).buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_MB)) { + if (Mods.MagicBees.isModLoaded()) { addProcessGT(GTCombType.SPARKLING, new Material[] { Materials.NetherStar }, Voltage.EV); addCentrifugeToItemStack(GTCombType.SPARKLING, - new ItemStack[] { IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), - IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), + new ItemStack[] { Mods.MagicBees.getItem("wax", 0), Mods.MagicBees.getItem("resource", 5), OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar) }, new int[] { 50 * 100, 10 * 100, 10 * 100 }, Voltage.EV); } @@ -290,7 +288,7 @@ public static void initGTCombs() { addExtractorProcess(GTCombType.HYDROGEN, Materials.Hydrogen.getFluid(500), Voltage.MV, 100); addExtractorProcess(GTCombType.FLUORINE, Materials.Fluorine.getFluid(250), Voltage.MV, 128); - if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + if (Mods.AppliedEnergistics2.isModLoaded()) { ItemStack fluixDust = OreDictUnifier.get("dustFluix"); if (fluixDust == ItemStack.EMPTY) { fluixDust = Api.INSTANCE.definitions().materials().fluixDust().maybeStack(1).orElse(ItemStack.EMPTY); diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java index 171f575bc32..72014ca62c6 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java @@ -1,14 +1,13 @@ package gregtech.integration.forestry.recipes; -import gregtech.api.GTValues; import gregtech.api.unification.stack.UnificationEntry; +import gregtech.api.util.Mods; import gregtech.integration.forestry.ForestryModule; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.Loader; import forestry.api.recipes.RecipeManagers; import forestry.core.ModuleCore; @@ -137,7 +136,7 @@ public static void addGregTechMachineRecipes() { .output(ForestryModule.ELECTRODE_GOLD, 2) .buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Mods.IndustrialCraft2.isModLoaded() || Mods.BinnieCore.isModLoaded()) { CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) .input(ForestryModule.ELECTRODE_IRON) .fluidInputs(Glass.getFluid(100)) @@ -176,7 +175,7 @@ public static void addGregTechMachineRecipes() { .output(ForestryModule.ELECTRODE_OBSIDIAN, 4) .buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_XU2)) { + if (Mods.ExtraUtilities2.isModLoaded()) { CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) .input(ForestryModule.ELECTRODE_ORCHID) .fluidInputs(Glass.getFluid(100)) @@ -191,8 +190,7 @@ public static void addGregTechMachineRecipes() { } // todo mixin forestry to allow this tube always, since we have rubber (once mixin port is done) - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || - Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Mods.IndustrialCraft2.isModLoaded() || Mods.TechReborn.isModLoaded() || Mods.BinnieCore.isModLoaded()) { CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) .input(ForestryModule.ELECTRODE_RUBBER) .fluidInputs(Glass.getFluid(100)) @@ -248,7 +246,7 @@ private static void addForestryMachineRecipes() { '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), 'X', new UnificationEntry(plate, Bronze).toString()); - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Mods.IndustrialCraft2.isModLoaded() || Mods.BinnieCore.isModLoaded()) { addFabricatorRecipe(EnumElectronTube.IRON, "SXS", "#X#", "XXX", 'S', new UnificationEntry(screw, Iron).toString(), @@ -301,7 +299,7 @@ private static void addForestryMachineRecipes() { '#', new UnificationEntry(plate, EnderEye).toString(), 'X', new ItemStack(Blocks.END_STONE)); - if (Loader.isModLoaded(GTValues.MODID_XU2)) { + if (Mods.ExtraUtilities2.isModLoaded()) { addFabricatorRecipe(EnumElectronTube.ORCHID, " X ", "#X#", "XXX", '#', new ItemStack(Items.REPEATER), diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java index 5a57da584cc..e1face8fe9e 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java @@ -1,16 +1,14 @@ package gregtech.integration.forestry.recipes; -import gregtech.api.GTValues; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; -import gregtech.integration.IntegrationUtil; +import gregtech.api.util.Mods; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.Loader; import forestry.core.fluids.Fluids; @@ -18,171 +16,107 @@ public class ForestryExtractorRecipes { public static void init() { // Commonly used items - ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); - ItemStack propolis = IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0); + ItemStack mulch = Mods.Forestry.getItem("mulch"); + ItemStack propolis = Mods.Forestry.getItem("propolis"); // Vanilla Fruit Juice items addFruitJuiceRecipe(new ItemStack(Items.CARROT), 200, GTUtility.copy(mulch), 2000); addFruitJuiceRecipe(new ItemStack(Items.APPLE), 200, GTUtility.copy(mulch), 2000); // Forestry fruits - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 0), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 1), 180, GTUtility.copy(mulch), 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 2), 220, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), - 6000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), - 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), - 1000); + addSeedOilRecipe(Mods.Forestry.getItem("fruits", 0), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.Forestry.getItem("fruits", 1), 180, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.Forestry.getItem("fruits", 2), 220, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(Mods.Forestry.getItem("fruits", 3), 400, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.Forestry.getItem("fruits", 4), 100, GTUtility.copy(mulch), 6000); + addFruitJuiceRecipe(Mods.Forestry.getItem("fruits", 5), 50, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(Mods.Forestry.getItem("fruits", 6), 600, GTUtility.copy(mulch), 1000); // Honey, Honeydew - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), - 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honeydew", 0), 100); + addHoneyRecipe(Mods.Forestry.getItem("honey_drop"), 100, GTUtility.copy(propolis), 0); + addHoneyRecipe(Mods.Forestry.getItem("honeydew"), 100); - if (Loader.isModLoaded(GTValues.MODID_EB)) { + if (Mods.ExtraBees.isModLoaded()) { // Propolis - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), - Materials.Water.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), - Materials.Oil.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), - Materials.Creosote.getFluid(500)); + addExtractorRecipe(Mods.ExtraBees.getItem("propolis", 0), Materials.Water.getFluid(500)); + addExtractorRecipe(Mods.ExtraBees.getItem("propolis", 1), Materials.Oil.getFluid(500)); + addExtractorRecipe(Mods.ExtraBees.getItem("propolis", 2), Materials.Creosote.getFluid(500)); // Drops - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 3), 200); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), - Fluids.MILK.getFluid(200)); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, - IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, - new ItemStack(Items.DYE, 1, 14), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, - new ItemStack(Items.DYE, 1, 6), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, - new ItemStack(Items.DYE, 1, 5), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, - new ItemStack(Items.DYE, 1, 8), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, - new ItemStack(Items.DYE, 1, 12), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, - new ItemStack(Items.DYE, 1, 9), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, - new ItemStack(Items.DYE, 1, 10), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, - new ItemStack(Items.DYE, 1, 13), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, - new ItemStack(Items.DYE, 1, 7), 0); + addFruitJuiceRecipe(Mods.ExtraBees.getItem("honey_drop", 3), 200); + addExtractorRecipe(Mods.ExtraBees.getItem("honey_drop", 6), Fluids.MILK.getFluid(200)); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 13), 200, Mods.ExtraBees.getItem("misc", 19), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 14), 200, Mods.ExtraBees.getItem("misc", 20), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 15), 200, Mods.ExtraBees.getItem("misc", 21), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 16), 200, Mods.ExtraBees.getItem("misc", 22), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 17), 200, Mods.ExtraBees.getItem("misc", 24), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 18), 200, Mods.ExtraBees.getItem("misc", 23), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 19), 200, Mods.ExtraBees.getItem("misc", 25), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 20), 200, new ItemStack(Items.DYE, 1, 14), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 21), 200, new ItemStack(Items.DYE, 1, 6), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 22), 200, new ItemStack(Items.DYE, 1, 5), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 23), 200, new ItemStack(Items.DYE, 1, 8), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 24), 200, new ItemStack(Items.DYE, 1, 12), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 25), 200, new ItemStack(Items.DYE, 1, 9), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 26), 200, new ItemStack(Items.DYE, 1, 10), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 27), 200, new ItemStack(Items.DYE, 1, 13), 0); + addHoneyRecipe(Mods.ExtraBees.getItem("honey_drop", 28), 200, new ItemStack(Items.DYE, 1, 7), 0); } - if (Loader.isModLoaded(GTValues.MODID_ET)) { + if (Mods.ExtraTrees.isModLoaded()) { // Fruits - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), - 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), - 1000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), - 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), - 6000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), - 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), - 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), - 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), - 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), - 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), - 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), - 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), - 1000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), - 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), - 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), - 400); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), - 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), - 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), - 4000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), - 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), - 1500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), - 500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), - 2500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), - 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), - 1500); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), - 1000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), - 1000); - addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), - 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), - 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), - 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 0), 150, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 1), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 2), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 3), 300, GTUtility.copy(mulch), 1000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 4), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 5), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 6), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 7), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 8), 100, GTUtility.copy(mulch), 6000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 9), 80, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 10), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 11), 500, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 12), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 13), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 14), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 15), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 16), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 17), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 18), 400, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 19), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 20), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 21), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 22), 300, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 23), 200, GTUtility.copy(mulch), 1000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 24), 150, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 25), 180, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 26), 100, GTUtility.copy(mulch), 400); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 27), 50, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 28), 100, GTUtility.copy(mulch), 3000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 29), 100, GTUtility.copy(mulch), 3000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 30), 100, GTUtility.copy(mulch), 4000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 31), 20, GTUtility.copy(mulch), 200); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 32), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 33), 50, GTUtility.copy(mulch), 300); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 34), 100, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 35), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 36), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 37), 20, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 38), 300, GTUtility.copy(mulch), 1500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 39), 25, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 46), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 50), 300, GTUtility.copy(mulch), 2500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 51), 150, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 52), 300, GTUtility.copy(mulch), 1500); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 53), 50, GTUtility.copy(mulch), 1000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 54), 50, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 55), 100, GTUtility.copy(mulch), 1000); + addSeedOilRecipe(Mods.ExtraTrees.getItem("food", 56), 100, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 57), 400, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 58), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(Mods.ExtraTrees.getItem("food", 59), 50, GTUtility.copy(mulch), 1000); } } diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java index 5f4f214c294..85239b0a1a5 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java @@ -6,8 +6,8 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.common.items.MetaItems; -import gregtech.integration.IntegrationUtil; import gregtech.integration.forestry.ForestryConfig; import gregtech.integration.forestry.ForestryUtil; import gregtech.integration.forestry.bees.GTDropType; @@ -15,7 +15,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Loader; import forestry.api.recipes.RecipeManagers; import forestry.apiculture.ModuleApiculture; @@ -28,7 +27,7 @@ public class ForestryMiscRecipes { public static void init() { - if (ForestryConfig.enableGTBees) { + if (ForestryConfig.enableGTBees && Mods.ForestryApiculture.isModLoaded()) { // Oil Drop ItemStack dropStack = ForestryUtil.getDropStack(GTDropType.OIL); RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() @@ -45,8 +44,8 @@ public static void init() { // Biomass Drop dropStack = ForestryUtil.getDropStack(GTDropType.BIOMASS); ItemStack propolisStack = ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1); - if (Loader.isModLoaded(GTValues.MODID_EB)) { - propolisStack = IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 7); + if (Mods.ExtraBees.isModLoaded()) { + propolisStack = Mods.ExtraBees.getItem("propolis", 7); } RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() .inputs(dropStack) @@ -202,7 +201,7 @@ public static void init() { } // Fertilizer - ItemStack fertilizer = IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_compound", 0); + ItemStack fertilizer = Mods.Forestry.getItem("fertilizer_compound"); RecipeMaps.MIXER_RECIPES.recipeBuilder() .input("sand", 2) .input(OrePrefix.dust, Materials.Apatite) @@ -224,8 +223,8 @@ public static void init() { .outputs(GTUtility.copy(30, fertilizer)) .duration(100).EUt(16).buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_MB)) { - ItemStack concentratedCompound = IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 2); + if (Mods.MagicBees.isModLoaded()) { + ItemStack concentratedCompound = Mods.MagicBees.getItem("resource", 2); RecipeMaps.MIXER_RECIPES.recipeBuilder() .input("sand", 2) .inputs(GTUtility.copy(concentratedCompound)) @@ -249,7 +248,7 @@ public static void init() { } // Compost - ItemStack compost = IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_bio", 0); + ItemStack compost = Mods.Forestry.getItem("fertilizer_bio"); RecipeMaps.MIXER_RECIPES.recipeBuilder() .input(Blocks.DIRT, 1, true) .input(Items.WHEAT, 4) @@ -279,19 +278,19 @@ public static void init() { // Phosphor RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "phosphor", 0)) + .inputs(Mods.Forestry.getItem("phosphor")) .chancedOutput(OrePrefix.dust, Materials.Phosphorus, 1000, 0) .fluidOutputs(Materials.Lava.getFluid(800)) .duration(256).EUt(GTValues.VA[GTValues.MV]).buildAndRegister(); // Ice Shard RecipeMaps.MACERATOR_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "crafting_material", 5)) + .inputs(Mods.Forestry.getItem("crafting_material", 5)) .output(OrePrefix.dust, Materials.Ice) .duration(16).EUt(4).buildAndRegister(); // Mulch - ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); + ItemStack mulch = Mods.Forestry.getItem("mulch"); RecipeMaps.CHEMICAL_BATH_RECIPES.recipeBuilder() .input(MetaItems.BIO_CHAFF) .fluidInputs(Materials.Water.getFluid(750)) @@ -300,9 +299,9 @@ public static void init() { .chancedOutput(GTUtility.copy(4, mulch), 2000, 0) .duration(500).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_ET)) { + if (Mods.ExtraTrees.isModLoaded()) { RecipeMaps.MIXER_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_ET, "misc", 1)) + .inputs(Mods.ExtraTrees.getItem("misc", 1)) .fluidInputs(Materials.Water.getFluid(500)) .outputs(GTUtility.copy(mulch)) .duration(600).EUt(2).buildAndRegister(); @@ -328,7 +327,7 @@ public static void init() { .duration(900).EUt(10).buildAndRegister(); // Humus - ItemStack humus = IntegrationUtil.getModItem(GTValues.MODID_FR, "humus", 0); + ItemStack humus = Mods.Forestry.getItem("humus"); RecipeMaps.MIXER_RECIPES.recipeBuilder() .inputs(GTUtility.copy(2, mulch)) .input(Blocks.DIRT, 2, true) @@ -362,35 +361,35 @@ public static void init() { .input(OrePrefix.plate, Materials.Tin, 2) .input(Blocks.GLASS_PANE) .circuitMeta(1) - .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "can", 0)) + .outputs(Mods.Forestry.getItem("can")) .duration(120).EUt(7).buildAndRegister(); RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "beeswax", 0)) + .inputs(Mods.Forestry.getItem("beeswax")) .notConsumable(MetaItems.SHAPE_EXTRUDER_CELL) - .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "capsule", 0)) + .outputs(Mods.Forestry.getItem("capsule")) .duration(64).EUt(16).buildAndRegister(); RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "refractory_wax", 0)) + .inputs(Mods.Forestry.getItem("refractory_wax")) .notConsumable(MetaItems.SHAPE_EXTRUDER_CELL) - .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "refractory", 0)) + .outputs(Mods.Forestry.getItem("refractory")) .duration(128).EUt(16).buildAndRegister(); // Propolis RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() - .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0)) + .inputs(Mods.Forestry.getItem("propolis")) .output(MetaItems.STICKY_RESIN) .duration(128).EUt(5).buildAndRegister(); - if (Loader.isModLoaded(GTValues.MODID_GENETICS)) { + if (Mods.Genetics.isModLoaded()) { // DNA Dye RecipeMaps.MIXER_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.Glowstone) .input("dyePurple") .input("dyeBlue") - .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 1, 8)) + .outputs(Mods.Genetics.getItem("misc", 1, 8)) .duration(100).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); // Fluorescent Dye @@ -398,14 +397,14 @@ public static void init() { .input(OrePrefix.dust, Materials.Glowstone) .input("dyeOrange") .input("dyeYellow") - .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 2, 2)) + .outputs(Mods.Genetics.getItem("misc", 2, 2)) .duration(100).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); // Growth Medium RecipeMaps.MIXER_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.Sugar) .input(OrePrefix.dust, Materials.Bone) - .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 4, 2)) + .outputs(Mods.Genetics.getItem("misc", 4, 2)) .duration(400).EUt(16).buildAndRegister(); } @@ -413,7 +412,7 @@ public static void init() { RecipeMaps.FLUID_SOLIDFICATION_RECIPES.recipeBuilder() .notConsumable(MetaItems.SHAPE_MOLD_NUGGET) .fluidInputs(Fluids.FOR_HONEY.getFluid(200)) - .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0)) + .outputs(Mods.Forestry.getItem("honey_drop")) .duration(400).EUt(7).buildAndRegister(); RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() @@ -425,7 +424,7 @@ public static void init() { public static void initRemoval() { ModHandler.removeRecipeByName("forestry:sand_to_fertilizer"); ModHandler.removeRecipeByName("forestry:ash_to_fertilizer"); - if (Loader.isModLoaded(GTValues.MODID_MB)) { + if (Mods.MagicBees.isModLoaded()) { ModHandler.removeRecipeByName("magicbees:fertilizer1"); ModHandler.removeRecipeByName("magicbees:fertilizer2"); ModHandler.removeRecipeByName("magicbees:fertilizer3"); @@ -437,7 +436,7 @@ public static void initRemoval() { ModHandler.removeRecipeByName("forestry:tin_can"); ModHandler.removeRecipeByName("forestry:wax_capsule"); ModHandler.removeRecipeByName("forestry:refractory_capsule"); - if (Loader.isModLoaded(GTValues.MODID_GENETICS)) { + if (Mods.Genetics.isModLoaded()) { ModHandler.removeRecipeByName("genetics:dna_dye_from_glowstone"); ModHandler.removeRecipeByName("genetics:dna_dye"); ModHandler.removeRecipeByName("genetics:fluorescent_dye"); diff --git a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java index 221fadaa6f6..6eed93239d8 100644 --- a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java +++ b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java @@ -1,8 +1,8 @@ package gregtech.integration.forestry.tools; -import gregtech.api.GTValues; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; +import gregtech.api.util.Mods; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; @@ -13,7 +13,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; -import net.minecraftforge.fml.common.Loader; import forestry.api.lepidopterology.EnumFlutterType; import forestry.api.lepidopterology.IAlleleButterflySpecies; @@ -32,7 +31,7 @@ private ScoopBehavior() {/**/} @Override public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, @NotNull EntityLivingBase attacker) { - if (!Loader.isModLoaded(GTValues.MODID_FR)) return; + if (!Mods.Forestry.isModLoaded()) return; if (!(target instanceof IEntityButterfly butterfly)) return; if (!(attacker instanceof EntityPlayer player)) return; if (attacker.world == null || attacker.world.isRemote) return; diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index adb308fe4e6..b6b603bb07e 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -10,6 +10,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.Mods; import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; import gregtech.common.blocks.MetaBlocks; @@ -46,13 +47,13 @@ import java.util.Objects; import java.util.function.Supplier; -@Optional.Interface(modid = GTValues.MODID_GROOVYSCRIPT, +@Optional.Interface(modid = Mods.Names.GROOVY_SCRIPT, iface = "com.cleanroommc.groovyscript.api.GroovyPlugin", striprefs = true) @GregTechModule( moduleID = GregTechModules.MODULE_GRS, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_GROOVYSCRIPT, + modDependencies = Mods.Names.GROOVY_SCRIPT, name = "GregTech GroovyScript Integration", description = "GroovyScript Integration Module") public class GroovyScriptModule extends IntegrationSubmodule implements GroovyPlugin { diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java index bce36365fc0..d26defcbde3 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; +import gregtech.api.util.Mods; import gregtech.integration.IntegrationSubmodule; import gregtech.integration.hwyla.provider.*; import gregtech.modules.GregTechModules; @@ -17,7 +18,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_HWYLA, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_HWYLA, + modDependencies = Mods.Names.HWYLA, name = "GregTech HWYLA Integration", description = "HWYLA (WAILA) Integration Module") public class HWYLAModule extends IntegrationSubmodule implements IWailaPlugin { diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index eec16a49641..491db7fb1f1 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -20,6 +20,7 @@ import gregtech.api.recipes.machines.RecipeMapFurnace; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; +import gregtech.api.util.Mods; import gregtech.api.worldgen.config.BedrockFluidDepositDefinition; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.config.WorldGenRegistry; @@ -85,7 +86,7 @@ @GregTechModule( moduleID = GregTechModules.MODULE_JEI, containerID = GTValues.MODID, - modDependencies = GTValues.MODID_JEI, + modDependencies = Mods.Names.JUST_ENOUGH_ITEMS, name = "GregTech JEI Integration", description = "JustEnoughItems Integration Module") public class JustEnoughItemsModule extends IntegrationSubmodule implements IModPlugin { diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java index 0f5bd90bf9f..75d8c11f81a 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java @@ -4,6 +4,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.util.FileUtility; import gregtech.api.util.GTUtility; +import gregtech.api.util.Mods; import gregtech.api.worldgen.config.FillerConfigUtils; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.filler.BlockFiller; @@ -26,7 +27,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.IFluidBlock; -import net.minecraftforge.fml.common.Loader; import com.google.common.collect.ImmutableList; import mezz.jei.api.ingredients.IIngredients; @@ -41,7 +41,6 @@ import java.util.function.Function; import static gregtech.api.GTValues.M; -import static gregtech.api.GTValues.MODID_CC; public class GTOreInfo implements IRecipeWrapper { @@ -64,7 +63,7 @@ public GTOreInfo(OreDepositDefinition definition) { // Don't default to vanilla Maximums and minimums if the values are not defined and Cubic Chunks is loaded // This could be improved to use the actual minimum and maximum heights, at the cost of including the CC Api - if (Loader.isModLoaded(MODID_CC)) { + if (Mods.CubicChunks.isModLoaded()) { this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? Integer.MAX_VALUE : definition.getMaximumHeight(); this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? Integer.MIN_VALUE : diff --git a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java index 77ee3c8bcb7..bc5042b0d64 100644 --- a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java +++ b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java @@ -1,6 +1,7 @@ package gregtech.integration.jei.utils; import gregtech.api.util.GTLog; +import gregtech.api.util.Mods; import gregtech.api.worldgen.config.OreDepositDefinition; import net.minecraft.client.Minecraft; @@ -10,7 +11,6 @@ import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fml.common.Loader; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -27,8 +27,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import static gregtech.api.GTValues.MODID_AR; - /** * Common util methods shared between {@link gregtech.integration.jei.basic.GTOreCategory} * and {@link gregtech.integration.jei.basic.GTFluidVeinCategory} @@ -139,7 +137,7 @@ public static int[] getAllRegisteredDimensions(@Nullable Predicate