Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly integrate mcpatcherforge connected textures + better grass #745

Merged
merged 7 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import jss.notfine.asm.AsmTransformers;
import jss.notfine.asm.mappings.Namer;
import jss.notfine.config.MCPatcherForgeConfig;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -56,6 +57,7 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
// Angelica Config
ConfigurationManager.registerConfig(AngelicaConfig.class);
ConfigurationManager.registerConfig(CompatConfig.class);
MCPatcherForgeConfig.registerConfig();
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
final Configuration config = ctx.getConfiguration();
final LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public enum Mixins {
),
NOTFINE_NO_CUSTOM_ITEM_TEXTURES(new Builder("NotFine no Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> !AngelicaConfig.enableMCPatcherForgeFeatures || !MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.setApplyIf(() -> !AngelicaConfig.enableMCPatcherForgeFeatures || !MCPatcherForgeConfig.CustomItemTextures.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("notfine.glint.",
"MixinItemRenderer",
Expand Down Expand Up @@ -391,7 +391,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_CUSTOM_COLORS(new Builder("MCP:F Custom Colors")
.setSide(Mixins.Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customColorsEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.CustomColors.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.cc.",
"block.material.MixinMapColor",
Expand Down Expand Up @@ -447,7 +447,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.CustomItemTextures.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.cit.",
"client.renderer.entity.MixinRenderBiped",
Expand All @@ -466,13 +466,13 @@ public enum Mixins {
),
MCPATCHER_FORGE_CONNECTED_TEXTURES(new Builder("MCP:F Connected Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().connectedTexturesEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ConnectedTextures.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")
),
MCPATCHER_FORGE_EXTENDED_HD(new Builder("MCP:F Extended hd")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ExtendedHD.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.hd.",
"MixinTextureClock",
Expand All @@ -482,14 +482,14 @@ public enum Mixins {
),
MCPATCHER_FORGE_EXTENDED_HD_FONT(new Builder("MCP:F Extended HD Font")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled && MCPatcherForgeConfig.instance().hdFont))
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ExtendedHD.enabled && MCPatcherForgeConfig.ExtendedHD.hdFont))
.addTargetedMod(TargetedMod.VANILLA)
.addExcludedMod(TargetedMod.COFHCORE)
.addMixinClasses("mcpatcherforge.hd.MixinFontRenderer")
),
MCPATCHER_FORGE_RANDOM_MOBS(new Builder("MCP:F Random Mobs")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().randomMobsEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.RandomMobs.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.mob.",
"MixinRender",
Expand All @@ -506,7 +506,7 @@ public enum Mixins {
),
MCPATCHER_FORGE_SKY(new Builder("MCP:F Sky")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().betterSkiesEnabled)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.BetterSkies.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.sky.",
"MixinEffectRenderer",
Expand All @@ -516,32 +516,32 @@ public enum Mixins {
MCPATCHER_FORGE_CC_NO_CTM(new Builder("MCP:F Custom Colors, no Connected Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& !MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
&& !MCPatcherForgeConfig.ConnectedTextures.enabled
&& MCPatcherForgeConfig.CustomColors.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.cc_ctm.MixinRenderBlocksNoCTM")
),
MCPATCHER_FORGE_CTM_NO_CC(new Builder("MCP:F Connected Textures, no Custom Colours")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& !MCPatcherForgeConfig.instance().customColorsEnabled)
&& MCPatcherForgeConfig.ConnectedTextures.enabled
&& !MCPatcherForgeConfig.CustomColors.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC")
),
MCPATCHER_FORGE_CTM_AND_CC(new Builder("MCP:F Connected Textures and Custom Colors")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
&& MCPatcherForgeConfig.ConnectedTextures.enabled
&& MCPatcherForgeConfig.CustomColors.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks")
),
MCPATCHER_FORGE_CTM_OR_CC(new Builder("MCP:F Connected Textures or Custom Colors")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
|| MCPatcherForgeConfig.instance().customColorsEnabled)
&& MCPatcherForgeConfig.ConnectedTextures.enabled
|| MCPatcherForgeConfig.CustomColors.enabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap")
),
Expand Down Expand Up @@ -584,7 +584,7 @@ public static List<String> getEarlyMixins(Set<String> loadedCoreMods) {
NotFineConfig.loadSettings();
//This may be possible to handle differently or fix.
if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) {
MCPatcherForgeConfig.instance().hdFont = false;
MCPatcherForgeConfig.ExtendedHD.hdFont = false;
}
final List<String> mixins = new ArrayList<>();
final List<String> notLoading = new ArrayList<>();
Expand Down
29 changes: 15 additions & 14 deletions src/main/java/com/prupe/mcpatcher/MCLogger.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.prupe.mcpatcher;

import jss.notfine.config.MCPatcherForgeConfig;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Formatter;
Expand All @@ -8,10 +10,10 @@
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import jss.notfine.config.MCPatcherForgeConfig;

public class MCLogger {

private static final org.apache.logging.log4j.Logger MAIN_LOGGER = org.apache.logging.log4j.LogManager.getLogger("MCPatcherForge");

private static final Map<String, MCLogger> allLoggers = new HashMap<>();

public static final Level ERROR = new ErrorLevel();
Expand Down Expand Up @@ -44,16 +46,15 @@ public static synchronized MCLogger getLogger(Category category, String logPrefi
private MCLogger(Category category, String logPrefix) {
this.logPrefix = logPrefix;
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.setLevel(switch (category) {
case CUSTOM_COLORS -> MCPatcherForgeConfig.CustomColors.logging.level;
case CUSTOM_ITEM_TEXTURES -> MCPatcherForgeConfig.CustomItemTextures.logging.level;
case CONNECTED_TEXTURES -> MCPatcherForgeConfig.ConnectedTextures.logging.level;
case EXTENDED_HD -> MCPatcherForgeConfig.ExtendedHD.logging.level;
case RANDOM_MOBS -> MCPatcherForgeConfig.RandomMobs.logging.level;
case BETTER_SKIES -> MCPatcherForgeConfig.BetterSkies.logging.level;
default -> Level.INFO;
});

logger.setUseParentHandlers(false);
logger.addHandler(new Handler() {
Expand All @@ -72,14 +73,14 @@ public String format(LogRecord record) {
prefix.append("\n");
message = message.substring(1);
}
return prefix + "[" + MCLogger.this.logPrefix + "] " + level.toString() + ": " + message;
return prefix + "[" + MCLogger.this.logPrefix + "/" + level.toString() + "]: " + message;
}
}
};

@Override
public void publish(LogRecord record) {
System.out.println(formatter.format(record));
MAIN_LOGGER.info(formatter.format(record));
}

@Override
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/prupe/mcpatcher/cc/ColorizeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public class ColorizeBlock {

private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);

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;
private static final boolean useWaterColors = MCPatcherForgeConfig.CustomColors.water;
private static final boolean useTreeColors = MCPatcherForgeConfig.CustomColors.tree;
private static final boolean useRedstoneColors = MCPatcherForgeConfig.CustomColors.redstone;
private static final boolean useStemColors = MCPatcherForgeConfig.CustomColors.stem;
private static final boolean useBlockColors = MCPatcherForgeConfig.CustomColors.otherBlocks;

private static final boolean enableSmoothBiomes = MCPatcherForgeConfig.instance().smoothBiomes;
private static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.instance().testColorSmoothing;
private static final boolean enableSmoothBiomes = MCPatcherForgeConfig.CustomColors.smoothBiomes;
private static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.CustomColors.testColorSmoothing;

private static final ResourceLocation REDSTONE_COLORS = TexturePackAPI
.newMCPatcherResourceLocation("colormap/redstone.png");
Expand Down Expand Up @@ -73,7 +73,7 @@ public class ColorizeBlock {
private static IColorMap waterColorMap;
private static float[][] redstoneColor; // colormap/redstone.png

private static final int blockBlendRadius = MCPatcherForgeConfig.instance().blockBlendRadius;
private static final int blockBlendRadius = MCPatcherForgeConfig.CustomColors.blockBlendRadius;

public static int blockColor;
public static boolean isSmooth;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/prupe/mcpatcher/cc/ColorizeWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class ColorizeWorld {

private static final int fogBlendRadius = MCPatcherForgeConfig.instance().fogBlendRadius;
private static final int fogBlendRadius = MCPatcherForgeConfig.CustomColors.fogBlendRadius;

private static final ResourceLocation UNDERWATERCOLOR = TexturePackAPI
.newMCPatcherResourceLocation("colormap/underwater.png");
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/prupe/mcpatcher/cc/Colorizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public class Colorizer {
static final ResourceLocation COLOR_PROPERTIES = TexturePackAPI.newMCPatcherResourceLocation("color.properties");
private static PropertiesFile properties;

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;
static final boolean usePotionColors = MCPatcherForgeConfig.CustomColors.potion;
static final boolean useParticleColors = MCPatcherForgeConfig.CustomColors.particle;
static final boolean useFogColors = MCPatcherForgeConfig.CustomColors.fog;
static final boolean useCloudType = MCPatcherForgeConfig.CustomColors.clouds;
static final boolean useMapColors = MCPatcherForgeConfig.CustomColors.map;
static final boolean useDyeColors = MCPatcherForgeConfig.CustomColors.dye;
static final boolean useTextColors = MCPatcherForgeConfig.CustomColors.text;
static final boolean useXPOrbColors = MCPatcherForgeConfig.CustomColors.xporb;
static final boolean useEggColors = MCPatcherForgeConfig.CustomColors.egg;

public static final float[] setColor = new float[3];

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/prupe/mcpatcher/cc/Lightmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class Lightmap {
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 = MCPatcherForgeConfig.instance().ccLightmaps;
private static final boolean useLightmaps = MCPatcherForgeConfig.CustomColors.lightmaps;

private static final Map<Integer, Lightmap> lightmaps = new HashMap<>();

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/prupe/mcpatcher/cit/CITUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public class CITUtils {
static Item itemCompass;
static Item itemClock;

static final boolean enableItems = MCPatcherForgeConfig.instance().citItems;
static final boolean enableEnchantments = MCPatcherForgeConfig.instance().citEnchantments;
static final boolean enableArmor = MCPatcherForgeConfig.instance().citArmor;
static final boolean enableItems = MCPatcherForgeConfig.CustomItemTextures.items;
static final boolean enableEnchantments = MCPatcherForgeConfig.CustomItemTextures.enchantments;
static final boolean enableArmor = MCPatcherForgeConfig.CustomItemTextures.armor;

private static TileLoader tileLoader;
private static final Map<Item, List<ItemOverride>> items = new IdentityHashMap<>();
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/com/prupe/mcpatcher/ctm/CTMUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Set;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
Expand All @@ -32,9 +31,6 @@ public class CTMUtils {

private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");

private static final boolean enableStandard = MCPatcherForgeConfig.instance().ctmStandard;
private static final boolean enableNonStandard = MCPatcherForgeConfig.instance().ctmNonStandard;

private static final List<TileOverride> allOverrides = new ArrayList<>();
private static final Map<Block, List<BlockStateMatcher>> blockOverrides = new IdentityHashMap<>();
private static final Map<String, List<TileOverride>> tileOverrides = new HashMap<>();
Expand Down Expand Up @@ -81,7 +77,7 @@ public void beforeChange() {
tileLoader = new TileLoader("textures/blocks", logger);
RenderPassAPI.instance.refreshBlendingOptions();

if (enableStandard || enableNonStandard) {
if (MCPatcherForgeConfig.ConnectedTextures.standard || MCPatcherForgeConfig.ConnectedTextures.nonStandard) {
for (ResourceLocation resource : ResourceList.getInstance()
.listResources(TexturePackAPI.MCPATCHER_SUBDIR + "ctm", ".properties", true)) {
registerOverride(TileOverride.create(resource, tileLoader));
Expand Down Expand Up @@ -160,7 +156,7 @@ public static IIcon getBlockIcon(IIcon icon, Block block, int face) {
public static void reset() {}

private static boolean checkFace(int face) {
return face < 0 ? enableNonStandard : enableStandard;
return face < 0 ? MCPatcherForgeConfig.ConnectedTextures.nonStandard : MCPatcherForgeConfig.ConnectedTextures.standard;
}

private static boolean checkRenderType(Block block) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/prupe/mcpatcher/ctm/GlassPaneRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

public class GlassPaneRenderer {

private static final boolean enable = MCPatcherForgeConfig.instance().ctmGlassPane;

public static boolean skipPaneRendering;
public static boolean skipTopEdgeRendering;
public static boolean skipBottomEdgeRendering;
Expand Down Expand Up @@ -47,7 +45,7 @@ public static void renderThick(RenderBlocks renderBlocks, Block blockPane, IIcon

private static boolean setupIcons(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int x, int y, int z) {
skipPaneRendering = skipBottomEdgeRendering = skipTopEdgeRendering = false;
if (!enable) {
if (!MCPatcherForgeConfig.ConnectedTextures.glassPane) {
return false;
}
for (int face = BlockOrientation.NORTH_FACE; face <= BlockOrientation.EAST_FACE; face++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

abstract public class TileOverrideIterator implements Iterator<TileOverride> {

private static final int MAX_RECURSION = MCPatcherForgeConfig.instance().maxRecursion;

private final Map<Block, List<BlockStateMatcher>> allBlockOverrides;
private final Map<String, List<TileOverride>> allTileOverrides;

Expand Down Expand Up @@ -118,7 +116,7 @@ public synchronized TileOverride go(RenderBlockState renderBlockState, IIcon ori
lastMatchedOverride = null;
skipOverrides.clear();

pass: for (int pass = 0; pass < MAX_RECURSION; pass++) {
pass: for (int pass = 0; pass < MCPatcherForgeConfig.ConnectedTextures.maxRecursion; pass++) {
while (hasNext()) {
TileOverride override = next();
IIcon newIcon = getTile(override, renderBlockState, origIcon);
Expand Down
Loading