diff options
Diffstat (limited to 'src/main/java/gregtech/api')
9 files changed, 50 insertions, 68 deletions
diff --git a/src/main/java/gregtech/api/GregTechAPI.java b/src/main/java/gregtech/api/GregTechAPI.java index e9cfe16237..c485c8e47e 100644 --- a/src/main/java/gregtech/api/GregTechAPI.java +++ b/src/main/java/gregtech/api/GregTechAPI.java @@ -56,7 +56,6 @@ import gregtech.api.threads.RunnableMachineUpdate; import gregtech.api.util.CircuitryBehavior; import gregtech.api.util.CoverBehavior; import gregtech.api.util.CoverBehaviorBase; -import gregtech.api.util.GTConfig; import gregtech.api.util.GTCreativeTab; import gregtech.api.util.GTLog; import gregtech.api.util.GTModHandler; @@ -221,10 +220,6 @@ public class GregTechAPI { */ @SideOnly(Side.CLIENT) public static IIconRegister sBlockIcons, sItemIcons; - /** - * The Configuration Objects - */ - public static GTConfig NEIClientFIle; public static int TICKS_FOR_LAG_AVERAGING = 25, MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = 100; /** diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 9ad86df256..cd3c376004 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -34,7 +34,7 @@ import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.objects.MaterialStack; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTUtility; -import gregtech.common.config.gregtech.ConfigHarvestLevel; +import gregtech.common.config.Gregtech; import gregtech.common.render.items.CosmicNeutroniumRenderer; import gregtech.common.render.items.GaiaSpiritRenderer; import gregtech.common.render.items.GeneratedMaterialRenderer; @@ -2670,9 +2670,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addHarvestLevels() { - GTMod.gregtechproxy.mChangeHarvestLevels = ConfigHarvestLevel.activateHarvestLevelChange; - GTMod.gregtechproxy.mMaxHarvestLevel = Math.min(15, ConfigHarvestLevel.maxHarvestLevel); - GTMod.gregtechproxy.mGraniteHavestLevel = ConfigHarvestLevel.graniteHarvestLevel; + GTMod.gregtechproxy.mChangeHarvestLevels = Gregtech.harvestLevel.activateHarvestLevelChange; + GTMod.gregtechproxy.mMaxHarvestLevel = Math.min(15, Gregtech.harvestLevel.maxHarvestLevel); + GTMod.gregtechproxy.mGraniteHavestLevel = Gregtech.harvestLevel.graniteHarvestLevel; } public static void initMaterialProperties() { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java index ddc0e28723..2613aa23c0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java @@ -64,7 +64,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.ISerializableObject; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; import gregtech.common.GTClient; -import gregtech.common.config.other.ConfigGeneral; +import gregtech.common.config.Other; import gregtech.common.covers.CoverDrain; import gregtech.common.covers.CoverFluidRegulator; import gregtech.common.covers.CoverInfo; @@ -504,7 +504,7 @@ public class MTEFluid extends MetaPipeEntity { boolean wasActionPerformed = false; - int limit = ConfigGeneral.pipeWrenchingChainRange; + int limit = Other.pipeWrenchingChainRange; for (int connected = 0; connected < limit; connected++) { TileEntity nextPipeBaseTile = currentPipeBase.getTileEntityAtSide(tSide); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 8cdcd6e18f..a6526ac6fa 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -96,7 +96,7 @@ import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.client.GTSoundLoop; import gregtech.common.Pollution; -import gregtech.common.config.machinestats.ConfigMachines; +import gregtech.common.config.MachineStats; import gregtech.common.gui.modularui.widget.CheckRecipeResultSyncer; import gregtech.common.gui.modularui.widget.ShutDownReasonSyncer; import gregtech.common.items.MetaGeneratedTool01; @@ -172,9 +172,9 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity public MTEMultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 2); this.processingLogic = null; - MTEMultiBlockBase.disableMaintenance = ConfigMachines.disableMaintenanceChecks; - this.damageFactorLow = ConfigMachines.damageFactorLow; - this.damageFactorHigh = ConfigMachines.damageFactorHigh; + MTEMultiBlockBase.disableMaintenance = MachineStats.machines.disableMaintenanceChecks; + this.damageFactorLow = MachineStats.machines.damageFactorLow; + this.damageFactorHigh = MachineStats.machines.damageFactorHigh; this.mNEI = ""; if (!shouldCheckMaintenance()) fixAllIssues(); } @@ -182,9 +182,9 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity public MTEMultiBlockBase(String aName) { super(aName, 2); this.processingLogic = createProcessingLogic(); - MTEMultiBlockBase.disableMaintenance = ConfigMachines.disableMaintenanceChecks; - this.damageFactorLow = ConfigMachines.damageFactorLow; - this.damageFactorHigh = ConfigMachines.damageFactorHigh; + MTEMultiBlockBase.disableMaintenance = MachineStats.machines.disableMaintenanceChecks; + this.damageFactorLow = MachineStats.machines.damageFactorLow; + this.damageFactorHigh = MachineStats.machines.damageFactorHigh; if (!shouldCheckMaintenance()) fixAllIssues(); } diff --git a/src/main/java/gregtech/api/recipe/RecipeCategories.java b/src/main/java/gregtech/api/recipe/RecipeCategories.java index 61eed8a8d7..3112fce705 100644 --- a/src/main/java/gregtech/api/recipe/RecipeCategories.java +++ b/src/main/java/gregtech/api/recipe/RecipeCategories.java @@ -3,69 +3,80 @@ package gregtech.api.recipe; import static gregtech.api.enums.Mods.GregTech; import static gregtech.api.recipe.RecipeCategory.createIcon; +import gregtech.api.enums.Mods; +import gregtech.common.config.Client; +import gtPlusPlus.api.recipe.GTPPRecipeMaps; + @SuppressWarnings("unused") public final class RecipeCategories { - @RecipeCategoryHolder public static final RecipeCategory arcFurnaceRecycling = new RecipeCategory( "gt.recipe.category.arc_furnace_recycling", RecipeMaps.arcFurnaceRecipes, + () -> Client.nei.recipeCategories.arcFurnaceRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "arc_furnace_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory plasmaArcFurnaceRecycling = new RecipeCategory( "gt.recipe.category.plasma_arc_furnace_recycling", RecipeMaps.plasmaArcFurnaceRecipes, + () -> Client.nei.recipeCategories.plasmaArcFurnaceRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "plasma_arc_furnace_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory maceratorRecycling = new RecipeCategory( "gt.recipe.category.macerator_recycling", RecipeMaps.maceratorRecipes, + () -> Client.nei.recipeCategories.maceratorRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "macerator_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory fluidExtractorRecycling = new RecipeCategory( "gt.recipe.category.fluid_extractor_recycling", RecipeMaps.fluidExtractionRecipes, + () -> Client.nei.recipeCategories.fluidExtractorRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "fluid_extractor_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory alloySmelterRecycling = new RecipeCategory( "gt.recipe.category.alloy_smelter_recycling", RecipeMaps.alloySmelterRecipes, + () -> Client.nei.recipeCategories.alloySmelterRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "alloy_smelter_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory alloySmelterMolding = new RecipeCategory( "gt.recipe.category.alloy_smelter_molding", RecipeMaps.alloySmelterRecipes, + () -> Client.nei.recipeCategories.alloySmelterMolding, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "alloy_smelter_molding.png")))); - @RecipeCategoryHolder public static final RecipeCategory forgeHammerRecycling = new RecipeCategory( "gt.recipe.category.forge_hammer_recycling", RecipeMaps.hammerRecipes, + () -> Client.nei.recipeCategories.forgeHammerRecycling, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "forge_hammer_recycling.png")))); - @RecipeCategoryHolder public static final RecipeCategory ticPartExtruding = new RecipeCategory( "gt.recipe.category.tic_part_extruding", RecipeMaps.extruderRecipes, + () -> Client.nei.recipeCategories.ticPartExtruding, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "tic_part_extruding.png")))); - @RecipeCategoryHolder public static final RecipeCategory ticBoltMolding = new RecipeCategory( "gt.recipe.category.tic_bolt_molding", RecipeMaps.fluidSolidifierRecipes, + () -> Client.nei.recipeCategories.ticBoltMolding, builder -> builder.setDisplayImage( createIcon(GregTech.getResourcePath("textures", "gui", "picture", "tic_bolt_molding.png")))); + + public static final RecipeCategory absNonAlloyRecipes = new RecipeCategory( + "gtpp.recipe.category.abs_non_alloy_recipes", + GTPPRecipeMaps.alloyBlastSmelterRecipes, + () -> Client.nei.recipeCategories.absNonAlloyRecipes, + builder -> builder.setDisplayImage( + createIcon(Mods.GTPlusPlus.getResourcePath("textures", "gui", "picture", "abs_non_alloy_recipes.png")))); } diff --git a/src/main/java/gregtech/api/recipe/RecipeCategory.java b/src/main/java/gregtech/api/recipe/RecipeCategory.java index 9f8674e939..a597400f17 100644 --- a/src/main/java/gregtech/api/recipe/RecipeCategory.java +++ b/src/main/java/gregtech/api/recipe/RecipeCategory.java @@ -2,6 +2,7 @@ package gregtech.api.recipe; import java.util.HashMap; import java.util.Map; +import java.util.function.Supplier; import java.util.function.UnaryOperator; import javax.annotation.Nullable; @@ -18,7 +19,8 @@ import gregtech.api.util.MethodsReturnNonnullByDefault; /** * Allows certain recipes to be displayed on different tabs on NEI. * <p> - * Also apply {@link RecipeCategoryHolder} annotation to each instance to be picked up by GT config. + * Each entry must be declared under {@link gregtech.api.recipe.RecipeCategories}, and config entry must be added to + * {@link gregtech.common.config.Client.NEI.RecipeCategories}. */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @@ -30,20 +32,24 @@ public final class RecipeCategory { public final String unlocalizedName; public final RecipeMap<?> recipeMap; public final ModContainer ownerMod; + public final Supplier<RecipeCategorySetting> settingSupplier; @Nullable public final UnaryOperator<HandlerInfo.Builder> handlerInfoCreator; /** * @param unlocalizedName Unlocalized name of this category. Must be unique. * @param recipeMap RecipeMap this category belongs to. + * @param settingSupplier Supplier for the setting whether to enable this category. * @param handlerInfoCreator Supplier of handler info for the NEI handler this category belongs to. */ public RecipeCategory(String unlocalizedName, RecipeMap<?> recipeMap, + Supplier<RecipeCategorySetting> settingSupplier, @Nullable UnaryOperator<HandlerInfo.Builder> handlerInfoCreator) { this.unlocalizedName = unlocalizedName; this.recipeMap = recipeMap; this.ownerMod = Loader.instance() .activeModContainer(); + this.settingSupplier = settingSupplier; this.handlerInfoCreator = handlerInfoCreator; if (ALL_RECIPE_CATEGORIES.containsKey(unlocalizedName)) { throw new IllegalArgumentException( @@ -53,7 +59,11 @@ public final class RecipeCategory { } RecipeCategory(RecipeMap<?> recipeMap) { - this(recipeMap.unlocalizedName, recipeMap, recipeMap.getFrontend().neiProperties.handlerInfoCreator); + this( + recipeMap.unlocalizedName, + recipeMap, + RecipeCategorySetting::getDefault, + recipeMap.getFrontend().neiProperties.handlerInfoCreator); } @Override diff --git a/src/main/java/gregtech/api/recipe/RecipeCategoryHolder.java b/src/main/java/gregtech/api/recipe/RecipeCategoryHolder.java deleted file mode 100644 index 0ad87e3f6f..0000000000 --- a/src/main/java/gregtech/api/recipe/RecipeCategoryHolder.java +++ /dev/null @@ -1,13 +0,0 @@ -package gregtech.api.recipe; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Apply this annotation to each recipe category so that GT config will pick it up. - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface RecipeCategoryHolder {} diff --git a/src/main/java/gregtech/api/recipe/RecipeCategorySetting.java b/src/main/java/gregtech/api/recipe/RecipeCategorySetting.java index 4920d64212..0f1c5b3814 100644 --- a/src/main/java/gregtech/api/recipe/RecipeCategorySetting.java +++ b/src/main/java/gregtech/api/recipe/RecipeCategorySetting.java @@ -1,8 +1,5 @@ package gregtech.api.recipe; -import java.util.Locale; -import java.util.stream.Stream; - import javax.annotation.ParametersAreNonnullByDefault; import gregtech.api.util.MethodsReturnNonnullByDefault; @@ -28,25 +25,8 @@ public enum RecipeCategorySetting { HIDE; public static final RecipeCategorySetting[] VALUES = values(); - public static final String[] NAMES = Stream.of(VALUES) - .map(RecipeCategorySetting::toName) - .toArray(String[]::new); public static RecipeCategorySetting getDefault() { return ENABLE; } - - public String toName() { - return toString().toLowerCase(Locale.ENGLISH); - } - - public static RecipeCategorySetting find(String name) { - for (RecipeCategorySetting setting : VALUES) { - if (setting.toName() - .equals(name)) { - return setting; - } - } - return getDefault(); - } } diff --git a/src/main/java/gregtech/api/util/GTClientPreference.java b/src/main/java/gregtech/api/util/GTClientPreference.java index f265094ca3..64bca8d47d 100644 --- a/src/main/java/gregtech/api/util/GTClientPreference.java +++ b/src/main/java/gregtech/api/util/GTClientPreference.java @@ -1,7 +1,6 @@ package gregtech.api.util; -import gregtech.common.config.client.ConfigPreference; -import gregtech.common.config.client.ConfigWaila; +import gregtech.common.config.Client; public class GTClientPreference { @@ -19,10 +18,10 @@ public class GTClientPreference { } public GTClientPreference() { - this.mSingleBlockInitialFilter = ConfigPreference.singleBlockInitialFilter; - this.mSingleBlockInitialMultiStack = ConfigPreference.singleBlockInitialAllowMultiStack; - this.mInputBusInitialFilter = ConfigPreference.inputBusInitialFilter; - this.wailaAverageNS = ConfigWaila.wailaAverageNS; + this.mSingleBlockInitialFilter = Client.preference.singleBlockInitialFilter; + this.mSingleBlockInitialMultiStack = Client.preference.singleBlockInitialAllowMultiStack; + this.mInputBusInitialFilter = Client.preference.inputBusInitialFilter; + this.wailaAverageNS = Client.waila.wailaAverageNS; } public boolean isSingleBlockInitialFilterEnabled() { |