MCPF config/mixins cleanup (#130)

* cleanup ctm/ cc mixins

* use @Share more

* migrate to forge based config
This commit is contained in:
mist475 authored and GitHub committed 2024-01-04 19:25:57 -08:00
1 parent 73c7ca94e1
commit 98b707e3e3
47 files changed
+643 -442

No files matched your search

@@ -3,9 +3,8 @@ package com.gtnewhorizons.angelica.mixins;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import java.util.ArrayList;
import java.util.Arrays;
@@ -221,7 +220,7 @@ public enum Mixins {
NOTFINE_FEATURES_NO_MCPF_CIT(new Builder("NotFine Features which clash with mcpf cit (compat handled in MCPF_NF mixin)").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
!(AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
!(AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
).addMixinClasses(
"notfine.glint.MixinItemRenderer",
"notfine.glint.MixinRenderItemGlint"
@@ -246,7 +245,7 @@ public enum Mixins {
MCPATCHERFORGE_NOTFINE_COMPAT(new Builder("Notfine features and MCPF features where the 2 would clash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
AngelicaConfig.enableMCPatcherForgeFeatures &&
Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addMixinClasses(addPrefix(
"notfine_mcpf_compat.",
"MixinRenderItem",
@@ -279,7 +278,7 @@ public enum Mixins {
MCPATCHERFORGE_CUSTOM_COLOURS(new Builder("Custom colors").setSide(Mixins.Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
@@ -336,7 +335,7 @@ public enum Mixins {
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES(new Mixins.Builder("Custom Item Textures").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
@@ -353,7 +352,7 @@ public enum Mixins {
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES_NO_NF(new Mixins.Builder("Custom Item Textures without notfine features").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)) && !AngelicaConfig.enableNotFineFeatures)
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled) && !AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix(
"mcpatcherforge.cit.client.renderer.",
@@ -363,20 +362,20 @@ public enum Mixins {
MCPATCHERFORGE_CONNECTED_TEXTURES(new Builder("Connected Textures").setSide(Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().connectedTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")),
MCPATCHERFORGE_EXTENDED_HD(new Builder("Extended hd").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix("mcpatcherforge.hd.", "MixinFontRenderer", "MixinTextureClock", "MixinTextureCompass", "MixinTextureManager"))),
MCPATCHERFORGE_RANDOM_MOBS(new Builder("Random Mobs").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().randomMobsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
@@ -394,18 +393,46 @@ public enum Mixins {
MCPATCHERFORGE_SKY(new Builder("Sky").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.BETTER_SKIES, "enabled", true))
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().betterSkiesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.sky.", "MixinEffectRenderer", "MixinRenderGlobal"
))),
MCPATCHERFORGE_CC_NO_CTM(new Builder("Custom colors, no connected textures").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (!MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCTM")),
MCPATCHERFORGE_CTM_AND_CC(new Builder("Connected textures and Custom Colors enabled").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks")),
MCPATCHERFORGE_CTM_NO_CC(new Builder("Connected textures, no custom colours").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& !MCPatcherForgeConfig.instance().customColorsEnabled))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC")),
MCPATCHERFORGE_CTM_OR_CC(new Builder("Connected textures or Custom Colors enabled").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures && Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)
|| Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true))
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (MCPatcherForgeConfig.instance().connectedTexturesEnabled
|| MCPatcherForgeConfig.instance().customColorsEnabled))
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.ctm_cc.", "MixinRenderBlocks", "MixinTextureMap")))
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap")),
;
@@ -22,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.google.common.collect.Multimap;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.cc.Colorizer;
import com.prupe.mcpatcher.cit.CITUtils;
@@ -32,6 +31,8 @@ import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import com.prupe.mcpatcher.mal.tile.TileLoader;
import com.prupe.mcpatcher.mob.MobRandomizer;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
@@ -60,16 +61,17 @@ public abstract class MixinMinecraft {
private void modifyStartGame1(CallbackInfo ci) {
TileLoader.init();
CTMUtils.reset();
if (Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enabled", true)) {
MCPatcherForgeConfig config = MCPatcherForgeConfig.instance();
if (config.customItemTexturesEnabled) {
CITUtils.init();
}
if (Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "enabled", true)) {
if (config.extendedHDEnabled) {
FontUtils.init();
}
if (Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "enabled", true)) {
if (config.randomMobsEnabled) {
MobRandomizer.init();
}
if (Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true)) {
if (config.customColorsEnabled) {
Colorizer.init();
}
}
@@ -22,6 +22,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef;
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
import com.prupe.mcpatcher.cc.ColorizeBlock;
import com.prupe.mcpatcher.cc.Colorizer;
import com.prupe.mcpatcher.mal.block.RenderBlocksUtils;
@@ -64,20 +67,6 @@ public abstract class MixinRenderBlocks {
@Shadow
public abstract boolean hasOverrideBlockTexture();
// Compute values once and reuse later
@Unique
private boolean mcpatcherforge$computeRedstoneWireColor;
@Unique
private float mcpatcherforge$redstoneWireColorRed;
@Unique
private float mcpatcherforge$redstoneWireColorGreen;
@Unique
private float mcpatcherforge$redstoneWireColorBlue;
@Unique
private void mcpatcherforge$setColorAndVertex(Tessellator tessellator, float red, float green, float blue, double x,
double y, double z, double u, double v) {
@@ -112,12 +101,14 @@ public abstract class MixinRenderBlocks {
@Inject(method = "renderBlockRedstoneWire(Lnet/minecraft/block/Block;III)Z", at = @At("HEAD"))
private void calculateComputeRedstoneWireColor(Block block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
this.mcpatcherforge$computeRedstoneWireColor = ColorizeBlock
.computeRedstoneWireColor(this.blockAccess.getBlockMetadata(x, y, z));
this.mcpatcherforge$redstoneWireColorRed = Math.max(Colorizer.setColor[0], 0.0f);
this.mcpatcherforge$redstoneWireColorGreen = Math.max(Colorizer.setColor[1], 0.0f);
this.mcpatcherforge$redstoneWireColorBlue = Math.max(Colorizer.setColor[2], 0.0f);
CallbackInfoReturnable<Boolean> cir,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
computeRedstoneWireColor
.set(ColorizeBlock.computeRedstoneWireColor(this.blockAccess.getBlockMetadata(x, y, z)));
red.set(Math.max(Colorizer.setColor[0], 0.0f));
green.set(Math.max(Colorizer.setColor[1], 0.0f));
blue.set(Math.max(Colorizer.setColor[2], 0.0f));
}
@ModifyArgs(
@@ -126,11 +117,13 @@ public abstract class MixinRenderBlocks {
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 0))
private void modifyColorRedstoneWire1(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
private void modifyColorRedstoneWire1(Args args,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
if (computeRedstoneWireColor.get()) {
args.set(0, red.get());
args.set(1, green.get());
args.set(2, blue.get());
}
}
@@ -140,11 +133,13 @@ public abstract class MixinRenderBlocks {
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 4))
private void modifyColorRedstoneWire2(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
private void modifyColorRedstoneWire2(Args args,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
if (computeRedstoneWireColor.get()) {
args.set(0, red.get());
args.set(1, green.get());
args.set(2, blue.get());
}
}
@@ -154,11 +149,13 @@ public abstract class MixinRenderBlocks {
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 6))
private void modifyColorRedstoneWire3(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
private void modifyColorRedstoneWire3(Args args,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
if (computeRedstoneWireColor.get()) {
args.set(0, red.get());
args.set(1, green.get());
args.set(2, blue.get());
}
}
@@ -168,11 +165,13 @@ public abstract class MixinRenderBlocks {
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 8))
private void modifyColorRedstoneWire4(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
private void modifyColorRedstoneWire4(Args args,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
if (computeRedstoneWireColor.get()) {
args.set(0, red.get());
args.set(1, green.get());
args.set(2, blue.get());
}
}
@@ -182,11 +181,13 @@ public abstract class MixinRenderBlocks {
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 10))
private void modifyColorRedstoneWire5(Args args) {
if (this.mcpatcherforge$computeRedstoneWireColor) {
args.set(0, this.mcpatcherforge$redstoneWireColorRed);
args.set(1, this.mcpatcherforge$redstoneWireColorGreen);
args.set(2, this.mcpatcherforge$redstoneWireColorBlue);
private void modifyColorRedstoneWire5(Args args,
@Share("computeRedstoneWireColor") LocalBooleanRef computeRedstoneWireColor, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
if (computeRedstoneWireColor.get()) {
args.set(0, red.get());
args.set(1, green.get());
args.set(2, blue.get());
}
}
@@ -5,27 +5,26 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(World.class)
public abstract class MixinWorld {
@Unique
private boolean mcpatcher_forge$computeSkyColor;
@Inject(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At("HEAD"),
remap = false)
private void modifyGetSkyColorBody1(Entity entity, float p_72833_2_, CallbackInfoReturnable<Vec3> cir) {
this.mcpatcher_forge$computeSkyColor = ColorizeWorld.computeSkyColor((World) (Object) this, p_72833_2_);
private void modifyGetSkyColorBody1(Entity entity, float p_72833_2_, CallbackInfoReturnable<Vec3> cir,
@Share("computeSkyColor") LocalBooleanRef computeSkyColor) {
computeSkyColor.set(ColorizeWorld.computeSkyColor((World) (Object) this, p_72833_2_));
}
@Inject(
@@ -45,8 +44,8 @@ public abstract class MixinWorld {
at = @At(value = "STORE", ordinal = 0),
ordinal = 3,
remap = false)
private float modifyGetSkyColorBody3(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
private float modifyGetSkyColorBody3(float input, @Share("computeSkyColor") LocalBooleanRef computeSkyColor) {
if (computeSkyColor.get()) {
return Colorizer.setColor[0];
}
return input;
@@ -58,21 +57,20 @@ public abstract class MixinWorld {
at = @At(value = "STORE", ordinal = 0),
ordinal = 4,
remap = false)
private float modifyGetSkyColorBody4(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
private float modifyGetSkyColorBody4(float input, @Share("computeSkyColor") LocalBooleanRef computeSkyColor) {
if (computeSkyColor.get()) {
return Colorizer.setColor[1];
}
return input;
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
at = @At(value = "STORE", ordinal = 0),
ordinal = 5,
remap = false)
private float modifyGetSkyColorBody5(float input) {
if (this.mcpatcher_forge$computeSkyColor) {
private float modifyGetSkyColorBody5(float input, @Share("computeSkyColor") LocalBooleanRef computeSkyColor) {
if (computeSkyColor.get()) {
return Colorizer.setColor[2];
}
return input;
@@ -4,39 +4,37 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.cc.Colorizer;
@Mixin(WorldProvider.class)
public abstract class MixinWorldProvider {
@Unique
private boolean mcpatcher_forge$computeFogColor;
@Inject(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", at = @At("HEAD"))
private void modifyGetFogColor1(float celestialAngle, float renderPartialTicks, CallbackInfoReturnable<Vec3> cir) {
this.mcpatcher_forge$computeFogColor = ColorizeWorld
.computeFogColor((WorldProvider) (Object) this, celestialAngle);
private void modifyGetFogColor1(float celestialAngle, float renderPartialTicks, CallbackInfoReturnable<Vec3> cir,
@Share("computeFogColor") LocalBooleanRef computeFogColor) {
computeFogColor.set(ColorizeWorld.computeFogColor((WorldProvider) (Object) this, celestialAngle));
}
@ModifyConstant(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", constant = @Constant(floatValue = 0.7529412F))
private float modifyGetFogColor1(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
private float modifyGetFogColor1(float constant, @Share("computeFogColor") LocalBooleanRef computeFogColor) {
if (computeFogColor.get()) {
return Colorizer.setColor[0];
}
return constant;
}
@ModifyConstant(method = "getFogColor(FF)Lnet/minecraft/util/Vec3;", constant = @Constant(floatValue = 0.84705883F))
private float modifyGetFogColor2(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
private float modifyGetFogColor2(float constant, @Share("computeFogColor") LocalBooleanRef computeFogColor) {
if (computeFogColor.get()) {
return Colorizer.setColor[1];
}
return constant;
@@ -45,8 +43,8 @@ public abstract class MixinWorldProvider {
@ModifyConstant(
method = "getFogColor(FF)Lnet/minecraft/util/Vec3;",
constant = @Constant(floatValue = 1.0F, ordinal = 2))
private float modifyGetFogColor3(float constant) {
if (this.mcpatcher_forge$computeFogColor) {
private float modifyGetFogColor3(float constant, @Share("computeFogColor") LocalBooleanRef computeFogColor) {
if (computeFogColor.get()) {
return Colorizer.setColor[2];
}
return constant;
@@ -12,9 +12,13 @@ import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.prupe.mcpatcher.cc.ColorizeBlock;
// TODO: split ctm // cc use and migrate to MixinRenderBlocks & MixinRenderBlocksCC
// Only loaded when both cc and ctm are enabled
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@@ -50,11 +54,26 @@ public abstract class MixinRenderBlocks {
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 0))
private IIcon mcpatcherforge$obtainFloatsAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z) {
int meta, Block specializedBlock, int x, int y, int z, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
int l = block.colorMultiplier(this.blockAccess, x, y, z);
this.mcpatcherforge$neededFloat1 = (float) (l >> 16 & 255) / 255.0F;
this.mcpatcherforge$neededFloat2 = (float) (l >> 8 & 255) / 255.0F;
this.mcpatcherforge$neededFloat3 = (float) (l & 255) / 255.0F;
red.set((float) (l >> 16 & 255) / 255.0F);
blue.set((float) (l >> 8 & 255) / 255.0F);
green.set((float) (l & 255) / 255.0F);
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
// Capture needed value
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 2))
private IIcon mcpatcherforge$saveSideAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z, @Share("requiredSide") LocalIntRef requiredSide) {
requiredSide.set(side);
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
@@ -66,7 +85,7 @@ public abstract class MixinRenderBlocks {
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 2))
private void mcpatcherforge$redirectColor10(Tessellator tessellator, float red, float green, float blue,
Block block, int x, int y, int z) {
Block block, int x, int y, int z, @Share("requiredSide") LocalIntRef requiredSide) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock.setupBlockSmoothing(
(RenderBlocks) (Object) this,
block,
@@ -74,25 +93,11 @@ public abstract class MixinRenderBlocks {
x,
y,
z,
this.mcpatcherforge$neededSideRenderBlockLiquid + 6))) {
requiredSide.get() + 6))) {
tessellator.setColorOpaque_F(red, green, blue);
}
}
// Capture needed value
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 2))
private IIcon mcpatcherforge$saveSideAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z) {
this.mcpatcherforge$neededSideRenderBlockLiquid = side;
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
@@ -100,13 +105,11 @@ public abstract class MixinRenderBlocks {
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 1))
private void mcpatcherforge$redirectColor9(Tessellator tessellator, float red, float green, float blue, Block block,
int x, int y, int z) {
int x, int y, int z, @Share("red") LocalFloatRef redLocal, @Share("green") LocalFloatRef greenLocal,
@Share("blue") LocalFloatRef blueLocal) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, x, y, z, 6))) {
tessellator.setColorOpaque_F(
red * this.mcpatcherforge$neededFloat1,
green * this.mcpatcherforge$neededFloat2,
blue * this.mcpatcherforge$neededFloat3);
tessellator.setColorOpaque_F(red * redLocal.get(), green * blueLocal.get(), blue * blueLocal.get());
}
if (ColorizeBlock.isSmooth) {
this.enableAO = true;
@@ -0,0 +1,47 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.ctm_cc;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocksNoCC {
@Shadow
public IBlockAccess blockAccess;
@Shadow
public abstract IIcon getBlockIcon(Block block, IBlockAccess access, int x, int y, int z, int side);
@Shadow
public abstract IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta);
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 0))
private IIcon mcpatcherforge$redirectToGetBlockIcon(RenderBlocks instance, Block block, int side, int meta,
Block specializedBlock, int x, int y, int z) {
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 2))
private IIcon mcpatcherforge$saveSideAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z) {
return (this.blockAccess == null) ? this.getBlockIconFromSideAndMetadata(block, side, meta)
: this.getBlockIcon(block, this.blockAccess, x, y, z, side);
}
}
@@ -0,0 +1,99 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.ctm_cc;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.prupe.mcpatcher.cc.ColorizeBlock;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocksNoCTM {
@Shadow
public IBlockAccess blockAccess;
@Shadow
public boolean enableAO;
@Shadow
public abstract IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta);
// Redirect calls to this.getBlockIcon when possible
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 0))
private IIcon mcpatcherforge$obtainFloatsAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z, @Share("red") LocalFloatRef red,
@Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) {
int l = block.colorMultiplier(this.blockAccess, x, y, z);
red.set((float) (l >> 16 & 255) / 255.0F);
blue.set((float) (l >> 8 & 255) / 255.0F);
green.set((float) (l & 255) / 255.0F);
return this.getBlockIconFromSideAndMetadata(block, side, meta);
}
// Capture needed value
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSideAndMetadata(Lnet/minecraft/block/Block;II)Lnet/minecraft/util/IIcon;",
ordinal = 2))
private IIcon mcpatcherforge$saveSideAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side,
int meta, Block specializedBlock, int x, int y, int z, @Share("requiredSide") LocalIntRef requiredSide) {
requiredSide.set(side);
return this.getBlockIconFromSideAndMetadata(block, side, meta);
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 2))
private void mcpatcherforge$redirectColor10(Tessellator tessellator, float red, float green, float blue,
Block block, int x, int y, int z, @Share("requiredSide") LocalIntRef requiredSide) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock.setupBlockSmoothing(
(RenderBlocks) (Object) this,
block,
this.blockAccess,
x,
y,
z,
requiredSide.get() + 6))) {
tessellator.setColorOpaque_F(red, green, blue);
}
}
@Redirect(
method = "renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setColorOpaque_F(FFF)V",
ordinal = 1))
private void mcpatcherforge$redirectColor9(Tessellator tessellator, float red, float green, float blue, Block block,
int x, int y, int z, @Share("red") LocalFloatRef redLocal, @Share("green") LocalFloatRef greenLocal,
@Share("blue") LocalFloatRef blueLocal) {
if (!(ColorizeBlock.isSmooth = ColorizeBlock
.setupBlockSmoothing((RenderBlocks) (Object) this, block, this.blockAccess, x, y, z, 6))) {
tessellator.setColorOpaque_F(red * redLocal.get(), green * blueLocal.get(), blue * blueLocal.get());
}
if (ColorizeBlock.isSmooth) {
this.enableAO = true;
}
}
}
@@ -24,6 +24,7 @@ public abstract class MixinTextureMap extends AbstractTexture {
@Shadow
@Final
private Map<String, TextureAtlasSprite> mapRegisteredSprites;
@Shadow
@Final
private String basePath;
@@ -20,6 +20,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.hd.FontUtils;
@@ -61,13 +63,6 @@ public abstract class MixinFontRenderer implements FontRendererExpansion {
@Unique
private float mcpatcher_forge$fontAdj;
/**
* for custom text colors the index is required when drawing
* unfortunately capturing locals doesn't work with modifyVariable
*/
@Unique
private int mcpatcher_forge$renderStringAtPosIndex;
public float[] getCharWidthf() {
return mcpatcher_forge$charWidthf;
}
@@ -153,8 +148,9 @@ public abstract class MixinFontRenderer implements FontRendererExpansion {
method = "renderStringAtPos(Ljava/lang/String;Z)V",
locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/FontRenderer;colorCode:[I"))
private void modifyRenderStringAtPos1(String string, boolean bool, CallbackInfo ci, int i, char c0, int j) {
this.mcpatcher_forge$renderStringAtPosIndex = j;
private void modifyRenderStringAtPos1(String string, boolean bool, CallbackInfo ci, int i, char c0, int j,
@Share("renderStringAtPosIndex") LocalIntRef renderStringAtPosIndex) {
renderStringAtPosIndex.set(j);
}
// IDEA plugin really struggles with this for some reason
@@ -163,8 +159,9 @@ public abstract class MixinFontRenderer implements FontRendererExpansion {
method = "renderStringAtPos(Ljava/lang/String;Z)V",
at = @At(value = "STORE", ordinal = 0),
ordinal = 2)
private int modifyRenderStringAtPos2(int color) {
return ColorizeWorld.colorizeText(color, this.mcpatcher_forge$renderStringAtPosIndex);
private int modifyRenderStringAtPos2(int color,
@Share("renderStringAtPosIndex") LocalIntRef renderStringAtPosIndex) {
return ColorizeWorld.colorizeText(color, renderStringAtPosIndex.get());
}
@ModifyVariable(method = "renderString(Ljava/lang/String;IIIZ)I", at = @At("HEAD"), ordinal = 2, argsOnly = true)
@@ -11,9 +11,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.renderpass.RenderPass;
/*
* For readability changes to the biggest methods get their own classes
*/
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@@ -11,7 +11,6 @@ import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -20,6 +19,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.prupe.mcpatcher.sky.FireworksHelper;
@SuppressWarnings({ "rawtypes" })
@@ -29,9 +30,6 @@ public abstract class MixinEffectRenderer {
@Shadow
private List[] fxLayers;
@Unique
private int mcpatcher_forge$renderParticlesIndex;
@Inject(
method = "<init>(Lnet/minecraft/world/World;Lnet/minecraft/client/renderer/texture/TextureManager;)V",
at = @At("RETURN"))
@@ -66,23 +64,24 @@ public abstract class MixinEffectRenderer {
at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z"),
locals = LocalCapture.CAPTURE_FAILHARD)
private void modifyRenderParticles2(Entity player, float partialTickTime, CallbackInfo ci, float f1, float f2,
float f3, float f4, float f5, int k, int i) {
this.mcpatcher_forge$renderParticlesIndex = i;
float f3, float f4, float f5, int k, int i, @Share("renderParticlesIndex") LocalIntRef renderParticlesIndex) {
renderParticlesIndex.set(i);
}
@Redirect(
method = "renderParticles(Lnet/minecraft/entity/Entity;F)V",
at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z"))
private boolean modifyRenderParticles3(List layer) {
return FireworksHelper.skipThisLayer(
this.fxLayers[mcpatcher_forge$renderParticlesIndex].isEmpty(),
this.mcpatcher_forge$renderParticlesIndex);
private boolean modifyRenderParticles3(List layer,
@Share("renderParticlesIndex") LocalIntRef renderParticlesIndex) {
return FireworksHelper
.skipThisLayer(this.fxLayers[renderParticlesIndex.get()].isEmpty(), renderParticlesIndex.get());
}
@Redirect(
method = "renderParticles(Lnet/minecraft/entity/Entity;F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glBlendFunc(II)V", remap = false))
private void modifyRenderParticles4(int sfactor, int dfactor) {
FireworksHelper.setParticleBlendMethod(this.mcpatcher_forge$renderParticlesIndex, 0, true);
private void modifyRenderParticles4(int sfactor, int dfactor,
@Share("renderParticlesIndex") LocalIntRef renderParticlesIndex) {
FireworksHelper.setParticleBlendMethod(renderParticlesIndex.get(), 0, true);
}
}
@@ -1,174 +0,0 @@
package com.prupe.mcpatcher;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.launchwrapper.Launch;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class Config {
private static Config instance;
private static final File configFile = new File(Launch.minecraftHome, "config" + File.separator + "mcpatcher.json");
private Map<String, String> logging;
Map<String, Map<String, String>> profile;
public static Config getInstance() {
if (instance == null) {
loadConfig();
}
return instance;
}
static Level getLogLevel(String category) {
Level level = Level.INFO;
String value = getInstance().logging.get(category);
if (value != null) {
try {
level = Level.parse(
value.trim()
.toUpperCase());
} catch (Throwable e) {}
}
setLogLevel(category, level);
return level;
}
static void setLogLevel(String category, Level level) {
getInstance().logging.put(
category,
level.toString()
.toUpperCase());
}
static void loadConfig() {
Gson gson = new Gson();
try (Reader reader = Files.newBufferedReader(configFile.toPath())) {
instance = gson.fromJson(reader, Config.class);
} catch (IOException e) {
Logger.getLogger("mcpatcher")
.warning("Failed to read mcpatcher json config file, using defaults");
instance = new Config();
if (instance.logging == null) {
instance.logging = new LinkedHashMap<>();
}
if (instance.profile == null) {
instance.profile = new LinkedHashMap<>();
}
saveConfig();
}
}
static void saveConfig() {
Gson gsonBuilder = new GsonBuilder().setPrettyPrinting()
.create();
try (FileWriter writer = new FileWriter(configFile)) {
gsonBuilder.toJson(instance, writer);
} catch (IOException e) {
Logger.getLogger("mcpatcher")
.warning("Failed to save mc patcher config, settings not saved");
}
}
/**
* Gets a value from the config
*
* @param tag property name
* @param defaultValue default value if not found in profile
* @return String value
*/
public static String getString(String mod, String tag, Object defaultValue) {
Map<String, String> modConfig = getInstance().getModConfig(mod);
String value = modConfig.get(tag);
if (value == null) {
modConfig.put(tag, defaultValue.toString());
saveConfig();
return defaultValue.toString();
} else {
return value;
}
}
/**
* Gets a value from the config.
*
* @param mod name of mod
* @param tag property name
* @param defaultValue default value if not found in profile
* @return int value or 0
*/
public static int getInt(String mod, String tag, int defaultValue) {
int value;
try {
value = Integer.parseInt(getString(mod, tag, defaultValue));
} catch (NumberFormatException e) {
value = defaultValue;
}
return value;
}
/**
* Gets a value from the config
*
* @param mod name of mod
* @param tag property name
* @param defaultValue default value if not found in profile
* @return boolean value
*/
public static boolean getBoolean(String mod, String tag, boolean defaultValue) {
String value = getString(mod, tag, defaultValue).toLowerCase();
if (value.equals("false")) {
return false;
} else if (value.equals("true")) {
return true;
} else {
return defaultValue;
}
}
/**
* Sets a value in mcpatcher.json.
*
* @param mod name of mod
* @param tag property name
* @param value property value (must support toString())
*/
public static void set(String mod, String tag, Object value) {
if (value == null) {
remove(mod, tag);
return;
}
getInstance().getModConfig(mod)
.put(tag, value.toString());
saveConfig();
}
/**
* Remove a value from mcpatcher.json.
*
* @param mod name of mod
* @param tag property name
*/
private static void remove(String mod, String tag) {
getInstance().getModConfig(mod)
.remove(tag);
}
private Map<String, String> getModConfig(String mod) {
return this.profile.computeIfAbsent(mod, k -> new LinkedHashMap<>());
}
}
@@ -8,6 +8,8 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class MCLogger {
private static final Map<String, MCLogger> allLoggers = new HashMap<>();
@@ -26,23 +28,33 @@ public class MCLogger {
private int floodCount;
private long lastMessage = System.currentTimeMillis();
public static MCLogger getLogger(String category) {
return getLogger(category, category);
public static MCLogger getLogger(Category category) {
return getLogger(category, category.name);
}
public static synchronized MCLogger getLogger(String category, String logPrefix) {
MCLogger logger = allLoggers.get(category);
public static synchronized MCLogger getLogger(Category category, String logPrefix) {
MCLogger logger = allLoggers.get(category.name);
if (logger == null) {
logger = new MCLogger(category, logPrefix);
allLoggers.put(category, logger);
allLoggers.put(category.name, logger);
}
return logger;
}
private MCLogger(String category, String logPrefix) {
private MCLogger(Category category, String logPrefix) {
this.logPrefix = logPrefix;
logger = Logger.getLogger(category);
logger.setLevel(Config.getLogLevel(category));
logger = Logger.getLogger(category.name);
MCPatcherForgeConfig config = MCPatcherForgeConfig.instance();
logger.setLevel(Level.parse(switch (category) {
case CUSTOM_COLORS -> config.customColorsLoggingLevel;
case CUSTOM_ITEM_TEXTURES -> config.customItemTexturesLoggingLevel;
case CONNECTED_TEXTURES -> config.connectedTexturesLoggingLevel;
case EXTENDED_HD -> config.extendedHDLoggingLevel;
case RANDOM_MOBS -> config.randomMobsLoggingLevel;
case BETTER_SKIES -> config.betterSkiesLoggingLevel;
default -> Level.INFO.getName();
}));
logger.setUseParentHandlers(false);
logger.addHandler(new Handler() {
@@ -163,4 +175,25 @@ public class MCLogger {
super("ERROR", (Level.WARNING.intValue() + Level.SEVERE.intValue()) / 2);
}
}
public enum Category {
CUSTOM_COLORS(MCPatcherUtils.CUSTOM_COLORS),
CUSTOM_ITEM_TEXTURES(MCPatcherUtils.CUSTOM_ITEM_TEXTURES),
CONNECTED_TEXTURES(MCPatcherUtils.CONNECTED_TEXTURES),
EXTENDED_HD(MCPatcherUtils.EXTENDED_HD),
RANDOM_MOBS(MCPatcherUtils.RANDOM_MOBS),
BETTER_SKIES(MCPatcherUtils.BETTER_SKIES),
TEXTURE_PACK("Texture Pack"),
TILESHEET("Tilesheet"),
BETTER_GLASS(MCPatcherUtils.BETTER_GLASS),
;
public final String name;
Category(String name) {
this.name = name;
}
}
}
@@ -13,7 +13,6 @@ import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.biome.BiomeAPI;
@@ -28,19 +27,20 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.ResourceList;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class ColorizeBlock {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
private static final boolean useWaterColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "water", true);
private static final boolean useTreeColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "tree", true);
private static final boolean useRedstoneColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "redstone", true);
private static final boolean useStemColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "stem", true);
private static final boolean useBlockColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "otherBlocks", true);
private static final boolean useWaterColors = MCPatcherForgeConfig.instance().ccWater;
private static final boolean useTreeColors = MCPatcherForgeConfig.instance().ccTree;
private static final boolean useRedstoneColors = MCPatcherForgeConfig.instance().ccRedstone;
private static final boolean useStemColors = MCPatcherForgeConfig.instance().ccStem;
private static final boolean useBlockColors = MCPatcherForgeConfig.instance().ccOtherBlocks;
static final boolean enableSmoothBiomes = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "smoothBiomes", true);
static final boolean enableTestColorSmoothing = Config
.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "testColorSmoothing", false);
static final boolean enableSmoothBiomes = MCPatcherForgeConfig.instance().smoothBiomes;
static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.instance().testColorSmoothing;
private static final ResourceLocation REDSTONE_COLORS = TexturePackAPI
.newMCPatcherResourceLocation("colormap/redstone.png");
@@ -74,7 +74,7 @@ public class ColorizeBlock {
private static IColorMap waterColorMap;
private static float[][] redstoneColor; // colormap/redstone.png
private static final int blockBlendRadius = Config.getInt(MCPatcherUtils.CUSTOM_COLORS, "blockBlendRadius2", 4);
private static final int blockBlendRadius = MCPatcherForgeConfig.instance().blockBlendRadius;
public static int blockColor;
public static boolean isSmooth;
@@ -10,7 +10,6 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionHelper;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.gtnewhorizons.angelica.mixins.interfaces.MapColorExpansion;
@@ -18,7 +17,7 @@ import com.gtnewhorizons.angelica.mixins.interfaces.PotionExpansion;
public class ColorizeItem {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
private static final Map<Integer, String> entityNamesByID = new HashMap<>();
private static final Map<Integer, Integer> spawnerEggShellColors = new HashMap<>(); // egg.shell.*
@@ -14,8 +14,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.biome.BiomeAPI;
import com.prupe.mcpatcher.mal.biome.ColorMap;
import com.prupe.mcpatcher.mal.biome.ColorMapBase;
@@ -24,9 +22,11 @@ import com.prupe.mcpatcher.mal.biome.IColorMap;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class ColorizeWorld {
private static final int fogBlendRadius = Config.getInt(MCPatcherUtils.CUSTOM_COLORS, "fogBlendRadius", 7);
private static final int fogBlendRadius = MCPatcherForgeConfig.instance().fogBlendRadius;
private static final ResourceLocation UNDERWATERCOLOR = TexturePackAPI
.newMCPatcherResourceLocation("colormap/underwater.png");
@@ -3,7 +3,6 @@ package com.prupe.mcpatcher.cc;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.biome.ColorMap;
@@ -12,22 +11,24 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class Colorizer {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
static final ResourceLocation COLOR_PROPERTIES = TexturePackAPI.newMCPatcherResourceLocation("color.properties");
private static PropertiesFile properties;
static final boolean usePotionColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "potion", true);
static final boolean useParticleColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "particle", true);
static final boolean useFogColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "fog", true);
static final boolean useCloudType = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "clouds", true);
static final boolean useMapColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "map", true);
static final boolean useDyeColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "dye", true);
static final boolean useTextColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "text", true);
static final boolean useXPOrbColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "xporb", true);
static final boolean useEggColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "egg", true);
static final boolean usePotionColors = MCPatcherForgeConfig.instance().ccPotion;
static final boolean useParticleColors = MCPatcherForgeConfig.instance().ccParticle;
static final boolean useFogColors = MCPatcherForgeConfig.instance().ccFog;
static final boolean useCloudType = MCPatcherForgeConfig.instance().ccClouds;
static final boolean useMapColors = MCPatcherForgeConfig.instance().ccMap;
static final boolean useDyeColors = MCPatcherForgeConfig.instance().ccDye;
static final boolean useTextColors = MCPatcherForgeConfig.instance().ccText;
static final boolean useXPOrbColors = MCPatcherForgeConfig.instance().ccXPOrb;
static final boolean useEggColors = MCPatcherForgeConfig.instance().ccEgg;
public static final float[] setColor = new float[3];
@@ -10,21 +10,21 @@ import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.biome.ColorUtils;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public final class Lightmap {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
private static final String LIGHTMAP_FORMAT = "lightmap/world%d.png";
private static final int LIGHTMAP_SIZE = 16;
private static final int HEIGHT_WITHOUT_NIGHTVISION = 2 * LIGHTMAP_SIZE;
private static final int HEIGHT_WITH_NIGHTVISION = 4 * LIGHTMAP_SIZE;
private static final boolean useLightmaps = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "lightmaps", true);
private static final boolean useLightmaps = MCPatcherForgeConfig.instance().ccLightmaps;
private static final Map<Integer, Lightmap> lightmaps = new HashMap<>();
@@ -18,7 +18,6 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.item.ItemAPI;
@@ -28,11 +27,12 @@ import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import com.prupe.mcpatcher.mal.tile.TileLoader;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagListExpansion;
public class CITUtils {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "CIT");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_ITEM_TEXTURES, "CIT");
static final String CIT_PROPERTIES = "cit.properties";
private static final ResourceLocation CIT_PROPERTIES1 = TexturePackAPI.newMCPatcherResourceLocation(CIT_PROPERTIES);
@@ -46,10 +46,9 @@ public class CITUtils {
static Item itemCompass;
static Item itemClock;
static final boolean enableItems = Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "items", true);
static final boolean enableEnchantments = Config
.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "enchantments", true);
static final boolean enableArmor = Config.getBoolean(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "armor", true);
static final boolean enableItems = MCPatcherForgeConfig.instance().citItems;
static final boolean enableEnchantments = MCPatcherForgeConfig.instance().citEnchantments;
static final boolean enableArmor = MCPatcherForgeConfig.instance().citArmor;
private static TileLoader tileLoader;
private static final Map<Item, List<ItemOverride>> items = new IdentityHashMap<>();
@@ -10,12 +10,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
final class EnchantmentList {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "CIT");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_ITEM_TEXTURES, "CIT");
private static final float PI = (float) Math.PI;
@@ -23,7 +23,7 @@ import com.prupe.mcpatcher.mal.tile.TileLoader;
abstract class OverrideBase implements Comparable<OverrideBase> {
static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "CIT");
static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_ITEM_TEXTURES, "CIT");
private static final int MAX_DAMAGE = 65535;
private static final int MAX_STACK_SIZE = 65535;
@@ -11,13 +11,12 @@ import net.minecraft.potion.PotionHelper;
import net.minecraft.util.ResourceLocation;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
class PotionReplacer {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ITEM_TEXTURES, "CIT");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_ITEM_TEXTURES, "CIT");
private static final String ITEM_ID_POTION = "minecraft:potion";
private static final String ITEM_ID_GLASS_BOTTLE = "minecraft:glass_bottle";
@@ -14,7 +14,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.block.BlockAPI;
@@ -27,14 +26,14 @@ import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import com.prupe.mcpatcher.mal.tile.TileLoader;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class CTMUtils {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CONNECTED_TEXTURES, "CTM");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");
private static final boolean enableStandard = Config
.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "standard", true);
private static final boolean enableNonStandard = Config
.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "nonStandard", true);
private static final boolean enableStandard = MCPatcherForgeConfig.instance().ctmStandard;
private static final boolean enableNonStandard = MCPatcherForgeConfig.instance().ctmNonStandard;
private static final List<ITileOverride> allOverrides = new ArrayList<>();
private static final Map<Block, List<BlockStateMatcher>> blockOverrides = new IdentityHashMap<>();
@@ -8,13 +8,13 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.block.BlockAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class GlassPaneRenderer {
private static final boolean enable = Config.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "glassPane", true);
private static final boolean enable = MCPatcherForgeConfig.instance().ctmGlassPane;
public static boolean skipPaneRendering;
public static boolean skipTopEdgeRendering;
@@ -30,7 +30,7 @@ import com.prupe.mcpatcher.mal.tile.TileLoader;
abstract class TileOverride implements ITileOverride {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CONNECTED_TEXTURES, "CTM");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");
private static final int META_MASK = 0xffff;
@@ -9,13 +9,13 @@ import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.util.IIcon;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.block.BlockStateMatcher;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
private static final int MAX_RECURSION = Config.getInt(MCPatcherUtils.CONNECTED_TEXTURES, "maxRecursion", 4);
private static final int MAX_RECURSION = MCPatcherForgeConfig.instance().maxRecursion;
private final Map<Block, List<BlockStateMatcher>> allBlockOverrides;
private final Map<String, List<ITileOverride>> allTileOverrides;
@@ -14,7 +14,6 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.GLAPI;
@@ -23,11 +22,13 @@ import com.prupe.mcpatcher.mal.resource.ResourceList;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class CustomAnimation implements Comparable<CustomAnimation> {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ANIMATIONS, "Animation");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD, "Animation");
private static final boolean enable = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "animations", true);
private static final boolean enable = MCPatcherForgeConfig.instance().animations;
private static final Set<PropertiesFile> pending = new HashSet<>();
private static final List<CustomAnimation> animations = new ArrayList<>();
@@ -29,7 +29,6 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.GLU;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.BlendMethod;
@@ -38,21 +37,21 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.util.InputHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class FancyDial {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_ANIMATIONS, "Animation");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD, "Animation");
private static final double ANGLE_UNSET = Double.MAX_VALUE;
private static final int NUM_SCRATCH_TEXTURES = 3;
private static final boolean fboSupported = GLContext.getCapabilities().GL_EXT_framebuffer_object;
private static final boolean gl13Supported = GLContext.getCapabilities().OpenGL13;
private static final boolean enableCompass = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "fancyCompass", true);
private static final boolean enableClock = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "fancyClock", true);
private static final boolean useGL13 = gl13Supported
&& Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "useGL13", true);
private static final boolean useScratchTexture = Config
.getBoolean(MCPatcherUtils.EXTENDED_HD, "useScratchTexture", true);
private static final boolean enableCompass = MCPatcherForgeConfig.instance().fancyCompass;
private static final boolean enableClock = MCPatcherForgeConfig.instance().fancyClock;
private static final boolean useGL13 = gl13Supported && MCPatcherForgeConfig.instance().useGL13;
private static final boolean useScratchTexture = MCPatcherForgeConfig.instance().useScratchTexture;
private static final int glAttributes;
private static boolean initialized;
private static boolean active;
@@ -8,21 +8,21 @@ import java.util.Set;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ResourceLocation;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererExpansion;
public class FontUtils {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.HD_FONT);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD);
private static final boolean enable = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "hdFont", true);
private static final boolean enableNonHD = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "nonHDFontWidth", false);
private static final boolean enable = MCPatcherForgeConfig.instance().hdFont;
private static final boolean enableNonHD = MCPatcherForgeConfig.instance().nonHDFontWidth;
private static final int ROWS = 16;
private static final int COLS = 16;
@@ -14,16 +14,16 @@ import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.GLU;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.GLAPI;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class MipmapHelper {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.MIPMAP);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD);
private static final ResourceLocation MIPMAP_PROPERTIES = TexturePackAPI
.newMCPatcherResourceLocation("mipmap.properties");
@@ -32,8 +32,8 @@ public class MipmapHelper {
static final int TEX_DATA_TYPE = GL12.GL_UNSIGNED_INT_8_8_8_8_REV;
private static final boolean mipmapSupported;
static final boolean mipmapEnabled = Config.getBoolean(MCPatcherUtils.EXTENDED_HD, "mipmap", false);
static final int maxMipmapLevel = Config.getInt(MCPatcherUtils.EXTENDED_HD, "maxMipmapLevel", 3);
static final boolean mipmapEnabled = MCPatcherForgeConfig.instance().mipmap;
static final int maxMipmapLevel = MCPatcherForgeConfig.instance().maxMipMapLevel;
private static final boolean useMipmap;
private static final boolean anisoSupported;
@@ -53,15 +53,14 @@ public class MipmapHelper {
if (anisoSupported) {
anisoMax = (int) GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
checkGLError("glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)");
anisoLevel = Math
.max(Math.min(Config.getInt(MCPatcherUtils.EXTENDED_HD, "anisotropicFiltering", 1), anisoMax), 1);
anisoLevel = Math.max(Math.min(MCPatcherForgeConfig.instance().anisotropicFiltering, anisoMax), 1);
} else {
anisoMax = anisoLevel = 1;
}
lodSupported = GLContext.getCapabilities().GL_EXT_texture_lod_bias;
if (lodSupported) {
lodBias = Config.getInt(MCPatcherUtils.EXTENDED_HD, "lodBias", 0);
lodBias = MCPatcherForgeConfig.instance().lodBias;
} else {
lodBias = 0;
}
@@ -12,7 +12,7 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
public class BiomeAPI {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
public static final int WORLD_MAX_HEIGHT = 255;
@@ -12,7 +12,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.BiomeGenBase;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
@@ -20,11 +19,13 @@ import com.prupe.mcpatcher.mal.resource.ResourceList;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.util.WeightedIndex;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
abstract public class ColorMap implements IColorMap {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
public static final boolean useSwampColors = Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "swamp", true);
public static final boolean useSwampColors = MCPatcherForgeConfig.instance().swampColors;
private static final int FIXED = 0;
private static final int TEMPERATURE_HUMIDITY = 1;
@@ -164,7 +165,7 @@ abstract public class ColorMap implements IColorMap {
unusedPNGs.clear();
defaultColorMapFormat = TEMPERATURE_HUMIDITY;
defaultFlipY = false;
defaultYVariance = Config.getInt(MCPatcherUtils.CUSTOM_COLORS, "yVariance", 0);
defaultYVariance = MCPatcherForgeConfig.instance().yVariance;
}
public static void reloadColorMapSettings(PropertiesFile properties) {
@@ -10,11 +10,10 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
abstract public class ColorMapBase {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.CUSTOM_COLORS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
public static final int DEFAULT_HEIGHT = 64;
@@ -5,14 +5,12 @@ import net.minecraft.client.Minecraft;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
// Shared by both CTM and Custom Colors.
public class RenderBlocksUtils {
public static final boolean enableBetterGrass = Config
.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "grass", false);
public static final boolean enableBetterGrass = MCPatcherForgeConfig.instance().betterGrass;
private static final Block grassBlock = BlockAPI.getFixedBlock("minecraft:grass");
private static final Block snowBlock = BlockAPI.getFixedBlock("minecraft:snow_layer");
@@ -25,7 +25,7 @@ import com.prupe.mcpatcher.MCPatcherUtils;
public class ResourceList {
private static final MCLogger logger = MCLogger.getLogger("Texture Pack");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.TEXTURE_PACK);
private static ResourceList instance;
private static final Map<IResourcePack, Integer> resourcePackOrder = new WeakHashMap<>();
@@ -38,7 +38,7 @@ import com.gtnewhorizons.angelica.mixins.interfaces.AbstractTextureExpansion;
public class TexturePackAPI {
private static final MCLogger logger = MCLogger.getLogger("Texture Pack");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.TEXTURE_PACK);
public static final String DEFAULT_NAMESPACE = "minecraft";
@@ -11,7 +11,7 @@ import com.prupe.mcpatcher.MCLogger;
abstract public class TexturePackChangeHandler implements Comparable<TexturePackChangeHandler> {
private static final MCLogger logger = MCLogger.getLogger("Texture Pack");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.TEXTURE_PACK);
private static final ArrayList<TexturePackChangeHandler> handlers = new ArrayList<>();
private static int recurseDepth;
@@ -17,21 +17,21 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.BlendMethod;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class TileLoader {
private static final MCLogger logger = MCLogger.getLogger("Tilesheet");
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.TILESHEET);
private static final List<TileLoader> loaders = new ArrayList<>();
private static final boolean debugTextures = Config
.getBoolean(MCPatcherUtils.CONNECTED_TEXTURES, "debugTextures", false);
private static final boolean debugTextures = MCPatcherForgeConfig.instance().debugTextures;
private static final Map<String, String> specialTextures = new HashMap<>();
private static final TexturePackChangeHandler changeHandler;
@@ -6,21 +6,21 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.util.InputHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class LineRenderer {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.RANDOM_MOBS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.RANDOM_MOBS);
private static final double D_WIDTH = 1.0 / 1024.0;
private static final double D_POS = 1.0 / 256.0;
private static final boolean enable = Config.getBoolean(MCPatcherUtils.RANDOM_MOBS, "leashLine", true);
private static final boolean enable = MCPatcherForgeConfig.instance().leashLine;
private static final LineRenderer[] renderers = new LineRenderer[2];
private final ResourceLocation texture;
@@ -20,7 +20,7 @@ import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
public class MobRandomizer {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.RANDOM_MOBS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.RANDOM_MOBS);
private static final Map<String, ResourceLocation> cache = new LinkedHashMap<>();
static {
@@ -17,7 +17,7 @@ import com.prupe.mcpatcher.mal.util.WeightedIndex;
class MobRuleList {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.RANDOM_MOBS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.RANDOM_MOBS);
public static final String ALTERNATIVES_REGEX = "_(eyes|overlay|tame|angry|collar|fur|invulnerable|shooting)\\.properties$";
@@ -25,7 +25,7 @@ import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
public class RenderPass {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.BETTER_GLASS);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.BETTER_GLASS);
private static final ResourceLocation RENDERPASS_PROPERTIES = TexturePackAPI
.newMCPatcherResourceLocation("renderpass.properties");
@@ -7,14 +7,14 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.BlendMethod;
import com.prupe.mcpatcher.mal.resource.GLAPI;
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class FireworksHelper {
private static final int LIT_LAYER = 3;
@@ -22,8 +22,8 @@ public class FireworksHelper {
private static final ResourceLocation PARTICLE_PROPERTIES = TexturePackAPI
.newMCPatcherResourceLocation("particle.properties");
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.BETTER_SKIES);
private static final boolean enable = Config.getBoolean(MCPatcherUtils.BETTER_SKIES, "brightenFireworks", true);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.BETTER_SKIES);
private static final boolean enable = MCPatcherForgeConfig.instance().brightenFireworks;
private static BlendMethod blendMethod;
public static int getFXLayer(EntityFX entity) {
@@ -14,7 +14,6 @@ import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCLogger;
import com.prupe.mcpatcher.MCPatcherUtils;
import com.prupe.mcpatcher.mal.resource.BlendMethod;
@@ -23,14 +22,15 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
public class SkyRenderer {
private static final MCLogger logger = MCLogger.getLogger(MCPatcherUtils.BETTER_SKIES);
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.BETTER_SKIES);
private static final boolean enable = Config.getBoolean(MCPatcherUtils.BETTER_SKIES, "skybox", true);
private static final boolean unloadTextures = Config
.getBoolean(MCPatcherUtils.BETTER_SKIES, "unloadTextures", true);
public static final double horizonHeight = Config.getInt(MCPatcherUtils.BETTER_SKIES, "horizon", 16);
private static final boolean enable = MCPatcherForgeConfig.instance().skybox;
private static final boolean unloadTextures = MCPatcherForgeConfig.instance().unloadTextures;
public static final double horizonHeight = MCPatcherForgeConfig.instance().horizon;
private static double worldTime;
private static float celestialAngle;
@@ -5,21 +5,22 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import com.prupe.mcpatcher.Config;
import com.prupe.mcpatcher.MCPatcherUtils;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
/**
* Adapted from Hodgepodge
*/
public enum AsmTransformers {
RENDERBLOCKS("RenderBlocks transformer", () -> Config.getBoolean(MCPatcherUtils.CUSTOM_COLORS, "enabled", true),
RENDERBLOCKS("RenderBlocks transformer", () -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().customColorsEnabled,
Side.CLIENT, "mist475.mcpatcherforge.asm.RenderBlocksTransformer"),
WORLDRENDERER("WorldRenderer transformer", () -> true, Side.CLIENT,
"mist475.mcpatcherforge.asm.WorldRendererTransformer");
WORLDRENDERER("WorldRenderer transformer", () -> AngelicaConfig.enableMCPatcherForgeFeatures, Side.CLIENT,
"mist475.mcpatcherforge.asm.WorldRendererTransformer");
private final Supplier<Boolean> applyIf;
private final Side side;
@@ -0,0 +1,179 @@
package mist475.mcpatcherforge.config;
import java.io.File;
import java.util.logging.Level;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.common.config.Configuration;
// Adapted from hodgepodge
public class MCPatcherForgeConfig {
private static MCPatcherForgeConfig config;
// CUSTOM_COLORS
public boolean customColorsEnabled;
public String customColorsLoggingLevel;
public int yVariance;
public int blockBlendRadius;
public int fogBlendRadius;
public boolean swampColors;
public boolean ccWater;
public boolean ccTree;
public boolean ccRedstone;
public boolean ccStem;
public boolean ccOtherBlocks;
public boolean smoothBiomes;
public boolean testColorSmoothing;
public boolean ccPotion;
public boolean ccParticle;
public boolean ccFog;
public boolean ccClouds;
public boolean ccMap;
public boolean ccDye;
public boolean ccText;
public boolean ccXPOrb;
public boolean ccEgg;
public boolean ccLightmaps;
// CUSTOM_ITEM_TEXTURES
public boolean customItemTexturesEnabled;
public String customItemTexturesLoggingLevel;
public boolean citItems;
public boolean citEnchantments;
public boolean citArmor;
// CONNECTED_TEXTURES
public boolean connectedTexturesEnabled;
public String connectedTexturesLoggingLevel;
public int maxRecursion;
public boolean debugTextures;
public boolean betterGrass;
public boolean ctmStandard;
public boolean ctmNonStandard;
public boolean ctmGlassPane;
// EXTENDED_HD
public boolean extendedHDEnabled;
public String extendedHDLoggingLevel;
public int maxMipMapLevel;
public int anisotropicFiltering;
public int lodBias;
public boolean animations;
public boolean fancyCompass;
public boolean fancyClock;
public boolean useGL13;
public boolean useScratchTexture;
public boolean hdFont;
public boolean nonHDFontWidth;
public boolean mipmap;
// RANDOM_MOBS
public boolean randomMobsEnabled;
public String randomMobsLoggingLevel;
public boolean leashLine;
// BETTER_SKIES
public boolean betterSkiesEnabled;
public String betterSkiesLoggingLevel;
public int horizon;
public boolean brightenFireworks;
public boolean skybox;
public boolean unloadTextures;
public enum Category {
CUSTOM_COLORS,
CUSTOM_ITEM_TEXTURES,
CONNECTED_TEXTURES,
EXTENDED_HD,
RANDOM_MOBS,
BETTER_SKIES;
@Override
public String toString() {
return name().toLowerCase();
}
}
public static MCPatcherForgeConfig instance() {
if (config == null) {
config = new MCPatcherForgeConfig(new File(Launch.minecraftHome, "config/mcpatcherforge.cfg"));
}
return config;
}
public MCPatcherForgeConfig(File file) {
Configuration config = new Configuration(file);
// spotless:off
customColorsEnabled = config.get(Category.CUSTOM_COLORS.toString(),"enabled",true,"Enable the custom colors module").getBoolean();
customColorsLoggingLevel = config.get(Category.CUSTOM_COLORS.toString(),"logging",Level.INFO.getName(),"logging level").getString();
yVariance = config.get(Category.CUSTOM_COLORS.toString(),"yVariance",0).getInt();
blockBlendRadius = config.get(Category.CUSTOM_COLORS.toString(),"blockBlendRadius",4).getInt();
fogBlendRadius = config.get(Category.CUSTOM_COLORS.toString(),"fogBlendRadius",7).getInt();
swampColors = config.get(Category.CUSTOM_COLORS.toString(),"swampColors",true).getBoolean();
ccWater = config.get(Category.CUSTOM_COLORS.toString(),"water",true).getBoolean();
ccTree = config.get(Category.CUSTOM_COLORS.toString(),"tree",true).getBoolean();
ccRedstone = config.get(Category.CUSTOM_COLORS.toString(),"redstone",true).getBoolean();
ccStem = config.get(Category.CUSTOM_COLORS.toString(),"stem",true).getBoolean();
ccOtherBlocks = config.get(Category.CUSTOM_COLORS.toString(),"otherBlocks",true).getBoolean();
smoothBiomes = config.get(Category.CUSTOM_COLORS.toString(),"smoothBiomes",true).getBoolean();
testColorSmoothing = config.get(Category.CUSTOM_COLORS.toString(),"testColorSmoothing",false).getBoolean();
ccPotion = config.get(Category.CUSTOM_COLORS.toString(),"potion",true).getBoolean();
ccParticle = config.get(Category.CUSTOM_COLORS.toString(),"particle",true).getBoolean();
ccFog = config.get(Category.CUSTOM_COLORS.toString(),"fog",true).getBoolean();
ccClouds = config.get(Category.CUSTOM_COLORS.toString(),"clouds",true).getBoolean();
ccMap = config.get(Category.CUSTOM_COLORS.toString(),"map",true).getBoolean();
ccDye = config.get(Category.CUSTOM_COLORS.toString(),"dye",true).getBoolean();
ccText = config.get(Category.CUSTOM_COLORS.toString(),"text",true).getBoolean();
ccXPOrb = config.get(Category.CUSTOM_COLORS.toString(),"xporb",true).getBoolean();
ccEgg = config.get(Category.CUSTOM_COLORS.toString(),"egg",true).getBoolean();
ccLightmaps = config.get(Category.CUSTOM_COLORS.toString(),"lightmaps",true).getBoolean();
customItemTexturesEnabled = config.get(Category.CUSTOM_ITEM_TEXTURES.toString(),"enabled",true,"Enable the custom item textures module").getBoolean();
customItemTexturesLoggingLevel = config.get(Category.CUSTOM_ITEM_TEXTURES.toString(),"logging",Level.INFO.getName(),"logging level").getString();
citItems = config.get(Category.CUSTOM_ITEM_TEXTURES.toString(),"items",true).getBoolean();
citEnchantments = config.get(Category.CUSTOM_ITEM_TEXTURES.toString(),"enchantments",true).getBoolean();
citArmor = config.get(Category.CUSTOM_ITEM_TEXTURES.toString(),"armor",true).getBoolean();
connectedTexturesEnabled = config.get(Category.CONNECTED_TEXTURES.toString(),"enabled",true,"Enable the connected textures module").getBoolean();
connectedTexturesLoggingLevel = config.get(Category.CONNECTED_TEXTURES.toString(),"logging",Level.INFO.getName(),"logging level").getString();
maxRecursion = config.get(Category.CONNECTED_TEXTURES.toString(),"maxRecursion",4).getInt();
debugTextures = config.get(Category.CONNECTED_TEXTURES.toString(),"debugTextures",false).getBoolean();
betterGrass = config.get(Category.CONNECTED_TEXTURES.toString(),"betterGrass",false).getBoolean();
ctmStandard = config.get(Category.CONNECTED_TEXTURES.toString(),"standard",true).getBoolean();
ctmNonStandard = config.get(Category.CONNECTED_TEXTURES.toString(),"nonStandard",true).getBoolean();
ctmGlassPane = config.get(Category.CONNECTED_TEXTURES.toString(),"glassPane",false).getBoolean();
extendedHDEnabled = config.get(Category.EXTENDED_HD.toString(),"enabled",true,"Enable the extended hd module").getBoolean();
extendedHDLoggingLevel = config.get(Category.EXTENDED_HD.toString(),"logging",Level.INFO.getName(),"logging level").getString();
maxMipMapLevel = config.get(Category.EXTENDED_HD.toString(),"maxMipMapLevel",3).getInt();
anisotropicFiltering = config.get(Category.EXTENDED_HD.toString(),"anisotropicFiltering",1).getInt();
lodBias = config.get(Category.EXTENDED_HD.toString(),"lod bias",0).getInt();
animations = config.get(Category.EXTENDED_HD.toString(),"animations",true).getBoolean();
fancyCompass = config.get(Category.EXTENDED_HD.toString(),"fancyCompass",true).getBoolean();
fancyClock = config.get(Category.EXTENDED_HD.toString(),"fancyClock",true).getBoolean();
useGL13 = config.get(Category.EXTENDED_HD.toString(),"useGL13",true).getBoolean();
useScratchTexture = config.get(Category.EXTENDED_HD.toString(),"useScratchTexture",true).getBoolean();
hdFont = config.get(Category.EXTENDED_HD.toString(),"HDFont",true).getBoolean();
nonHDFontWidth = config.get(Category.EXTENDED_HD.toString(),"nonHDFontWidth",false).getBoolean();
mipmap = config.get(Category.EXTENDED_HD.toString(),"mipmap",false).getBoolean();
randomMobsEnabled = config.get(Category.RANDOM_MOBS.toString(),"enabled",true,"Enable the random mobs module").getBoolean();
randomMobsLoggingLevel = config.get(Category.RANDOM_MOBS.toString(),"logging",Level.INFO.getName(),"logging level").getString();
leashLine = config.get(Category.RANDOM_MOBS.toString(),"leashLine",true).getBoolean();
betterSkiesEnabled = config.get(Category.BETTER_SKIES.toString(),"enabled",true,"Enable the better skies module").getBoolean();
betterSkiesLoggingLevel = config.get(Category.BETTER_SKIES.toString(),"logging",Level.INFO.getName(),"logging level").getString();
horizon = config.get(Category.BETTER_SKIES.toString(),"horizon",16).getInt();
brightenFireworks = config.get(Category.BETTER_SKIES.toString(),"brightenFireworks",true).getBoolean();
skybox = config.get(Category.BETTER_SKIES.toString(),"skybox",true).getBoolean();
unloadTextures = config.get(Category.BETTER_SKIES.toString(),"unloadTextures",true).getBoolean();
// spotless:on
if (config.hasChanged()) config.save();
}
}