diff --git a/src/main/java/vazkii/botania/api/recipe/RecipeManaInfusion.java b/src/main/java/vazkii/botania/api/recipe/RecipeManaInfusion.java index caf26e3a0..3e20bf558 100644 --- a/src/main/java/vazkii/botania/api/recipe/RecipeManaInfusion.java +++ b/src/main/java/vazkii/botania/api/recipe/RecipeManaInfusion.java @@ -44,7 +44,7 @@ public class RecipeManaInfusion { catalystState = catalyst; } - public Object getInput() { + public Ingredient getInput() { return input; } diff --git a/src/main/java/vazkii/botania/client/core/handler/BaubleRenderHandler.java b/src/main/java/vazkii/botania/client/core/handler/BaubleRenderHandler.java index 7e967f2b8..b215bb40b 100644 --- a/src/main/java/vazkii/botania/client/core/handler/BaubleRenderHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/BaubleRenderHandler.java @@ -38,7 +38,7 @@ public final class BaubleRenderHandler implements LayerRenderer { @Override public void render(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null) + if(!ConfigHandler.CLIENT.renderBaubles.get() || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null) return; // todo 1.13 diff --git a/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java b/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java index c92e54fe9..88ed304f1 100644 --- a/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java @@ -47,7 +47,7 @@ public final class DebugHandler { @SubscribeEvent public static void onDrawDebugText(RenderGameOverlayEvent.Text event) { World world = Minecraft.getInstance().world; - if(ConfigHandler.debugInfo && Minecraft.getInstance().gameSettings.showDebugInfo) { + if(ConfigHandler.CLIENT.debugInfo.get() && Minecraft.getInstance().gameSettings.showDebugInfo) { event.getLeft().add(""); String version = LibMisc.VERSION; if(version.contains("GRADLE")) @@ -67,15 +67,15 @@ public final class DebugHandler { if(GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()) { event.getLeft().add(PREFIX + "Config Context"); - event.getLeft().add(" shaders.enabled: " + ConfigHandler.useShaders); - event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.glSecondaryTextureUnit); + event.getLeft().add(" shaders.enabled: " + ConfigHandler.CLIENT.useShaders.get()); + event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.CLIENT.glSecondaryTextureUnit.get()); GLCapabilities caps = GL.getCapabilities(); event.getLeft().add(PREFIX + "OpenGL Context"); event.getLeft().add(" GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION)); event.getLeft().add(" GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER)); event.getLeft().add(" GL_SHADING_LANGUAGE_VERSION: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); - event.getLeft().add(" GL_MAX_TEXTURE_IMAGE_UNITS_ARB: " + GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB)); + event.getLeft().add(" GL_MAX_TEXTURE_IMAGE_UNITS_ARB: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS_ARB)); event.getLeft().add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture); event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two); event.getLeft().add(" OpenGL13: " + caps.OpenGL13); diff --git a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java index e3a418a3a..4cf836e6f 100644 --- a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java @@ -287,7 +287,7 @@ public final class HUDHandler { Minecraft mc = Minecraft.getInstance(); int width = 182; int x = mc.mainWindow.getScaledWidth() / 2 - width / 2; - int y = mc.mainWindow.getScaledHeight() - ConfigHandler.manaBarHeight; + int y = mc.mainWindow.getScaledHeight() - ConfigHandler.CLIENT.manaBarHeight.get(); if(!hasCreative) { if(totalMaxMana == 0) @@ -401,7 +401,7 @@ public final class HUDHandler { } } - if(!ConfigHandler.lexicaOfflineMode && !draw && pos.entity == null) { + if(!ConfigHandler.CLIENT.lexicaOfflineMode.get() && !draw && pos.entity == null) { profiler.startSection("wikiLookup"); if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof BlockLiquid)) { IWikiProvider provider = WikiHooks.getWikiFor(block); diff --git a/src/main/java/vazkii/botania/client/core/handler/RenderLexicon.java b/src/main/java/vazkii/botania/client/core/handler/RenderLexicon.java index 4010e4fc5..30b1978b3 100644 --- a/src/main/java/vazkii/botania/client/core/handler/RenderLexicon.java +++ b/src/main/java/vazkii/botania/client/core/handler/RenderLexicon.java @@ -42,12 +42,12 @@ public class RenderLexicon { "\"Vazkii did a thing.\" - cpw" }; - static int quote = -1; + private static int quote = -1; @SubscribeEvent public static void renderItem(RenderSpecificHandEvent evt) { Minecraft mc = Minecraft.getInstance(); - if(!ConfigHandler.lexicon3dModel + if(!ConfigHandler.CLIENT.lexicon3dModel.get() || mc.gameSettings.thirdPersonView != 0 || mc.player.getHeldItem(evt.getHand()).isEmpty() || mc.player.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon) diff --git a/src/main/java/vazkii/botania/client/core/handler/TooltipAdditionDisplayHandler.java b/src/main/java/vazkii/botania/client/core/handler/TooltipAdditionDisplayHandler.java index d41ec8c30..ec677c7bc 100644 --- a/src/main/java/vazkii/botania/client/core/handler/TooltipAdditionDisplayHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/TooltipAdditionDisplayHandler.java @@ -84,7 +84,7 @@ public final class TooltipAdditionDisplayHandler { Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000); Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000); - if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) { + if(ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) { lexiconLookupTime += ClientTickHandler.delta; int cx = x + 8; @@ -134,7 +134,7 @@ public final class TooltipAdditionDisplayHandler { GlStateManager.scalef(0.5F, 0.5F, 1F); boolean mac = Minecraft.IS_RUNNING_ON_MAC; - mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF); + mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF); GlStateManager.scalef(2F, 2F, 1F); diff --git a/src/main/java/vazkii/botania/client/core/helper/ShaderHelper.java b/src/main/java/vazkii/botania/client/core/helper/ShaderHelper.java index 5cfa284d6..0f22034c1 100644 --- a/src/main/java/vazkii/botania/client/core/helper/ShaderHelper.java +++ b/src/main/java/vazkii/botania/client/core/helper/ShaderHelper.java @@ -124,7 +124,7 @@ public final class ShaderHelper { } public static boolean useShaders() { - return ConfigHandler.useShaders && OpenGlHelper.shadersSupported && checkIncompatibleMods(); + return ConfigHandler.CLIENT.useShaders.get() && OpenGlHelper.shadersSupported && checkIncompatibleMods(); } private static boolean checkIncompatibleMods() { diff --git a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java index 2c7f7f63a..abf12b978 100644 --- a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java @@ -160,13 +160,10 @@ public class ClientProxy implements IProxy { ModChallenges.init(); - if(ConfigHandler.boundBlockWireframe) + if(ConfigHandler.CLIENT.boundBlockWireframe.get()) MinecraftForge.EVENT_BUS.register(BoundTileRenderer.class); - if(ConfigHandler.useAdaptativeConfig) - MinecraftForge.EVENT_BUS.register(AdaptorNotifier.class); - - if(ConfigHandler.enableSeasonalFeatures) { + if(ConfigHandler.CLIENT.enableSeasonalFeatures.get()) { LocalDateTime now = LocalDateTime.now(); if (now.getMonth() == Month.DECEMBER && now.getDayOfMonth() >= 16 || now.getMonth() == Month.JANUARY && now.getDayOfMonth() <= 2) jingleTheBells = true; @@ -350,7 +347,7 @@ public class ClientProxy implements IProxy { if(Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) return false; - if(!ConfigHandler.useVanillaParticleLimiter) + if(!ConfigHandler.CLIENT.useVanillaParticleLimiter.get()) return true; float chance = 1F; diff --git a/src/main/java/vazkii/botania/client/fx/FXSparkle.java b/src/main/java/vazkii/botania/client/fx/FXSparkle.java index cb16407fb..49be82f39 100644 --- a/src/main/java/vazkii/botania/client/fx/FXSparkle.java +++ b/src/main/java/vazkii/botania/client/fx/FXSparkle.java @@ -68,7 +68,7 @@ public class FXSparkle extends Particle { ParticleRenderDispatcher.fakeSparkleFxCount = 0; GlStateManager.color4f(1.0F, 1.0F, 1.0F, 0.75F); - Minecraft.getInstance().textureManager.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles); + Minecraft.getInstance().textureManager.bindTexture(ConfigHandler.CLIENT.matrixMode.get() ? vanillaParticles : particles); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); for(FXSparkle sparkle : queuedRenders) diff --git a/src/main/java/vazkii/botania/client/fx/FXWisp.java b/src/main/java/vazkii/botania/client/fx/FXWisp.java index 593f9976a..f4b947082 100644 --- a/src/main/java/vazkii/botania/client/fx/FXWisp.java +++ b/src/main/java/vazkii/botania/client/fx/FXWisp.java @@ -78,7 +78,7 @@ public class FXWisp extends Particle { ParticleRenderDispatcher.depthIgnoringWispFxCount = 0; GlStateManager.color4f(1.0F, 1.0F, 1.0F, 0.75F); - Minecraft.getInstance().textureManager.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles); + Minecraft.getInstance().textureManager.bindTexture(ConfigHandler.CLIENT.matrixMode.get() ? vanillaParticles : particles); if(!queuedRenders.isEmpty()) { tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); diff --git a/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonCategory.java b/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonCategory.java index 82bf90cb8..e26ade613 100644 --- a/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonCategory.java +++ b/src/main/java/vazkii/botania/client/gui/lexicon/button/GuiButtonCategory.java @@ -55,13 +55,13 @@ public class GuiButtonCategory extends GuiButtonLexicon { GL11.glBindTexture(GL11.GL_TEXTURE_2D, r.getTexture(resource).getGlTextureId()); ARBShaderObjects.glUniform1iARB(imageUniform, 0); - OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit); + OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.CLIENT.glSecondaryTextureUnit.get()); GlStateManager.enableTexture2D(); GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, r.getTexture(stencilResource).getGlTextureId()); - ARBShaderObjects.glUniform1iARB(maskUniform, ConfigHandler.glSecondaryTextureUnit); + ARBShaderObjects.glUniform1iARB(maskUniform, ConfigHandler.CLIENT.glSecondaryTextureUnit.get()); ARBShaderObjects.glUniform1fARB(heightMatchUniform, heightMatch); }; diff --git a/src/main/java/vazkii/botania/client/model/LexiconModel.java b/src/main/java/vazkii/botania/client/model/LexiconModel.java index 6539dbbad..0d213a53d 100644 --- a/src/main/java/vazkii/botania/client/model/LexiconModel.java +++ b/src/main/java/vazkii/botania/client/model/LexiconModel.java @@ -30,7 +30,7 @@ public class LexiconModel implements IBakedModel { public Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { if((cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND || cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND) - && ConfigHandler.lexicon3dModel) + && ConfigHandler.CLIENT.lexicon3dModel.get()) return Pair.of(this, null); IBakedModel original = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path2D); return original.handlePerspective(cameraTransformType); diff --git a/src/main/java/vazkii/botania/client/render/tile/RenderTileFloatingFlower.java b/src/main/java/vazkii/botania/client/render/tile/RenderTileFloatingFlower.java index de27ab405..1b9b64515 100644 --- a/src/main/java/vazkii/botania/client/render/tile/RenderTileFloatingFlower.java +++ b/src/main/java/vazkii/botania/client/render/tile/RenderTileFloatingFlower.java @@ -29,7 +29,7 @@ public class RenderTileFloatingFlower extends TileEntityRenderer { @Override public void render(@Nonnull TileEntity tile, double d0, double d1, double d2, float t, int digProgress) { - if(ConfigHandler.staticFloaters) + if(ConfigHandler.CLIENT.staticFloaters.get()) return; if (tile != null) diff --git a/src/main/java/vazkii/botania/client/render/world/SkyblockRenderEvents.java b/src/main/java/vazkii/botania/client/render/world/SkyblockRenderEvents.java index 4e7d2c6f8..efde1306f 100644 --- a/src/main/java/vazkii/botania/client/render/world/SkyblockRenderEvents.java +++ b/src/main/java/vazkii/botania/client/render/world/SkyblockRenderEvents.java @@ -27,7 +27,7 @@ public final class SkyblockRenderEvents { @SubscribeEvent public static void onRender(RenderWorldLastEvent event) { World world = Minecraft.getInstance().world; - if(ConfigHandler.enableFancySkybox && world.getDimension().getType() == DimensionType.OVERWORLD && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getInstance().world))) { + if(ConfigHandler.CLIENT.enableFancySkybox.get() && world.getDimension().getType() == DimensionType.OVERWORLD && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getInstance().world))) { if(!(world.getDimension().getSkyRenderer() instanceof SkyblockSkyRenderer)) world.getDimension().setSkyRenderer(new SkyblockSkyRenderer()); } diff --git a/src/main/java/vazkii/botania/common/Botania.java b/src/main/java/vazkii/botania/common/Botania.java index 4cadaa46e..80291d260 100644 --- a/src/main/java/vazkii/botania/common/Botania.java +++ b/src/main/java/vazkii/botania/common/Botania.java @@ -24,7 +24,9 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.DeferredWorkQueue; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; @@ -115,6 +117,8 @@ public class Botania { proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new); proxy.registerHandlers(); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); + ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigHandler.CLIENT_SPEC); + ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigHandler.COMMON_SPEC); MinecraftForge.EVENT_BUS.addListener(this::serverAboutToStart); MinecraftForge.EVENT_BUS.addListener(this::serverStarting); MinecraftForge.EVENT_BUS.addListener(this::serverStopping); @@ -130,8 +134,6 @@ public class Botania { BotaniaAPI.internalHandler = new InternalMethodHandler(); - ConfigHandler.loadConfig(event.getSuggestedConfigurationFile()); - PacketHandler.init(); ModBrews.init(); ModMultiblocks.init(); @@ -194,15 +196,17 @@ public class Botania { FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", b.getRegistryName().toString()); if(Botania.thaumcraftLoaded) { - if(ConfigHandler.enableThaumcraftAspects) { - MinecraftForge.EVENT_BUS.register(TCAspects.class); + if(ConfigHandler.COMMON.enableThaumcraftAspects.get()) { + // todo 1.13 MinecraftForge.EVENT_BUS.register(TCAspects.class); } ModBrews.initTC(); ModBrewRecipes.initTC(); } + /* todo 1.13 if(Botania.bcApiLoaded) new StatementAPIPlugin(); + */ } public void postInit(FMLPostInitializationEvent event) { @@ -215,7 +219,6 @@ public class Botania { } ModBlocks.addDispenserBehaviours(); - ConfigHandler.loadPostInit(); LexiconData.postInit(); int words = 0; diff --git a/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java b/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java index f16fc4f94..9225d697a 100644 --- a/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockModDoubleFlower.java @@ -96,7 +96,7 @@ public class BlockModDoubleFlower extends BlockTallFlower implements ILexiconabl int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency) + if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); } diff --git a/src/main/java/vazkii/botania/common/block/BlockModFlower.java b/src/main/java/vazkii/botania/common/block/BlockModFlower.java index 729899b8b..77ccaa9c9 100644 --- a/src/main/java/vazkii/botania/common/block/BlockModFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockModFlower.java @@ -62,7 +62,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowab double y = pos.getY() + offset.y; double z = pos.getZ() + offset.z; - if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency) + if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) Botania.proxy.sparkleFX(x + 0.3 + rand.nextFloat() * 0.5, y + 0.5 + rand.nextFloat() * 0.5, z + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); } diff --git a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java index ce15bb596..8bf7f26ef 100644 --- a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java +++ b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java @@ -70,7 +70,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable { @Nonnull @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return ConfigHandler.staticFloaters ? EnumBlockRenderType.MODEL : EnumBlockRenderType.ENTITYBLOCK_ANIMATED; + return ConfigHandler.CLIENT.staticFloaters.get() ? EnumBlockRenderType.MODEL : EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Nonnull @@ -107,7 +107,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable { int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency) + if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); } diff --git a/src/main/java/vazkii/botania/common/block/decor/BlockModMushroom.java b/src/main/java/vazkii/botania/common/block/decor/BlockModMushroom.java index 7675a73b1..a25def5a0 100644 --- a/src/main/java/vazkii/botania/common/block/decor/BlockModMushroom.java +++ b/src/main/java/vazkii/botania/common/block/decor/BlockModMushroom.java @@ -75,7 +75,7 @@ public class BlockModMushroom extends BlockMushroom implements IHornHarvestable, int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency * 0.25F) + if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get() * 0.25F) Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); } diff --git a/src/main/java/vazkii/botania/common/block/subtile/SubTilePureDaisy.java b/src/main/java/vazkii/botania/common/block/subtile/SubTilePureDaisy.java index 8eb413808..c8c2ed4af 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/SubTilePureDaisy.java +++ b/src/main/java/vazkii/botania/common/block/subtile/SubTilePureDaisy.java @@ -91,7 +91,7 @@ public class SubTilePureDaisy extends SubTileEntity { if(recipe.set(world,coords, this)) { world.addBlockEvent(getPos(), supertile.getBlockState().getBlock(), RECIPE_COMPLETE_EVENT, positionAt); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, coords, Block.getStateId(recipe.getOutputState())); } } diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java index c450e4995..21feeb762 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java @@ -58,7 +58,7 @@ public class SubTileAgricarnation extends SubTileFunctional { Block block = supertile.getWorld().getBlockState(pos).getBlock(); mana -= 5; supertile.getWorld().getPendingBlockTicks().scheduleTick(pos, block, 1); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2005, pos, 6 + supertile.getWorld().rand.nextInt(4)); supertile.getWorld().playSound(null, x, y, z, ModSounds.agricarnation, SoundCategory.BLOCKS, 0.01F, 0.5F + (float) Math.random() * 0.5F); diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileClayconia.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileClayconia.java index dbad61360..f2291e339 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileClayconia.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileClayconia.java @@ -43,7 +43,7 @@ public class SubTileClayconia extends SubTileFunctional { BlockPos coords = getCoordsToPut(); if(coords != null) { supertile.getWorld().removeBlock(coords); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, coords, Block.getStateId(Blocks.SAND.getDefaultState())); EntityItem item = new EntityItem(supertile.getWorld(), coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, new ItemStack(Items.CLAY_BALL)); supertile.getWorld().spawnEntity(item); diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java index 744ef303e..3b154cd8d 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java @@ -50,7 +50,7 @@ public class SubTileJadedAmaranthus extends SubTileFunctional { if((supertile.getWorld().isAirBlock(up) || blockAbove.isReplaceable(supertile.getWorld(), up)) && stateAbove.getMaterial() != Material.WATER && ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), up)) { EnumDyeColor color = EnumDyeColor.byId(supertile.getWorld().rand.nextInt(16)); IBlockState state = ModBlocks.getFlower(color).getDefaultState(); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, up, Block.getStateId(state)); supertile.getWorld().setBlockState(up, state, 1 | 2); mana -= COST; diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileMarimorphosis.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileMarimorphosis.java index 9419b4701..0939fa53f 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileMarimorphosis.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileMarimorphosis.java @@ -61,7 +61,7 @@ public class SubTileMarimorphosis extends SubTileFunctional { IBlockState state = getStoneToPut(coords); if(state != null) { supertile.getWorld().setBlockState(coords, state); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, coords, Block.getStateId(state)); mana -= COST; diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileOrechid.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileOrechid.java index 41f201f6e..fd90979ef 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileOrechid.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileOrechid.java @@ -61,7 +61,7 @@ public class SubTileOrechid extends SubTileFunctional { IBlockState state = getOreToPut(); if(state != null) { supertile.getWorld().setBlockState(coords, state); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, coords, Block.getStateId(state)); supertile.getWorld().playSound(null, supertile.getPos(), ModSounds.orechid, SoundCategory.BLOCKS, 2F, 1F); diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileRannuncarpus.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileRannuncarpus.java index 9c80bc8bd..816a10abe 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileRannuncarpus.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileRannuncarpus.java @@ -120,7 +120,7 @@ public class SubTileRannuncarpus extends SubTileFunctional { if(stateToPlace != null) { if(stateToPlace.getBlock().canPlaceBlockAt(supertile.getWorld(), coords)) { supertile.getWorld().setBlockState(coords, stateToPlace, 1 | 2); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, coords, Block.getStateId(stateToPlace)); validPositions.remove(coords); ItemBlock.setTileEntityNBT(supertile.getWorld(), null, coords, stack); diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileMunchdew.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileMunchdew.java index 9eec872b4..91bed1a04 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileMunchdew.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileMunchdew.java @@ -87,7 +87,7 @@ public class SubTileMunchdew extends SubTileGenerating { supertile.getWorld().removeBlock(breakCoords); ticksWithoutEating = 0; ateOnce = true; - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) supertile.getWorld().playEvent(2001, breakCoords, Block.getStateId(state)); mana += manaPerLeaf; } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileAlfPortal.java b/src/main/java/vazkii/botania/common/block/tile/TileAlfPortal.java index 60a72cf33..20be2777f 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileAlfPortal.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileAlfPortal.java @@ -133,7 +133,7 @@ public class TileAlfPortal extends TileMod implements ITickable { if(ticksOpen > 60) { ticksSinceLastItem++; - if(ConfigHandler.elfPortalParticlesEnabled) + if(world.isRemote && ConfigHandler.CLIENT.elfPortalParticlesEnabled.get()) blockParticle(state); List items = world.getEntitiesWithinAABB(EntityItem.class, aabb); diff --git a/src/main/java/vazkii/botania/common/block/tile/TilePylon.java b/src/main/java/vazkii/botania/common/block/tile/TilePylon.java index a73411bf9..477805ef4 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TilePylon.java +++ b/src/main/java/vazkii/botania/common/block/tile/TilePylon.java @@ -59,7 +59,7 @@ public class TilePylon extends TileEntity implements ITickable { Vector3 centerBlock = new Vector3(centerPos.getX() + 0.5, centerPos.getY() + 0.75 + (Math.random() - 0.5 * 0.25), centerPos.getZ() + 0.5); if(variant == BlockPylon.Variant.NATURA) { - if(ConfigHandler.elfPortalParticlesEnabled) { + if(ConfigHandler.CLIENT.elfPortalParticlesEnabled.get()) { double worldTime = ticks; worldTime += new Random(pos.hashCode()).nextInt(1000); worldTime /= 5; diff --git a/src/main/java/vazkii/botania/common/block/tile/mana/TilePool.java b/src/main/java/vazkii/botania/common/block/tile/mana/TilePool.java index 417998608..e1533b8f2 100644 --- a/src/main/java/vazkii/botania/common/block/tile/mana/TilePool.java +++ b/src/main/java/vazkii/botania/common/block/tile/mana/TilePool.java @@ -229,7 +229,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt } case CHARGE_EFFECT_EVENT: { if(world.isRemote) { - if(ConfigHandler.chargingAnimationEnabled) { + if(ConfigHandler.COMMON.chargingAnimationEnabled.get()) { boolean outputting = param == 1; Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5); Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6); @@ -311,7 +311,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt } if(didSomething) { - if(ConfigHandler.chargingAnimationEnabled && world.rand.nextInt(20) == 0) { + if(ConfigHandler.COMMON.chargingAnimationEnabled.get() && world.rand.nextInt(20) == 0) { world.addBlockEvent(getPos(), getBlockState().getBlock(), CHARGE_EFFECT_EVENT, outputting ? 1 : 0); } isDoingTransfer = outputting; diff --git a/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java b/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java index c4e131ebb..250f4811c 100644 --- a/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java +++ b/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java @@ -446,7 +446,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector, burst.setShooterUUID(getIdentifier()); world.spawnEntity(burst); burst.ping(); - if(!ConfigHandler.silentSpreaders) + if(!ConfigHandler.COMMON.silentSpreaders.get()) world.playSound(null, pos, ModSounds.spreaderFire, SoundCategory.BLOCKS, 0.05F * (paddingColor != -1 ? 0.2F : 1F), 0.7F + 0.3F * (float) Math.random()); } } diff --git a/src/main/java/vazkii/botania/common/core/BotaniaCreativeTab.java b/src/main/java/vazkii/botania/common/core/BotaniaCreativeTab.java index bc4cbf627..771bc6494 100644 --- a/src/main/java/vazkii/botania/common/core/BotaniaCreativeTab.java +++ b/src/main/java/vazkii/botania/common/core/BotaniaCreativeTab.java @@ -300,7 +300,7 @@ public final class BotaniaCreativeTab extends ItemGroup { addItem(ModItems.ancientWillKaril); addItem(ModItems.pinkinator); addItem(ModItems.gaiaHead); - if(ConfigHandler.relicsEnabled) { + if(ConfigHandler.COMMON.relicsEnabled.get()) { addItem(ModItems.dice); addItem(ModItems.infiniteFruit); addItem(ModItems.kingKey); diff --git a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java index ba5f982ef..6c735445f 100644 --- a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java @@ -43,23 +43,23 @@ public final class BiomeDecorationHandler { if(!flowers) return; - int dist = Math.min(8, Math.max(1, ConfigHandler.flowerPatchSize)); - for(int i = 0; i < ConfigHandler.flowerQuantity; i++) { - if(event.getRand().nextInt(ConfigHandler.flowerPatchChance) == 0) { + int dist = Math.min(8, Math.max(1, ConfigHandler.COMMON.flowerPatchSize.get())); + for(int i = 0; i < ConfigHandler.COMMON.flowerQuantity.get(); i++) { + if(event.getRand().nextInt(ConfigHandler.COMMON.flowerPatchChance.get()) == 0) { int x = pos.getX() + event.getRand().nextInt(16) + 8; int z = pos.getZ() + event.getRand().nextInt(16) + 8; int y = event.getWorld().getTopSolidOrLiquidBlock(pos).getY(); EnumDyeColor color = EnumDyeColor.byMetadata(event.getRand().nextInt(16)); - for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) { + for(int j = 0; j < ConfigHandler.COMMON.flowerDensity.get() * ConfigHandler.COMMON.flowerPatchChance.get(); j++) { int x1 = x + event.getRand().nextInt(dist * 2) - dist; int y1 = y + event.getRand().nextInt(4) - event.getRand().nextInt(4); int z1 = z + event.getRand().nextInt(dist * 2) - dist; BlockPos pos2 = new BlockPos(x1, y1, z1); if(event.getWorld().isAirBlock(pos2) && (!event.getWorld().provider.isNether() || y1 < 127) && ModBlocks.flower.canPlaceBlockAt(event.getWorld(), pos2)) { event.getWorld().setBlockState(pos2, ModBlocks.flower.getDefaultState().with(BotaniaStateProps.COLOR, color), 2); - if(event.getRand().nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).canGrow(event.getWorld(), pos2, event.getWorld().getBlockState(pos2), false)) { + if(event.getRand().nextDouble() < ConfigHandler.COMMON.flowerTallChance.get() && ((BlockModFlower) ModBlocks.flower).canGrow(event.getWorld(), pos2, event.getWorld().getBlockState(pos2), false)) { Block block = ModBlocks.getDoubleFlower(color); if(block instanceof BlockDoublePlant) { ((BlockDoublePlant) block).placeAt(event.getWorld(), pos2, 3); @@ -70,7 +70,7 @@ public final class BiomeDecorationHandler { } } - for(int i = 0; i < ConfigHandler.mushroomQuantity; i++) { + for(int i = 0; i < ConfigHandler.COMMON.mushroomQuantity.get(); i++) { int x = pos.getX() + event.getRand().nextInt(16) + 8; int z = pos.getZ() + event.getRand().nextInt(16) + 8; int y = event.getRand().nextInt(26) + 4; diff --git a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java index e4481b632..1170bb8e0 100644 --- a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java @@ -10,432 +10,237 @@ */ package vazkii.botania.common.core.handler; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentString; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; -import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import vazkii.botania.common.Botania; -import vazkii.botania.common.lib.LibMisc; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import net.minecraftforge.common.ForgeConfigSpec; +import org.apache.commons.lang3.tuple.Pair; public final class ConfigHandler { - public static Configuration config; - public static ConfigAdaptor adaptor; + public static class Client { + public final ForgeConfigSpec.BooleanValue useAdaptativeConfig; + public final ForgeConfigSpec.BooleanValue useShaders; + public final ForgeConfigSpec.BooleanValue lexiconRotatingItems; + public final ForgeConfigSpec.BooleanValue lexiconJustifiedText; + public final ForgeConfigSpec.BooleanValue subtlePowerSystem; + public final ForgeConfigSpec.BooleanValue staticWandBeam; + public final ForgeConfigSpec.BooleanValue boundBlockWireframe; + public final ForgeConfigSpec.BooleanValue lexicon3dModel; + public final ForgeConfigSpec.DoubleValue flowerParticleFrequency; + public final ForgeConfigSpec.BooleanValue elfPortalParticlesEnabled; + public final ForgeConfigSpec.BooleanValue useVanillaParticleLimiter; + public final ForgeConfigSpec.BooleanValue renderBaubles; + public final ForgeConfigSpec.BooleanValue enableSeasonalFeatures; + public final ForgeConfigSpec.BooleanValue useShiftForQuickLookup; + public final ForgeConfigSpec.BooleanValue lexicaOfflineMode; + public final ForgeConfigSpec.BooleanValue enableArmorModels; + public final ForgeConfigSpec.BooleanValue enableFancySkybox; + public final ForgeConfigSpec.BooleanValue enableFancySkyboxInNormalWorlds; + public final ForgeConfigSpec.IntValue manaBarHeight; + public final ForgeConfigSpec.IntValue flightBarHeight; + public final ForgeConfigSpec.IntValue flightBarBreathHeight; + public final ForgeConfigSpec.IntValue glSecondaryTextureUnit; - public static boolean useAdaptativeConfig = true; + public final ForgeConfigSpec.BooleanValue staticFloaters; + public final ForgeConfigSpec.BooleanValue debugInfo; + public final ForgeConfigSpec.BooleanValue matrixMode; + public final ForgeConfigSpec.BooleanValue referencesEnabled; - public static boolean useShaders = true; - public static boolean lexiconRotatingItems = true; - public static boolean lexiconJustifiedText = false; - public static boolean subtlePowerSystem = false; - public static boolean staticWandBeam = false; - public static boolean boundBlockWireframe = true; - public static boolean lexicon3dModel = true; - public static double flowerParticleFrequency = 0.75F; - public static boolean blockBreakParticles = true; - public static boolean blockBreakParticlesTool = true; - public static boolean elfPortalParticlesEnabled = true; - public static boolean chargingAnimationEnabled = true; - public static boolean useVanillaParticleLimiter = true; - public static boolean silentSpreaders = false; - public static boolean renderBaubles = true; - public static boolean enableSeasonalFeatures = true; - public static boolean useShiftForQuickLookup = false; - public static boolean lexicaOfflineMode = false; - public static boolean enableArmorModels = true; - public static boolean enableFancySkybox = true; - public static boolean enableFancySkyboxInNormalWorlds = false; - - public static int manaBarHeight = 29; - public static int flightBarHeight = 49; - public static int flightBarBreathHeight = 59; - public static int glSecondaryTextureUnit = 7; - - public static boolean altFlowerTextures = false; - public static boolean staticFloaters = false; - public static boolean debugInfo = true; - public static boolean matrixMode = false; - public static boolean referencesEnabled = true; - -// public static boolean versionCheckEnabled = true; - public static int spreaderPositionShift = 1; - public static int spreaderTraceTime = 400; - public static boolean flowerForceCheck = true; - public static boolean enderPickpocketEnabled = true; - - public static boolean fallenKanadeEnabled = true; - public static boolean enchanterEnabled = true; - public static boolean fluxfieldEnabled = true; - public static boolean relicsEnabled = true; - public static boolean ringOfOdinFireResist = true; - public static boolean invertMagnetRing = false; - public static boolean enableThaumcraftStablizers = true; - public static boolean enableThaumcraftAspects = true; - - public static int harvestLevelWeight = 2; - public static int harvestLevelBore = 3; - - public static int flowerQuantity = 2; - public static int flowerDensity = 2; - public static int flowerPatchSize = 6; - public static int flowerPatchChance = 16; - public static double flowerTallChance = 0.05; - public static int mushroomQuantity = 40; - - public static void loadConfig(File configFile) { - config = new Configuration(configFile); - - config.load(); - load(); + public Client(ForgeConfigSpec.Builder builder) { + useAdaptativeConfig = builder + .comment("Set this to false to disable the Adaptative Config. Adaptative Config changes any default config values from old versions to the new defaults to make sure you aren't missing out on changes because of old configs. It will not touch any values that were changed manually.") + .define("adaptive_config", true); + useShaders = builder + .comment("Set this to false to disable the use of shaders for some of the mod's renders.") + .define("shaders.enabled", true); + lexiconRotatingItems = builder + .comment("Set this to false to disable the rotating items in the petal and rune entries in the Lexica Botania.") + .define("lexicon.rotating_items", true); + lexiconJustifiedText = builder + .comment("Set this to true to enable justified text in the Lexica Botania's text pages.") + .define("lexicon.justified_text", false); + subtlePowerSystem = builder + .comment("Set this to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag.") + .define("subtile_power_system", false); + staticWandBeam = builder + .comment("Set this to true to use a static wand beam that shows every single position of the burst, similar to the way it used to work on old Botania versions. Warning: Disabled by default because it may be laggy.") + .define("static_wand_beam", false); + boundBlockWireframe = builder + .comment("Set this to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc).") + .define("bound_block_wireframe", true); + lexicon3dModel = builder + .comment("Set this to false to disable the animated 3D render for the Lexica Botania.") + .define("lexicon.render_3d", true); + flowerParticleFrequency = builder + .comment("The frequency in which particles spawn from normal (worldgen) mystical flowers") + .defineInRange("particles.flower_frequency", 0.75, Double.MIN_VALUE, Double.MAX_VALUE); + elfPortalParticlesEnabled = builder + .comment("Set this to false to disable the particles in the elven portal.") + .define("particles.elf_portal", true); + useVanillaParticleLimiter = builder + .comment("Set this to false to always display all particles regardless of the \"Particles\" setting in the Vanilla options menu.") + .define("particles.use_vanilla", true); + renderBaubles = builder + .comment("Set this to false to disable rendering of baubles in the player.") + .define("render_baubles", true); + enableSeasonalFeatures = builder + .comment("Set this to false to disable seasonal features, such as halloween and christmas.") + .define("seasonal_features", true); + useShiftForQuickLookup = builder + .comment("Set this to true to use Shift instead of Ctrl for the inventory lexica botania quick lookup feature") + .define("quick_lookup.use_shift", false); + lexicaOfflineMode = builder + .comment("Set this to true to disable the wiki lookup feature of the lexica, for offline usage") + .define("quick_lookup.offline_mode", false); + enableArmorModels = builder + .comment("Set this to false to disable custom armor models") + .define("armor_models", true); + enableFancySkybox = builder + .comment("Set this to false to disable the fancy skybox in Garden of Glass") + .define("fancy_skybox.enabled", true); + enableFancySkyboxInNormalWorlds = builder + .comment("Set this to true to enable the fancy skybox in non Garden of Glass worlds. (Does not require Garden of Glass loaded to use, needs 'fancy_skybox.enabled' to be true as well)") + .define("fancy_skybox.normal_worlds", false); + manaBarHeight = builder + .comment("The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.") + .defineInRange("hud.mana_bar.height", 29, 0, Integer.MAX_VALUE); + flightBarHeight = builder + .comment("The height of the Flugel Tiara flight bar. You can change this if you have a mod that adds a bar in that spot.") + .defineInRange("hud.flight_bar.height", 49, 0, Integer.MAX_VALUE); + flightBarBreathHeight = builder + .comment("The height of the Flugel Tiara flight bar if your breath bar is shown. You can change this if you have a mod that adds a bar in that spot.") + .defineInRange("hud.flight_bar_breath.height", 59, 0, Integer.MAX_VALUE); + glSecondaryTextureUnit = builder + .comment("The GL Texture Unit to use for the secondary sampler passed in to the Lexica Botania's category button shader. DO NOT TOUCH THIS IF YOU DON'T KNOW WHAT YOU'RE DOING") + .defineInRange("shaders.secondary_unit", 7, 0, Integer.MAX_VALUE); + staticFloaters = builder + .comment("Set this to true if you use lots of floating flowers and are experiencing rendering lag. Will disable the floating flowers' animations and render them statically for a major performance boost. Hit F3+A in-world after toggling this.") + .define("static_floaters", false); + debugInfo = builder + .comment("Set to false to disable Botania's messages in the F3 debug screen") + .define("debug_info", true); + matrixMode = builder + .comment("Set this to true if you are the chosen one. For lovers of glitch art and just general mad people.") + .define("matrix_mode", false); + referencesEnabled = builder + .comment("Set this to false to disable the references in the flower tooltips. (You monster D:)") + .define("references", true); + } } - public static void load() { - String desc; - - desc = "Set this to false to disable the Adaptative Config. Adaptative Config changes any default config values from old versions to the new defaults to make sure you aren't missing out on changes because of old configs. It will not touch any values that were changed manually."; - useAdaptativeConfig = loadPropBool("adaptativeConfig.enabled", desc, useAdaptativeConfig); - adaptor = new ConfigAdaptor(useAdaptativeConfig); - - desc = "Set this to false to disable the use of shaders for some of the mod's renders."; - useShaders = loadPropBool("shaders.enabled", desc, useShaders); - - desc = "Set this to false to disable the rotating items in the petal and rune entries in the Lexica Botania."; - lexiconRotatingItems = loadPropBool("lexicon.enable.rotatingItems", desc, lexiconRotatingItems); - - desc = "Set this to true to enable justified text in the Lexica Botania's text pages."; - lexiconJustifiedText = loadPropBool("lexicon.enable.justifiedText", desc, lexiconJustifiedText); - - desc = "Set this to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag."; - subtlePowerSystem = loadPropBool("powerSystem.subtle", desc, subtlePowerSystem); - - desc = "Set this to true to use a static wand beam that shows every single position of the burst, similar to the way it used to work on old Botania versions. Warning: Disabled by default because it may be laggy."; - staticWandBeam = loadPropBool("wandBeam.static", desc, staticWandBeam); - - desc = "Set this to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc)."; - boundBlockWireframe = loadPropBool("boundBlock.wireframe.enabled", desc, boundBlockWireframe); - - desc = "Set this to false to disable the animated 3D render for the Lexica Botania."; - lexicon3dModel = loadPropBool("lexicon.render.3D", desc, lexicon3dModel); - - desc = "The frequency in which particles spawn from normal (worldgen) mystical flowers"; - flowerParticleFrequency = loadPropDouble("flowerParticles.frequency", desc, flowerParticleFrequency); - - desc = "Set this to false to remove the block breaking particles from the flowers and other items in the mod."; - blockBreakParticles = loadPropBool("blockBreakingParticles.enabled", desc, blockBreakParticles); - - desc = "Set this to false to remove the block breaking particles from the Mana Shatterer, as there can be a good amount in higher levels."; - blockBreakParticlesTool = loadPropBool("blockBreakingParticlesTool.enabled", desc, blockBreakParticlesTool); - - desc = "Set this to false to disable the particles in the elven portal."; - elfPortalParticlesEnabled = loadPropBool("elfPortal.particles.enabled", desc, elfPortalParticlesEnabled); - - desc = "Set this to false to disable the animation when an item is charging on top of a mana pool."; - chargingAnimationEnabled = loadPropBool("chargeAnimation.enabled", desc, chargingAnimationEnabled); - - desc = "Set this to false to always display all particles regardless of the \"Particles\" setting in the Vanilla options menu."; - useVanillaParticleLimiter = loadPropBool("vanillaParticleConfig.enabled", desc, useVanillaParticleLimiter); - - desc = "Set this to true to disable the mana spreader shooting sound."; - silentSpreaders = loadPropBool("manaSpreaders.silent", desc, silentSpreaders); - - desc = "Set this to false to disable rendering of baubles in the player."; - renderBaubles = loadPropBool("baubleRender.enabled", desc, renderBaubles); - - desc = "Set this to false to disable seasonal features, such as halloween and christmas."; - enableSeasonalFeatures = loadPropBool("seasonalFeatures.enabled", desc, enableSeasonalFeatures); - - desc = "Set this to true to use Shift instead of Ctrl for the inventory lexica botania quick lookup feature."; - useShiftForQuickLookup = loadPropBool("quickLookup.useShift", desc, useShiftForQuickLookup); - - desc = "Set this to true to disable the wiki lookup feature of the lexica, for offline usage."; - lexicaOfflineMode = loadPropBool("quickLookup.lexicaOfflineMode", desc, lexicaOfflineMode); - - desc = "Set this to false to disable custom armor models."; - enableArmorModels = loadPropBool("armorModels.enable", desc, enableArmorModels); - - desc = "Set this to false to disable the fancy skybox in Garden of Glass."; - enableFancySkybox = loadPropBool("fancySkybox.enable", desc, enableFancySkybox); - - desc = "Set this to true to enable the fancy skybox in non Garden of Glass worlds. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)"; - enableFancySkyboxInNormalWorlds = loadPropBool("fancySkybox.normalWorlds", desc, enableFancySkyboxInNormalWorlds); - - desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is."; - manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight); - - desc = "The height of the Flugel Tiara flight bar. You can change this if you have a mod that adds a bar in that spot."; - flightBarHeight = loadPropInt("flightBar.height", desc, flightBarHeight); - - desc = "The height of the Flugel Tiara flight bar if your breath bar is shown. You can change this if you have a mod that adds a bar in that spot."; - flightBarBreathHeight = loadPropInt("flightBarBreath.height", desc, flightBarBreathHeight); - - desc = "The GL Texture Unit to use for the secondary sampler passed in to the Lexica Botania's category button shader. DO NOT TOUCH THIS IF YOU DON'T KNOW WHAT YOU'RE DOING"; - glSecondaryTextureUnit = loadPropInt("shaders.secondaryUnit", desc, glSecondaryTextureUnit); - - desc = "Set this to true if you use lots of floating flowers and are experiencing rendering lag. Will disable the floating flowers' animations and render them statically for a major performance boost. Hit F3+A in-world after toggling this."; - staticFloaters = loadPropBool("staticFloaters.enabled", desc, staticFloaters); - - desc = "Set to false to disable Botania's messages in the F3 debug screen"; - debugInfo = loadPropBool("debugInfo.enabled", desc, debugInfo); - - desc = "Set this to true if you are the chosen one. For lovers of glitch art and just general mad people."; - matrixMode = loadPropBool("matrixMode.enabled", desc, matrixMode); - - desc = "Set this to false to disable the references in the flower tooltips. (You monster D:)"; - referencesEnabled = loadPropBool("references.enabled", desc, referencesEnabled); - -// desc = "Set this to false to disable checking and alerting when new Botania versions come out. (keywords for noobs: update notification message)"; -// versionCheckEnabled = loadPropBool("versionChecking.enabled", desc, versionCheckEnabled); - - desc = "Do not ever touch this value if not asked to. Possible symptoms of doing so include your head turning backwards, the appearance of Titans near the walls or you being trapped in a game of Sword Art Online."; - spreaderPositionShift = loadPropInt("spreader.posShift", desc, spreaderPositionShift); - - desc = "How many ticks into the future will mana spreaders attempt to predict where mana bursts go? Setting this lower will improve spreader performance, but will cause them to not fire at targets that are too far away."; - spreaderTraceTime = loadPropInt("spreader.traceTime", desc, spreaderTraceTime); - - desc = "Turn this off ONLY IF you're on an extremely large world with an exaggerated count of Mana Spreaders/Mana Pools and are experiencing TPS lag. This toggles whether flowers are strict with their checking for connecting to pools/spreaders or just check whenever possible."; - flowerForceCheck = loadPropBool("flower.forceCheck", desc, flowerForceCheck); - - desc = "Set to false to disable the ability for the Hand of Ender to pickpocket other players' ender chests."; - enderPickpocketEnabled = loadPropBool("enderPickpocket.enabled", desc, enderPickpocketEnabled); - - desc = "Set this to false to disable the Fallen Kanade flower (gives Regeneration). This config option is here for those using Blood Magic. Note: Turning this off will not remove ones already in the world, it'll simply prevent the crafting."; - fallenKanadeEnabled = loadPropBool("fallenKanade.enabled", desc, fallenKanadeEnabled); - - desc = "Set this to false to disable the Mana Enchanter. Since some people find it OP or something. This only disables the entry and creation. Old ones that are already in the world will stay."; - enchanterEnabled = loadPropBool("manaEnchanter.enabled", desc, enchanterEnabled); - - desc = "Set this to false to disable the Mana Fluxfield (generates RF from mana). This only disables the entry and creation. Old ones that are already in the world will stay."; - fluxfieldEnabled = loadPropBool("manaFluxfield.enabled", desc, fluxfieldEnabled); - - desc = "Set this to false to disable the Relic System. This only disables the entries, drops and achievements. Old ones that are already in the world will stay."; - relicsEnabled = loadPropBool("relics.enabled", desc, relicsEnabled); - - desc = "Set this to false to make the Ring of Odin not apply fire resistance. Mostly for people who use Witchery transformations."; - ringOfOdinFireResist = loadPropBool("ringOfOdin.fireResist", desc, ringOfOdinFireResist); - - desc = "Set this to true to invert the Ring of Magnetization's controls (from shift to stop to shift to work)"; - invertMagnetRing = loadPropBool("magnetRing.invert", desc, invertMagnetRing); - - desc = "Set this to false to disable Thaumcraft Infusion Stabilizing in botania blocks"; - enableThaumcraftStablizers = loadPropBool("thaumraftStabilizers.enabled", desc, enableThaumcraftStablizers); - - desc = "Set this to false to disable Thaumcraft aspects on Botania items"; - enableThaumcraftAspects = loadPropBool("thaumcraftAspects.enabled", desc, enableThaumcraftAspects); - - desc = "The harvest level of the Mana Lens: Weight. 3 is diamond level. Defaults to 2 (iron level)"; - harvestLevelWeight = loadPropInt("harvestLevel.weightLens", desc, harvestLevelWeight); - - desc = "The harvest level of the Mana Lens: Bore. 3 is diamond level. Defaults to 3"; - harvestLevelBore = loadPropInt("harvestLevel.boreLens", desc, harvestLevelBore); - - desc = "The quantity of Botania flower patches to generate in the world, defaults to 2, the lower the number the less patches generate."; - flowerQuantity = loadPropInt("worldgen.flower.quantity", desc, flowerQuantity); - - desc = "The density of each Botania flower patch generated, defaults to 2, the lower the number, the less each patch will have."; - adaptor.addMappingInt(0, "worldgen.flower.density", 16); - adaptor.addMappingInt(238, "worldgen.flower.density", 2); - flowerDensity = loadPropInt("worldgen.flower.density", desc, flowerDensity); - - desc = "The size of each Botania flower patch, defaults to 6. The larger this is the farther the each patch can spread"; - flowerPatchSize = loadPropInt("worldgen.flower.patchSize", desc, flowerPatchSize); - - desc = "The inverse chance for a Botania flower patch to be generated, defaults to 16. The higher this value is the less patches will exist and the more flower each will have."; - adaptor.addMappingInt(0, "worldgen.flower.patchChance", 4); - adaptor.addMappingInt(238, "worldgen.flower.patchChance", 16); - flowerPatchChance = loadPropInt("worldgen.flower.patchChance", desc, flowerPatchChance); - - desc = "The chance for a Botania flower generated in a patch to be a tall flower. 0.1 is 10%, 1 is 100%. Defaults to 0.05"; - adaptor.addMappingDouble(0, "worldgen.flower.tallChance", 0.1); - adaptor.addMappingDouble(238, "worldgen.flower.tallChance", 0.05); - flowerTallChance = loadPropDouble("worldgen.flower.tallChance", desc, flowerTallChance); - - desc = "The quantity of Botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate."; - mushroomQuantity = loadPropInt("worldgen.mushroom.quantity", desc, mushroomQuantity); - - if(config.hasChanged()) - config.save(); + public static final Client CLIENT; + public static final ForgeConfigSpec CLIENT_SPEC; + static { + final Pair specPair = new ForgeConfigSpec.Builder().configure(Client::new); + CLIENT_SPEC = specPair.getRight(); + CLIENT = specPair.getLeft(); } - public static void loadPostInit() { - if(config.hasChanged()) - config.save(); + public static class Common { + public final ForgeConfigSpec.BooleanValue blockBreakParticles; + public final ForgeConfigSpec.BooleanValue blockBreakParticlesTool; + public final ForgeConfigSpec.BooleanValue chargingAnimationEnabled; + public final ForgeConfigSpec.BooleanValue silentSpreaders; + public final ForgeConfigSpec.IntValue spreaderTraceTime; + public final ForgeConfigSpec.BooleanValue flowerForceCheck; + public final ForgeConfigSpec.BooleanValue enderPickpocketEnabled; + + public final ForgeConfigSpec.BooleanValue fallenKanadeEnabled; + public final ForgeConfigSpec.BooleanValue enchanterEnabled; + public final ForgeConfigSpec.BooleanValue fluxfieldEnabled; + public final ForgeConfigSpec.BooleanValue relicsEnabled; + public final ForgeConfigSpec.BooleanValue ringOfOdinFireResist; + public final ForgeConfigSpec.BooleanValue invertMagnetRing; + public final ForgeConfigSpec.BooleanValue enableThaumcraftStablizers; + public final ForgeConfigSpec.BooleanValue enableThaumcraftAspects; + + public final ForgeConfigSpec.IntValue harvestLevelWeight; + public final ForgeConfigSpec.IntValue harvestLevelBore; + + public final ForgeConfigSpec.IntValue flowerQuantity; + public final ForgeConfigSpec.IntValue flowerDensity; + public final ForgeConfigSpec.IntValue flowerPatchSize; + public final ForgeConfigSpec.IntValue flowerPatchChance; + public final ForgeConfigSpec.DoubleValue flowerTallChance; + public final ForgeConfigSpec.IntValue mushroomQuantity; + + public Common(ForgeConfigSpec.Builder builder) { + blockBreakParticles = builder + .comment("Set this to false to remove the block breaking particles from the flowers and other items in the mod.") + .define("blockBreakingParticles.enabled", true); + blockBreakParticlesTool = builder + .comment("Set this to false to remove the block breaking particles from the Mana Shatterer, as there can be a good amount in higher levels.") + .define("blockBreakingParticlesTool.enabled", true); + chargingAnimationEnabled = builder + .comment("Set this to false to disable the animation when an item is charging on top of a mana pool") + .define("chargeAnimation.enabled", true); + silentSpreaders = builder + .comment("Set this to true to disable the mana spreader shooting sound") + .define("manaSpreaders.silent", false); + spreaderTraceTime = builder + .comment("How many ticks into the future will mana spreaders attempt to predict where mana bursts go? Setting this lower will improve spreader performance, but will cause them to not fire at targets that are too far away.") + .defineInRange("spreader.traceTime", 400, 1, Integer.MAX_VALUE); + flowerForceCheck = builder + .comment("Turn this off ONLY IF you're on an extremely large world with an exaggerated count of Mana Spreaders/Mana Pools and are experiencing TPS lag. This toggles whether flowers are strict with their checking for connecting to pools/spreaders or just check whenever possible.") + .define("flower.forceCheck", true); + enderPickpocketEnabled = builder + .comment("Set to false to disable the ability for the Hand of Ender to pickpocket other players' ender chests") + .define("enderPickpocket.enabled", true); + fallenKanadeEnabled = builder + .comment("Set this to false to disable the Fallen Kanade flower (gives Regeneration). This config option is here for those using Blood Magic. Note: Turning this off will not remove ones already in the world, it'll simply prevent the crafting.") + .define("fallenKanade.enabled", true); + enchanterEnabled = builder + .comment("Set this to false to disable the Mana Enchanter. Since some people find it OP or something. This only disables the entry and creation. Old ones that are already in the world will stay.") + .define("manaEnchanter.enabled", true); + fluxfieldEnabled = builder + .comment("Set this to false to disable the Mana Fluxfield (generates FE from mana). This only disables the entry and creation. Old ones that are already in the world will stay.") + .define("manaFluxfield.enabled", true); + relicsEnabled = builder + .comment("Set this to false to disable the Relic System. This only disables the entries, drops and achievements. Old ones that are already in the world will stay.") + .define("relics.enabled", true); + ringOfOdinFireResist = builder + .comment("Set this to false to make the Ring of Odin not apply fire resistance. Mostly for people who use Witchery transformations.") + .define("ringOfOdin.fireResist", true); + invertMagnetRing = builder + .comment("Set this to true to invert the Ring of Magnetization's controls (from shift to stop to shift to work)") + .define("magnetRing.invert", false); + enableThaumcraftStablizers = builder + .comment("Set this to false to disable Thaumcraft Infusion Stabilizing in botania blocks") + .define("thaumraftStabilizers.enabled", true); + enableThaumcraftAspects = builder + .comment("Set this to false to disable Thaumcraft aspects on Botania items") + .define("thaumcraftAspects.enabled", true); + harvestLevelWeight = builder + .comment("The harvest level of the Mana Lens: Weight. 3 is diamond level. Defaults to 2 (iron level)") + .defineInRange("harvestLevel.weightLens", 2, 0, Integer.MAX_VALUE); + harvestLevelBore = builder + .comment("The harvest level of the Mana Lens: Bore. 3 is diamond level. Defaults to 3") + .defineInRange("harvestLevel.boreLens", 3, 0, Integer.MAX_VALUE); + flowerQuantity = builder + .comment("The quantity of Botania flower patches to generate in the world, defaults to 2, the lower the number the less patches generate.") + .defineInRange("worldgen.flower.quantity", 2, 0, Integer.MAX_VALUE); + flowerDensity = builder + .comment("The density of each Botania flower patch generated, defaults to 2, the lower the number, the less each patch will have.") + .defineInRange("worldgen.flower.density", 2, 0, Integer.MAX_VALUE); + flowerPatchSize = builder + .comment("The size of each Botania flower patch, defaults to 6. The larger this is the farther the each patch can spread") + .defineInRange("worldgen.flower.patchSize", 6, 0, Integer.MAX_VALUE); + flowerPatchChance = builder + .comment("The inverse chance for a Botania flower patch to be generated, defaults to 16. The higher this value is the less patches will exist and the more flower each will have.") + .defineInRange("worldgen.flower.patchChance", 16, 0, Integer.MAX_VALUE); + flowerTallChance = builder + .comment("The chance for a Botania flower generated in a patch to be a tall flower. 0.1 is 10%, 1 is 100%. Defaults to 0.05") + .defineInRange("worldgen.flower.tallChance", 0.05, 0, 1); + mushroomQuantity = builder + .comment("The quantity of Botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate.") + .defineInRange("worldgen.mushroom.quantity", 40, 0, Integer.MAX_VALUE); + } } - public static int loadPropInt(String propName, String desc, int default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.setComment(desc); - - if(adaptor != null) - adaptor.adaptPropertyInt(prop, prop.getInt(default_)); - - return prop.getInt(default_); - } - - public static double loadPropDouble(String propName, String desc, double default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.setComment(desc); - - if(adaptor != null) - adaptor.adaptPropertyDouble(prop, prop.getDouble(default_)); - - return prop.getDouble(default_); - } - - public static boolean loadPropBool(String propName, String desc, boolean default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.setComment(desc); - - if(adaptor != null) - adaptor.adaptPropertyBool(prop, prop.getBoolean(default_)); - - return prop.getBoolean(default_); - } - - public static class ConfigAdaptor { - - private boolean enabled; - private int lastBuild; - private int currentBuild; - - private final Map> adaptableValues = new HashMap<>(); - private final List changes = new ArrayList<>(); - - public ConfigAdaptor(boolean enabled) { - this.enabled = enabled; - - String lastVersion = Botania.proxy.getLastVersion(); - try { - lastBuild = Integer.parseInt(lastVersion); - currentBuild = Integer.parseInt(LibMisc.BUILD); - } catch(NumberFormatException e) { - this.enabled = false; - } - } - - public void adaptProperty(Property prop, T val) { - if(!enabled) - return; - - String name = prop.getName(); - - if(!adaptableValues.containsKey(name)) - return; - - AdaptableValue bestValue = null; - for(AdaptableValue value : adaptableValues.get(name)) { - if(value.version >= lastBuild) // If version is newer than what we last used we don't care about it - continue; - - if(bestValue == null || value.version > bestValue.version) - bestValue = value; - } - - if(bestValue != null) { - T expected = bestValue.value; - T def = (T) prop.getDefault(); - - if(areEqualNumbers(val, expected) && !areEqualNumbers(val, def)) { - prop.setValue(def.toString()); - changes.add(" " + prop.getName() + ": " + val + " -> " + def); - } - } - } - - public void addMapping(int version, String key, T val) { - if(!enabled) - return; - - AdaptableValue adapt = new AdaptableValue<>(version, val); - if(!adaptableValues.containsKey(key)) { - adaptableValues.put(key, new ArrayList<>()); - } - - List list = adaptableValues.get(key); - list.add(adapt); - } - - public boolean areEqualNumbers(Object v1, Object v2) { - double epsilon = 1.0E-6; - float v1f = ((Number) v1).floatValue(); - float v2f; - - if(v2 instanceof String) - v2f = Float.parseFloat((String) v2); - else v2f = ((Number) v2).floatValue(); - - return Math.abs(v1f - v2f) < epsilon; - } - - public void tellChanges(EntityPlayer player) { - if(changes.size() == 0) - return; - - player.sendMessage(new TextComponentTranslation("botaniamisc.adaptativeConfigChanges").setStyle(new Style().setColor(TextFormatting.GOLD))); - for(String change : changes) - player.sendMessage(new TextComponentString(change).setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); - } - - public void addMappingInt(int version, String key, int val) { - this.addMapping(version, key, val); - } - - public void addMappingDouble(int version, String key, double val) { - this.addMapping(version, key, val); - } - - public void addMappingBool(int version, String key, boolean val) { - this.addMapping(version, key, val); - } - - public void adaptPropertyInt(Property prop, int val) { - this.adaptProperty(prop, val); - } - - public void adaptPropertyDouble(Property prop, double val) { - this.adaptProperty(prop, val); - } - - public void adaptPropertyBool(Property prop, boolean val) { - this.adaptProperty(prop, val); - } - - public static class AdaptableValue { - - public final int version; - public final T value; - public final Class valueType; - - public AdaptableValue(int version, T value) { - this.version = version; - this.value = value; - valueType = (Class) value.getClass(); - } - - } - - } - - @Mod.EventBusSubscriber(modid = LibMisc.MOD_ID) - public static class ChangeListener { - - @SubscribeEvent - public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) { - if(eventArgs.getModID().equals(LibMisc.MOD_ID)) - load(); - } - + public static final Common COMMON; + public static final ForgeConfigSpec COMMON_SPEC; + static { + final Pair specPair = new ForgeConfigSpec.Builder().configure(Common::new); + COMMON_SPEC = specPair.getRight(); + COMMON = specPair.getLeft(); } } diff --git a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java index f8f9ddb34..ae4c06d4d 100644 --- a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java @@ -212,7 +212,7 @@ public class InternalMethodHandler extends DummyMethodHandler { @Override public boolean shouldForceCheck() { - return ConfigHandler.flowerForceCheck; + return ConfigHandler.COMMON.flowerForceCheck.get(); } @Override diff --git a/src/main/java/vazkii/botania/common/core/loot/EnableRelics.java b/src/main/java/vazkii/botania/common/core/loot/EnableRelics.java index c5142a9a5..51407abb5 100644 --- a/src/main/java/vazkii/botania/common/core/loot/EnableRelics.java +++ b/src/main/java/vazkii/botania/common/core/loot/EnableRelics.java @@ -16,7 +16,7 @@ public class EnableRelics implements LootCondition { @Override public boolean testCondition(@Nonnull Random rand, @Nonnull LootContext context) { - return ConfigHandler.relicsEnabled; + return ConfigHandler.COMMON.relicsEnabled.get(); } public static class Serializer extends LootCondition.Serializer { diff --git a/src/main/java/vazkii/botania/common/core/version/AdaptorNotifier.java b/src/main/java/vazkii/botania/common/core/version/AdaptorNotifier.java deleted file mode 100644 index 572158d0e..000000000 --- a/src/main/java/vazkii/botania/common/core/version/AdaptorNotifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - * File Created @ [05/12/2015, 15:31:51 (GMT)] - */ -package vazkii.botania.common.core.version; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; -import vazkii.botania.common.core.handler.ConfigHandler; - -public final class AdaptorNotifier { - - private AdaptorNotifier() {} - - private static boolean triedToWarnPlayer; - - @SubscribeEvent - public static void onTick(ClientTickEvent event) { - if(!triedToWarnPlayer && Minecraft.getInstance().player != null) { - EntityPlayer player = Minecraft.getInstance().player; - ConfigHandler.adaptor.tellChanges(player); - - triedToWarnPlayer = true; - } - } - -} diff --git a/src/main/java/vazkii/botania/common/crafting/FluxfieldConditionFactory.java b/src/main/java/vazkii/botania/common/crafting/FluxfieldConditionFactory.java index 9e8ee67aa..27ff25ad5 100644 --- a/src/main/java/vazkii/botania/common/crafting/FluxfieldConditionFactory.java +++ b/src/main/java/vazkii/botania/common/crafting/FluxfieldConditionFactory.java @@ -21,6 +21,6 @@ public class FluxfieldConditionFactory implements IConditionSerializer { @Override public BooleanSupplier parse(@Nonnull JsonObject json) { boolean value = JsonUtils.getBoolean(json , "value", true); - return () -> ConfigHandler.fluxfieldEnabled == value; + return () -> ConfigHandler.COMMON.fluxfieldEnabled.get() == value; } } diff --git a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java b/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java index 1a13501e0..73ffe2462 100644 --- a/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java +++ b/src/main/java/vazkii/botania/common/crafting/ModPetalRecipes.java @@ -107,7 +107,7 @@ public final class ModPetalRecipes { else orechidRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID), gray, gray, yellow, green, red, runePride, runeGreed, redstoneRoot, pixieDust); orechidIgnemRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM), red, red, white, white, pink, runePride, runeGreed, redstoneRoot, pixieDust); - if(ConfigHandler.fallenKanadeEnabled) + if(ConfigHandler.COMMON.fallenKanadeEnabled.get()) fallenKanadeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_FALLEN_KANADE), white, white, yellow, yellow, orange, runeSpring); exoflameRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_EXOFLAME), red, red, gray, lightGray, runeFire, runeSummer); agricarnationRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_AGRICARNATION), lime, lime, green, yellow, runeSpring, redstoneRoot); diff --git a/src/main/java/vazkii/botania/common/entity/EntityFallingStar.java b/src/main/java/vazkii/botania/common/entity/EntityFallingStar.java index b4d746762..6dc57547d 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityFallingStar.java +++ b/src/main/java/vazkii/botania/common/entity/EntityFallingStar.java @@ -86,7 +86,7 @@ public class EntityFallingStar extends EntityThrowableCopy { if (pos.getBlockPos() != null) { IBlockState state = world.getBlockState(pos.getBlockPos()); - if(ConfigHandler.blockBreakParticles && !state.getBlock().isAir(state, world, pos.getBlockPos())) + if(ConfigHandler.COMMON.blockBreakParticles.get() && !state.getBlock().isAir(state, world, pos.getBlockPos())) world.playEvent(2001, pos.getBlockPos(), Block.getStateId(state)); } diff --git a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java index 584de7a14..5380c3edd 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java +++ b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java @@ -356,7 +356,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { this.noParticles = noParticles; int iterations = 0; - while(isAlive() && iterations < ConfigHandler.spreaderTraceTime) { + while(isAlive() && iterations < ConfigHandler.COMMON.spreaderTraceTime.get()) { tick(); iterations++; } @@ -469,7 +469,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { if(monocle) Botania.proxy.setWispFXDepthTest(false); - if(ConfigHandler.subtlePowerSystem) + if(ConfigHandler.CLIENT.subtlePowerSystem.get()) Botania.proxy.wispFX(posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F); else { float or = r; @@ -568,7 +568,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { alreadyCollidedAt.add(rtr.getBlockPos()); if(dead && isAlive()) { - if(!fake) { + if(!fake && world.isRemote) { Color color = new Color(getColor()); float r = color.getRed() / 255F; float g = color.getGreen() / 255F; @@ -578,7 +578,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { int maxMana = getStartingMana(); float size = (float) mana / (float) maxMana; - if(!ConfigHandler.subtlePowerSystem) + if(!ConfigHandler.CLIENT.subtlePowerSystem.get()) for(int i = 0; i < 4; i++) Botania.proxy.wispFX(posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F); Botania.proxy.sparkleFX((float) posX, (float) posY, (float) posZ, r, g, b, 4, 2); @@ -774,7 +774,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { } protected boolean shouldDoFakeParticles() { - if (ConfigHandler.staticWandBeam) + if (ConfigHandler.CLIENT.staticWandBeam.get()) return true; TileEntity tile = getShooter(); diff --git a/src/main/java/vazkii/botania/common/item/ItemEnderHand.java b/src/main/java/vazkii/botania/common/item/ItemEnderHand.java index 1519c23ea..41035d117 100644 --- a/src/main/java/vazkii/botania/common/item/ItemEnderHand.java +++ b/src/main/java/vazkii/botania/common/item/ItemEnderHand.java @@ -55,7 +55,7 @@ public class ItemEnderHand extends ItemMod implements IManaUsingItem, IBlockProv @Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { - if(ConfigHandler.enderPickpocketEnabled && entity instanceof EntityPlayer && ManaItemHandler.requestManaExact(stack, player, COST_OTHER, false)) { + if(ConfigHandler.COMMON.enderPickpocketEnabled.get() && entity instanceof EntityPlayer && ManaItemHandler.requestManaExact(stack, player, COST_OTHER, false)) { if(!player.world.isRemote) player.displayGUIChest(((EntityPlayer) entity).getInventoryEnderChest()); ManaItemHandler.requestManaExact(stack, player, COST_OTHER, true); diff --git a/src/main/java/vazkii/botania/common/item/ItemTwigWand.java b/src/main/java/vazkii/botania/common/item/ItemTwigWand.java index b547b93a7..bccdc465e 100644 --- a/src/main/java/vazkii/botania/common/item/ItemTwigWand.java +++ b/src/main/java/vazkii/botania/common/item/ItemTwigWand.java @@ -126,7 +126,7 @@ public class ItemTwigWand extends ItemMod implements ICoordBoundItem { } } - if(block == Blocks.LAPIS_BLOCK && ConfigHandler.enchanterEnabled) { + if(block == Blocks.LAPIS_BLOCK && ConfigHandler.COMMON.enchanterEnabled.get()) { EnumFacing.Axis axis = null; if(TileEnchanter.canEnchanterExist(world, pos, EnumFacing.Axis.X)) axis = EnumFacing.Axis.X; diff --git a/src/main/java/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java b/src/main/java/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java index 772f96bc5..dad4899c0 100644 --- a/src/main/java/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java @@ -98,7 +98,7 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr sig.addTooltip(par1ItemStack, world, stacks); - if(ConfigHandler.referencesEnabled) { + if(ConfigHandler.CLIENT.referencesEnabled.get()) { String refUnlocalized = sig.getUnlocalizedLoreTextForStack(par1ItemStack); String refLocalized = I18n.format(refUnlocalized); if(!refLocalized.equals(refUnlocalized)) diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/elementium/ItemElementiumArmor.java b/src/main/java/vazkii/botania/common/item/equipment/armor/elementium/ItemElementiumArmor.java index 154f7513c..3938bc6cc 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/elementium/ItemElementiumArmor.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/elementium/ItemElementiumArmor.java @@ -35,7 +35,7 @@ public abstract class ItemElementiumArmor extends ItemManasteelArmor implements @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_ELEMENTIUM_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_ELEMENTIUM_1 : LibResources.MODEL_ELEMENTIUM_0; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_ELEMENTIUM_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_ELEMENTIUM_1 : LibResources.MODEL_ELEMENTIUM_0; } static ItemStack[] armorset; diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/manasteel/ItemManasteelArmor.java b/src/main/java/vazkii/botania/common/item/equipment/armor/manasteel/ItemManasteelArmor.java index 760aad018..b5c0ca3d9 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/manasteel/ItemManasteelArmor.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/manasteel/ItemManasteelArmor.java @@ -95,13 +95,13 @@ public class ItemManasteelArmor extends ItemArmor implements IManaUsingItem, IPh } public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_MANASTEEL_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0; } @Override @OnlyIn(Dist.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped original) { - if(ConfigHandler.enableArmorModels) { + if(ConfigHandler.CLIENT.enableArmorModels.get()) { ModelBiped model = getArmorModelForSlot(entityLiving, itemStack, armorSlot); if(model == null) model = provideArmorModelForSlot(itemStack, armorSlot); diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/manaweave/ItemManaweaveArmor.java b/src/main/java/vazkii/botania/common/item/equipment/armor/manaweave/ItemManaweaveArmor.java index 37974feb5..ff28e0feb 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/manaweave/ItemManaweaveArmor.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/manaweave/ItemManaweaveArmor.java @@ -49,7 +49,7 @@ public class ItemManaweaveArmor extends ItemManasteelArmor { @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? ClientProxy.jingleTheBells ? LibResources.MODEL_MANAWEAVE_NEW_HOLIDAY : LibResources.MODEL_MANAWEAVE_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANAWEAVE_1 : LibResources.MODEL_MANAWEAVE_0; + return ConfigHandler.CLIENT.enableArmorModels.get() ? ClientProxy.jingleTheBells ? LibResources.MODEL_MANAWEAVE_NEW_HOLIDAY : LibResources.MODEL_MANAWEAVE_NEW : slot == EntityEquipmentSlot.LEGS ? LibResources.MODEL_MANAWEAVE_1 : LibResources.MODEL_MANAWEAVE_0; } @Nonnull diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelArmor.java b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelArmor.java index adbf8ba4f..fc3915d42 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelArmor.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelArmor.java @@ -48,7 +48,7 @@ public class ItemTerrasteelArmor extends ItemManasteelArmor { @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_TERRASTEEL_NEW : slot == EntityEquipmentSlot.CHEST ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_TERRASTEEL_NEW : slot == EntityEquipmentSlot.CHEST ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0; } @Nonnull diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index 78b28c7c5..6c2b976df 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -483,9 +483,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub mc.textureManager.bindTexture(textureHud); int xo = mc.mainWindow.getScaledWidth() / 2 + 10; int x = xo; - int y = mc.mainWindow.getScaledHeight() - ConfigHandler.flightBarHeight; + int y = mc.mainWindow.getScaledHeight() - ConfigHandler.CLIENT.flightBarHeight.get(); if(player.areEyesInFluid(FluidTags.WATER)) - y = mc.mainWindow.getScaledHeight() - ConfigHandler.flightBarBreathHeight; + y = mc.mainWindow.getScaledHeight() - ConfigHandler.CLIENT.flightBarBreathHeight.get(); int left = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME); diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java index 0234a9b6b..d302f1151 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java @@ -84,7 +84,7 @@ public class ItemMagnetRing extends ItemBauble { } if(cooldown <= 0) { - if(player.isSneaking() == ConfigHandler.invertMagnetRing) { + if(player.isSneaking() == ConfigHandler.COMMON.invertMagnetRing.get()) { double x = player.posX; double y = player.posY + 0.75; double z = player.posZ; diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java b/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java index 3f2021430..f952eacca 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java @@ -104,7 +104,7 @@ public final class ToolCommons { damageItem(stack, 1, player, 80); } else world.removeBlock(pos); - if(particles && ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool) + if(particles && ConfigHandler.COMMON.blockBreakParticles.get() && ConfigHandler.COMMON.blockBreakParticlesTool.get()) world.playEvent(2001, pos, Block.getStateId(state)); } } diff --git a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemElementiumHelmRevealing.java b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemElementiumHelmRevealing.java index 0a68281da..7444eb727 100644 --- a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemElementiumHelmRevealing.java +++ b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemElementiumHelmRevealing.java @@ -26,7 +26,7 @@ public class ItemElementiumHelmRevealing extends ItemElementiumHelm { @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_ELEMENTIUM_NEW : LibResources.MODEL_ELEMENTIUM_2; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_ELEMENTIUM_NEW : LibResources.MODEL_ELEMENTIUM_2; } } diff --git a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemManasteelHelmRevealing.java b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemManasteelHelmRevealing.java index e2106e9fc..b24237a0a 100644 --- a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemManasteelHelmRevealing.java +++ b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemManasteelHelmRevealing.java @@ -26,7 +26,7 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm { @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_MANASTEEL_NEW : LibResources.MODEL_MANASTEEL_2; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_MANASTEEL_NEW : LibResources.MODEL_MANASTEEL_2; } } \ No newline at end of file diff --git a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemTerrasteelHelmRevealing.java b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemTerrasteelHelmRevealing.java index 1268e6d1f..9807d4071 100644 --- a/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemTerrasteelHelmRevealing.java +++ b/src/main/java/vazkii/botania/common/item/interaction/thaumcraft/ItemTerrasteelHelmRevealing.java @@ -26,7 +26,7 @@ public class ItemTerrasteelHelmRevealing extends ItemTerrasteelHelm { @Override public String getArmorTextureAfterInk(ItemStack stack, EntityEquipmentSlot slot) { - return ConfigHandler.enableArmorModels ? LibResources.MODEL_TERRASTEEL_NEW : LibResources.MODEL_TERRASTEEL_2; + return ConfigHandler.CLIENT.enableArmorModels.get() ? LibResources.MODEL_TERRASTEEL_NEW : LibResources.MODEL_TERRASTEEL_2; } } \ No newline at end of file diff --git a/src/main/java/vazkii/botania/common/item/lens/LensMine.java b/src/main/java/vazkii/botania/common/item/lens/LensMine.java index fad986a7a..56930bb8f 100644 --- a/src/main/java/vazkii/botania/common/item/lens/LensMine.java +++ b/src/main/java/vazkii/botania/common/item/lens/LensMine.java @@ -45,7 +45,7 @@ public class LensMine extends Lens { if(warp && (block == ModBlocks.pistonRelay || block == Blocks.PISTON || block == Blocks.MOVING_PISTON || block == Blocks.PISTON_HEAD)) return false; - int harvestLevel = ConfigHandler.harvestLevelBore; + int harvestLevel = ConfigHandler.COMMON.harvestLevelBore.get(); TileEntity tile = world.getTileEntity(collidePos); @@ -62,7 +62,7 @@ public class LensMine extends Lens { float chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, world, collidePos, state, 0, 1.0f, false, null); world.removeBlock(collidePos); - if(ConfigHandler.blockBreakParticles) + if(ConfigHandler.COMMON.blockBreakParticles.get()) world.playEvent(2001, collidePos, Block.getStateId(state)); boolean offBounds = source.getY() < 0; diff --git a/src/main/java/vazkii/botania/common/item/lens/LensWeight.java b/src/main/java/vazkii/botania/common/item/lens/LensWeight.java index 66c14d14b..830653260 100644 --- a/src/main/java/vazkii/botania/common/item/lens/LensWeight.java +++ b/src/main/java/vazkii/botania/common/item/lens/LensWeight.java @@ -31,7 +31,7 @@ public class LensWeight extends Lens { @Override public boolean collideBurst(IManaBurst burst, EntityThrowable entity, RayTraceResult pos, boolean isManaBlock, boolean dead, ItemStack stack) { if(!entity.world.isRemote && !burst.isFake() && pos.type == RayTraceResult.Type.BLOCK) { - int harvestLevel = ConfigHandler.harvestLevelWeight; + int harvestLevel = ConfigHandler.COMMON.harvestLevelWeight.get(); BlockPos bPos = pos.getBlockPos(); Block block = entity.world.getBlockState(bPos).getBlock(); diff --git a/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java b/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java index 88f12738a..133916f2c 100644 --- a/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java +++ b/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java @@ -43,7 +43,7 @@ public class ItemOdinRing extends ItemRelicBauble { damageNegations.add(DamageSource.DROWN.damageType); damageNegations.add(DamageSource.FALL.damageType); damageNegations.add(DamageSource.LAVA.damageType); - if(ConfigHandler.ringOfOdinFireResist) { + if(ConfigHandler.COMMON.ringOfOdinFireResist.get()) { damageNegations.add(DamageSource.IN_FIRE.damageType); damageNegations.add(DamageSource.ON_FIRE.damageType); } @@ -54,7 +54,7 @@ public class ItemOdinRing extends ItemRelicBauble { @Override public void onValidPlayerWornTick(ItemStack stack, EntityPlayer player) { - if(player.isBurning() && ConfigHandler.ringOfOdinFireResist) + if(player.isBurning() && ConfigHandler.COMMON.ringOfOdinFireResist.get()) player.extinguish(); } diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index bbef25eff..98928dbfe 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -443,7 +443,7 @@ public final class LexiconData { sparkUpgrades.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipesSparkUpgrades)); - if (ConfigHandler.fluxfieldEnabled) { + if (ConfigHandler.COMMON.fluxfieldEnabled.get()) { rfGenerator = new BasicLexiconEntry(LibLexicon.MANA_RF_GENERATOR, categoryMana); rfGenerator.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeRFGenerator)); @@ -568,7 +568,7 @@ public final class LexiconData { orechidIgnem = new AlfheimLexiconEntry(LibLexicon.FFLOWER_ORECHID_IGNEM, categoryFunctionalFlowers); orechidIgnem.setLexiconPages(new PageText("0"), new PagePetalRecipe<>("1", ModPetalRecipes.orechidIgnemRecipe)); - if (ConfigHandler.fallenKanadeEnabled) { + if (ConfigHandler.COMMON.fallenKanadeEnabled.get()) { fallenKanade = new BasicLexiconEntry(LibLexicon.FFLOWER_FALLEN_KANADE, categoryFunctionalFlowers); fallenKanade.setLexiconPages(new PageText(Botania.bloodMagicLoaded ? "0a" : "0"), new PagePetalRecipe<>("1", ModPetalRecipes.fallenKanadeRecipe)); @@ -689,7 +689,7 @@ public final class LexiconData { pylon = new BasicLexiconEntry(LibLexicon.DEVICE_PYLON, categoryDevices); pylon.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipePylon)); - if (ConfigHandler.enchanterEnabled) { + if (ConfigHandler.COMMON.enchanterEnabled.get()) { manaEnchanting = new BasicLexiconEntry(LibLexicon.DEVICE_MANA_ENCHANTING, categoryDevices); manaEnchanting .setLexiconPages(new PageText("0"), new PageText("1"), @@ -1057,8 +1057,8 @@ public final class LexiconData { new PageManaInfusionRecipe("2", ModManaInfusionRecipes.pistonRelayRecipe)); enderHand = new BasicLexiconEntry(LibLexicon.ENDER_ENDER_HAND, categoryEnder); - enderHand.setLexiconPages(new PageText(ConfigHandler.enderPickpocketEnabled ? "0" : "0a"), new PageText("2"), - new PageCraftingRecipe(ConfigHandler.enderPickpocketEnabled ? "1" : "1a", + enderHand.setLexiconPages(new PageText(ConfigHandler.COMMON.enderPickpocketEnabled.get() ? "0" : "0a"), new PageText("2"), + new PageCraftingRecipe(ConfigHandler.COMMON.enderPickpocketEnabled.get() ? "1" : "1a", ModCraftingRecipes.recipeEnderHand)); enderDagger = new BasicLexiconEntry(LibLexicon.ENDER_ENDER_DAGGER, categoryEnder); @@ -1299,7 +1299,7 @@ public final class LexiconData { new PageLoreText("4"), new PageLoreText("5"), new PageLoreText("6"), new PageLoreText("7")) .setIcon(new ItemStack(Items.WRITABLE_BOOK)); - if (ConfigHandler.relicsEnabled) { + if (ConfigHandler.COMMON.relicsEnabled.get()) { relics = new AlfheimLexiconEntry(LibLexicon.ALF_RELICS, categoryAlfhomancy); relics.setLexiconPages(new PageText("0")).setIcon(new ItemStack(ModItems.dice)); @@ -1407,7 +1407,7 @@ public final class LexiconData { if (Botania.thaumcraftLoaded) { tcIntegration = new CompatLexiconEntry(LibLexicon.MISC_TC_INTEGRATION, BotaniaAPI.categoryMisc, "Thaumcraft"); - if (ConfigHandler.enableThaumcraftStablizers) + if (ConfigHandler.COMMON.enableThaumcraftStablizers.get()) tcIntegration.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeHelmetOfRevealing), new PageText("3"), new PageManaInfusionRecipe("4", ModManaInfusionRecipes.manaInkwellRecipe), new PageText("5"), diff --git a/src/main/java/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java b/src/main/java/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java index 0e2ac1daf..3ad02a099 100644 --- a/src/main/java/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java +++ b/src/main/java/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java @@ -75,11 +75,8 @@ public class PageManaInfusionRecipe extends PageRecipe { TextureManager render = Minecraft.getInstance().textureManager; FontRenderer font = Minecraft.getInstance().fontRenderer; - Object input = recipe.getInput(); - if(input instanceof String) - input = OreDictionary.getOres((String) input).get(0); - - renderItemAtGridPos(gui, 1, 1, (ItemStack) input, false); + if(recipe.getInput().getMatchingStacks().length > 0) + renderItemAtGridPos(gui, 1, 1, recipe.getInput().getMatchingStacks()[0], false); renderItemAtGridPos(gui, 2, 1, renderStack, false); diff --git a/src/main/java/vazkii/botania/common/lexicon/page/PagePetalRecipe.java b/src/main/java/vazkii/botania/common/lexicon/page/PagePetalRecipe.java index af8554810..fb9363cd9 100644 --- a/src/main/java/vazkii/botania/common/lexicon/page/PagePetalRecipe.java +++ b/src/main/java/vazkii/botania/common/lexicon/page/PagePetalRecipe.java @@ -71,7 +71,7 @@ public class PagePetalRecipe extends PageRecipe { List inputs = recipe.getInputs(); int degreePerInput = (int) (360F / inputs.size()); - float currentDegree = ConfigHandler.lexiconRotatingItems ? GuiScreen.isShiftKeyDown() ? ticksElapsed : ticksElapsed + ClientTickHandler.partialTicks : 0; + float currentDegree = ConfigHandler.CLIENT.lexiconRotatingItems.get() ? GuiScreen.isShiftKeyDown() ? ticksElapsed : ticksElapsed + ClientTickHandler.partialTicks : 0; int inputIndex = ticksElapsed / 40; for(Object obj : inputs) { diff --git a/src/main/java/vazkii/botania/common/lexicon/page/PageText.java b/src/main/java/vazkii/botania/common/lexicon/page/PageText.java index 0bc6f29e3..909f1e6f2 100644 --- a/src/main/java/vazkii/botania/common/lexicon/page/PageText.java +++ b/src/main/java/vazkii/botania/common/lexicon/page/PageText.java @@ -87,7 +87,7 @@ public class PageText extends LexiconPage { int spacing = 4; int wcount = words.size(); int compensationSpaces = 0; - boolean justify = ConfigHandler.lexiconJustifiedText && wcount > 0 && lines.size() > i && !lines.get(i + 1).isEmpty(); + boolean justify = ConfigHandler.CLIENT.lexiconJustifiedText.get() && wcount > 0 && lines.size() > i && !lines.get(i + 1).isEmpty(); if(justify) { String s = Joiner.on("").join(words);