Files
CustomNPC-Plus/src/main/java/noppes/npcs/config/ConfigClient.java
T

185 lines
7.4 KiB
Java
Raw Normal View History

2023-01-07 00:21:08 -05:00
package noppes.npcs.config;
import cpw.mods.fml.common.FMLLog;
import net.minecraftforge.common.config.Configuration;
2023-01-07 18:07:23 -05:00
import net.minecraftforge.common.config.Property;
import noppes.npcs.CustomNpcs;
import noppes.npcs.config.legacy.LegacyConfig;
2023-01-07 00:21:08 -05:00
import org.apache.logging.log4j.Level;
import java.io.File;
public class ConfigClient
{
public static Configuration config;
2023-06-03 17:23:40 -04:00
public final static String GENERAL = "General";
2023-01-07 18:07:23 -05:00
public final static String VISUAL = "Visual";
public final static String QUESTING = "Questing";
2025-01-25 19:41:54 -05:00
public final static String MODEL = "Model";
2023-01-07 18:07:23 -05:00
2023-06-03 17:23:40 -04:00
/**
* General Properties
**/
public static Property CacheLifeProperty;
public static int CacheLife = 10;
2023-01-07 18:07:23 -05:00
/**
* Visual Properties
**/
public static Property EnableChatBubblesProperty;
2023-01-07 00:21:08 -05:00
public static boolean EnableChatBubbles = true;
2023-01-07 18:07:23 -05:00
public static Property InventoryGuiEnabledProperty;
2023-01-07 00:21:08 -05:00
public static boolean InventoryGuiEnabled = true;
2023-01-07 18:07:23 -05:00
public static Property enableFactionTabProperty;
public static boolean enableFactionTab = true;
2023-01-07 18:07:23 -05:00
public static Property FontTypeProperty;
2023-01-07 00:21:08 -05:00
public static String FontType = "Default";
2023-01-07 18:07:23 -05:00
public static Property FontSizeProperty;
2023-01-07 00:21:08 -05:00
public static int FontSize = 18;
2023-01-07 18:07:23 -05:00
public static Property ChatBubblesFontTypeProperty;
public static boolean ChatBubblesFontType = false;
2023-01-07 18:07:23 -05:00
/**
* Questing Properties
**/
public static Property TrackingInfoAlignmentProperty;
2023-01-07 00:21:08 -05:00
public static int TrackingInfoAlignment = 3;
2023-01-07 18:07:23 -05:00
public static Property TrackingInfoXProperty;
public static int TrackingInfoX = 0;
2023-01-07 00:21:08 -05:00
2023-01-07 18:07:23 -05:00
public static Property TrackingInfoYProperty;
public static int TrackingInfoY = 0;
2023-01-07 00:21:08 -05:00
2024-03-15 16:40:43 -04:00
public static Property TrackingScaleProperty;
public static int TrackingScale = 100;
public static Property DialogSpeedProperty;
public static int DialogSpeed = 10;
public static Property DialogSoundProperty;
public static boolean DialogSound = true;
2024-03-15 17:54:01 -04:00
public static Property ChatAlertsProperty;
public static boolean ChatAlerts = true;
public static Property BannerAlertsProperty;
public static boolean BannerAlerts = true;
2025-01-25 19:41:54 -05:00
/**
* Model Properties
**/
public static boolean LegacyCampfire = false;
public static boolean LegacyChair = false;
public static boolean LegacyBarrel = false;
public static boolean LegacyCarpentryBench = false;
2023-01-07 00:21:08 -05:00
public static void init(File configFile)
{
config = new Configuration(configFile);
try
{
config.load();
2023-06-03 17:23:40 -04:00
// General
CacheLifeProperty = config.get(GENERAL, "Cache Life", 10, "How long should downloaded imagery data be saved client side? (In minutes)");
CacheLife = CacheLifeProperty.getInt(10);
2023-01-07 18:07:23 -05:00
// Visual
EnableChatBubblesProperty = config.get(VISUAL, "Enable Chat Bubbles", true, "Enable/Disable Chat Bubbles");
EnableChatBubbles = EnableChatBubblesProperty.getBoolean(true);
InventoryGuiEnabledProperty = config.get(VISUAL, "Enable Inventory Tabs", true, "Enable/Disable Inventory Tabs");
InventoryGuiEnabled = InventoryGuiEnabledProperty.getBoolean(true);
enableFactionTabProperty = config.get(VISUAL, "Enable Faction Tab", true, "Enable the Faction Tab");
enableFactionTab = enableFactionTabProperty.getBoolean(true);
2023-01-07 18:07:23 -05:00
FontTypeProperty = config.get(VISUAL, "Font Type", "Default", "When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC");
FontType = FontTypeProperty.getString();
FontSizeProperty = config.get(VISUAL, "Font Size", 18, "Font size for custom fonts (doesn't work with minecrafts font)");
FontSize = FontSizeProperty.getInt(18);
ChatBubblesFontTypeProperty = config.get(VISUAL, "Chat Bubbles Font Type", false, "Enable the use of Custom Font for Chat Bubbles");
ChatBubblesFontType = ChatBubblesFontTypeProperty.getBoolean(false);
2023-01-07 18:07:23 -05:00
// 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);
TrackingInfoXProperty = config.get(QUESTING, "Tracking Info X", 0, "Client sided! Offsets the tracking info GUI by this amount in the X direction.");
TrackingInfoX = TrackingInfoXProperty.getInt(0);
TrackingInfoYProperty = config.get(QUESTING, "Tracking Info Y", 0, "Client sided! Offsets the tracking info GUI by this amount in the Y direction.");
TrackingInfoY = TrackingInfoYProperty.getInt(0);
2024-03-15 16:40:43 -04:00
TrackingScaleProperty = config.get(QUESTING, "Tracking Scale", 100, "Client sided! Adjusts the scaling of the Quest Tracking");
TrackingScale = TrackingScaleProperty.getInt(100);
2024-03-15 17:54:01 -04:00
DialogSpeedProperty = config.get(VISUAL, "Dialog Speed", true, "Only set for gradual dialogs");
DialogSpeed = DialogSpeedProperty.getInt(10);
2024-03-15 17:54:01 -04:00
DialogSoundProperty = config.get(VISUAL, "Dialog Sound", true, "Only for dialogs with sounds");
DialogSound = DialogSoundProperty.getBoolean(true);
2024-03-15 17:54:01 -04:00
ChatAlertsProperty = config.get(VISUAL, "All Chat Alerts", true, "Universal enable/disable for Banner Alerts");
ChatAlerts = ChatAlertsProperty.getBoolean(true);
BannerAlertsProperty = config.get(VISUAL, "All Banner Alerts", true, "Universal enable/disable for Banner Alerts");
BannerAlerts = BannerAlertsProperty.getBoolean(true);
2025-01-25 19:41:54 -05:00
LegacyCampfire = config.get(MODEL, "Legacy Campfire Model", false).getBoolean(false);
LegacyBarrel = config.get(MODEL, "Legacy Barrel Model", false).getBoolean(false);
LegacyChair = config.get(MODEL, "Legacy Chair Model", false).getBoolean(false);
LegacyCarpentryBench = config.get(MODEL, "Legacy Carpentry Bench Model", false).getBoolean(false);
2023-01-07 18:07:23 -05:00
// Convert to Legacy
if(CustomNpcs.legacyExist){
EnableChatBubbles = LegacyConfig.EnableChatBubbles;
EnableChatBubblesProperty.set(EnableChatBubbles);
FontType = LegacyConfig.FontType;
FontTypeProperty.set(FontType);
InventoryGuiEnabled = LegacyConfig.InventoryGuiEnabled;
InventoryGuiEnabledProperty.set(InventoryGuiEnabled);
FontSize = LegacyConfig.FontSize;
FontSizeProperty.set(FontSize);
TrackingInfoAlignment = LegacyConfig.TrackingInfoAlignment;
TrackingInfoAlignmentProperty.set(TrackingInfoAlignment);
TrackingInfoX = LegacyConfig.TrackingInfoX;
TrackingInfoXProperty.set(TrackingInfoX);
TrackingInfoY = LegacyConfig.TrackingInfoY;
TrackingInfoYProperty.set(TrackingInfoY);
}
2023-01-07 00:21:08 -05:00
if (TrackingInfoAlignment < 0)
TrackingInfoAlignment = 0;
if (TrackingInfoAlignment > 8)
TrackingInfoAlignment = 8;
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its client configuration");
}
finally
{
if (config.hasChanged()) {
config.save();
}
}
}
}