mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 12:15:11 +00:00
Remove Mixin Config from Client and create seperate ConfigMixin for loading Mixins Earlier
This commit is contained in:
1 parent
96c621fb14
commit
de6fb94562
3 files changed
+74
-21
No files matched your search
@@ -31,12 +31,6 @@ public class ConfigClient
|
||||
public static Property FontSizeProperty;
|
||||
public static int FontSize = 18;
|
||||
|
||||
public static Property EntityRendererMixinProperty;
|
||||
public static boolean EntityRendererMixin = true;
|
||||
|
||||
public static Property AnimationMixinProperty;
|
||||
public static boolean AnimationMixin = true;
|
||||
|
||||
/**
|
||||
* Questing Properties
|
||||
**/
|
||||
@@ -70,12 +64,6 @@ public class ConfigClient
|
||||
FontSizeProperty = config.get(VISUAL, "Font Size", 18, "Font size for custom fonts (doesn't work with minecrafts font)");
|
||||
FontSize = FontSizeProperty.getInt(18);
|
||||
|
||||
EntityRendererMixinProperty = config.get(VISUAL, "Entity Render Mixin", true, "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.");
|
||||
EntityRendererMixin = EntityRendererMixinProperty.getBoolean(true);
|
||||
|
||||
AnimationMixinProperty = config.get(VISUAL, "Animation Mixin", true, "Enables mixins for the ModelRenderer and RenderPlayer classes, allowing for additional animation functionality in the API. If crashes or visual errors occur, please disable.");
|
||||
AnimationMixin = AnimationMixinProperty.getBoolean(true);
|
||||
|
||||
// Questing
|
||||
TrackingInfoAlignmentProperty = config.get(QUESTING, "Tracking Info Alignment", 3, "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3");
|
||||
TrackingInfoAlignment = TrackingInfoAlignmentProperty.getInt(3);
|
||||
@@ -100,9 +88,6 @@ public class ConfigClient
|
||||
FontSize = LegacyConfig.FontSize;
|
||||
FontSizeProperty.set(FontSize);
|
||||
|
||||
EntityRendererMixin = LegacyConfig.EntityRendererMixin;
|
||||
EntityRendererMixinProperty.set(EntityRendererMixin);
|
||||
|
||||
TrackingInfoAlignment = LegacyConfig.TrackingInfoAlignment;
|
||||
TrackingInfoAlignmentProperty.set(TrackingInfoAlignment);
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package noppes.npcs.config;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.config.legacy.LegacyConfig;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigMixin
|
||||
{
|
||||
public static Configuration config;
|
||||
|
||||
public final static String CLIENT = "CLIENT";
|
||||
public final static String GENERAL = "GENERAL";
|
||||
|
||||
/**
|
||||
* General Properties
|
||||
**/
|
||||
public static Property EntityRendererMixinProperty;
|
||||
public static boolean EntityRendererMixin = true;
|
||||
|
||||
public static Property AnimationMixinProperty;
|
||||
public static boolean AnimationMixin = true;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
|
||||
try
|
||||
{
|
||||
config.load();
|
||||
|
||||
EntityRendererMixinProperty = config.get(CLIENT, "Entity Render Mixin", true, "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.");
|
||||
EntityRendererMixin = EntityRendererMixinProperty.getBoolean(true);
|
||||
|
||||
AnimationMixinProperty = config.get(CLIENT, "Animation Mixin", true, "Enables mixins for the ModelRenderer and RenderPlayer classes, allowing for additional animation functionality in the API. If crashes or visual errors occur, please disable.");
|
||||
AnimationMixin = AnimationMixinProperty.getBoolean(true);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its mixin configuration");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (config.hasChanged()) {
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package noppes.npcs.mixin;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.config.ConfigMixin;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -32,13 +36,23 @@ public class CustomNPCsMixinPlugin implements IMixinConfigPlugin {
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
|
||||
// Load Mixin Config
|
||||
String configPath = "config" + File.separator + "CustomNpcPlus" + File.separator;
|
||||
ConfigMixin.init(new File(configPath + "mixin.cfg"));
|
||||
boolean client = FMLLaunchHandler.side().isClient();
|
||||
|
||||
List<String> mixins = new ArrayList<>();
|
||||
if (ConfigClient.EntityRendererMixin){
|
||||
mixins.add("MixinEntityRenderer");
|
||||
}
|
||||
if (ConfigClient.AnimationMixin) {
|
||||
mixins.add("MixinModelRenderer");
|
||||
mixins.add("MixinRenderPlayer");
|
||||
|
||||
// Client Only Mixins
|
||||
if(client){
|
||||
if (ConfigMixin.EntityRendererMixin){
|
||||
mixins.add("MixinEntityRenderer");
|
||||
}
|
||||
if (ConfigMixin.AnimationMixin) {
|
||||
mixins.add("MixinModelRenderer");
|
||||
mixins.add("MixinRenderPlayer");
|
||||
}
|
||||
}
|
||||
return mixins;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user