Update to 1.13.2

This commit is contained in:
Marcel Konrad
2019-04-02 18:17:54 +02:00
parent eafef4ae54
commit e86d4f5c0c
204 changed files with 10130 additions and 9348 deletions

View File

@@ -0,0 +1,124 @@
package exopandora.worldhandler.config;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import exopandora.worldhandler.util.UtilKeyBinding;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.config.ModConfig.Type;
public class Config
{
public static final ForgeConfigSpec CLIENT_SPEC;
public static final ClientConfig CLIENT;
private static ModConfig MOD_CONFIG;
private static CommentedFileConfig CONFIG_DATA;
static
{
Pair<ClientConfig, ForgeConfigSpec> pair = new ForgeConfigSpec.Builder().configure(ClientConfig::new);
CLIENT_SPEC = pair.getRight();
CLIENT = pair.getLeft();
}
@OnlyIn(Dist.CLIENT)
public static class ClientConfig
{
private final ConfigCategorySettings settings;
private final ConfigCategoryButcher butcher;
private final ConfigCategorySkin skin;
private final ConfigCategorySliders sliders;
public ClientConfig(ForgeConfigSpec.Builder builder)
{
this.settings = new ConfigCategorySettings(builder);
this.butcher = new ConfigCategoryButcher(builder);
this.skin = new ConfigCategorySkin(builder);
this.sliders = new ConfigCategorySliders(builder);
}
public void read()
{
this.getSettings().read();
this.getButcher().read();
this.getSkin().read();
this.getSliders().read();
}
public ConfigCategorySettings getSettings()
{
return this.settings;
}
public ConfigCategoryButcher getButcher()
{
return this.butcher;
}
public ConfigCategorySkin getSkin()
{
return this.skin;
}
public ConfigCategorySliders getSliders()
{
return this.sliders;
}
}
public static ConfigCategorySettings getSettings()
{
return Config.CLIENT.getSettings();
}
public static ConfigCategoryButcher getButcher()
{
return Config.CLIENT.getButcher();
}
public static ConfigCategorySkin getSkin()
{
return Config.CLIENT.getSkin();
}
public static ConfigCategorySliders getSliders()
{
return Config.CLIENT.getSliders();
}
protected static <T> void set(ForgeConfigSpec.ConfigValue<T> configValue, T value)
{
if(configValue != null && value != null && (!value.equals(configValue.get()) || configValue.get() instanceof List<?>))
{
Config.CONFIG_DATA.set(configValue.getPath(), value);
}
}
public static void configLoad(ModConfig.Loading event)
{
if(event.getConfig().getType().equals(Type.CLIENT))
{
Config.MOD_CONFIG = event.getConfig();
Config.CONFIG_DATA = (CommentedFileConfig) Config.MOD_CONFIG.getConfigData();
Config.CLIENT.read();
}
}
public static void configReload(ModConfig.ConfigReloading event)
{
if(event.getConfig().getType().equals(Type.CLIENT) && Config.CONFIG_DATA != null)
{
Config.CONFIG_DATA.load();
Config.CLIENT.read();
UtilKeyBinding.updatePosKeys();
}
}
}

View File

@@ -1,45 +0,0 @@
package exopandora.worldhandler.config;
import java.util.HashMap;
import java.util.Map;
import exopandora.worldhandler.helper.EntityHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ConfigButcher
{
private static Map<String, Boolean> ENTITIES = new HashMap<String, Boolean>();
public static final String CATEGORY = "butcher";
public static void load(Configuration config)
{
for(ResourceLocation location : EntityList.ENTITY_EGGS.keySet())
{
String entity = EntityHelper.getEntityName(location);
String translationKey = "entity." + entity + ".name";
String translation = I18n.format(translationKey);
if(!translation.equals(translationKey))
{
ENTITIES.put(entity, config.getBoolean(entity, CATEGORY, false, I18n.format("gui.worldhandler.config.comment.butcher", translation), translationKey));
}
}
if(config.hasChanged())
{
config.save();
}
}
public static Map<String, Boolean> getEntitiyMap()
{
return ENTITIES;
}
}

View File

@@ -0,0 +1,93 @@
package exopandora.worldhandler.config;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.registries.ForgeRegistries;
@OnlyIn(Dist.CLIENT)
public class ConfigCategoryButcher
{
private final List<String> entities = new ArrayList<String>();
private final ConfigValue<List<? extends String>> valueEntities;
public ConfigCategoryButcher(ForgeConfigSpec.Builder builder)
{
builder.push("butcher");
this.valueEntities = builder.defineList("entities", Collections.<String>emptyList(), this::isValid);
builder.pop();
}
public void read()
{
this.entities.clear();
this.entities.addAll(this.valueEntities.get());
}
private void write()
{
Config.set(this.valueEntities, this.entities);
}
public List<ResourceLocation> getEntities()
{
List<ResourceLocation> list = new ArrayList<ResourceLocation>();
for(String entity : this.entities)
{
ResourceLocation resource = ResourceLocation.makeResourceLocation(entity);
if(resource != null)
{
list.add(resource);
}
}
return list;
}
public boolean containsEntity(ResourceLocation entity)
{
return this.entities.contains(entity.toString());
}
public void addEntity(ResourceLocation entity)
{
if(this.isValid(entity))
{
this.entities.add(entity.toString());
this.write();
}
}
public boolean removeEntity(ResourceLocation entity)
{
boolean removed = this.entities.remove(entity.toString());
if(removed)
{
this.write();
}
return removed;
}
private boolean isValid(Object string)
{
if(string != null)
{
return ForgeRegistries.ENTITIES.containsKey(ResourceLocation.makeResourceLocation(string.toString()));
}
return false;
}
}

View File

@@ -0,0 +1,320 @@
package exopandora.worldhandler.config;
import java.util.Arrays;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.common.ForgeConfigSpec.IntValue;
@OnlyIn(Dist.CLIENT)
public class ConfigCategorySettings
{
private boolean commandSyntax;
private boolean shortcuts;
private boolean shortcutKeys;
private boolean tooltips;
private boolean watch;
private boolean smoothWatch;
private boolean pause;
private boolean customTimes;
private boolean permissionQuery;
private boolean highlightBlocks;
private int dawn;
private int noon;
private int sunset;
private int midnight;
private String blockPlacingMode;
private final BooleanValue valueCommandSyntax;
private final BooleanValue valueShortcuts;
private final BooleanValue valueShortcutKeys;
private final BooleanValue valueTooltips;
private final BooleanValue valueWatch;
private final BooleanValue valueSmoothWatch;
private final BooleanValue valuePause;
private final BooleanValue valueCustomTimes;
private final BooleanValue valuePermissionQuery;
private final BooleanValue valueHighlightBlocks;
private final IntValue valueDawn;
private final IntValue valueNoon;
private final IntValue valueSunset;
private final IntValue valueMidnight;
private final ConfigValue<String> valueBlockPlacingMode;
public ConfigCategorySettings(ForgeConfigSpec.Builder builder)
{
builder.push("settings");
this.valueCommandSyntax = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.command_syntax"))
.translation("gui.worldhandler.config.key.settings.command_syntax")
.define("command_syntax", false);
this.valueShortcuts = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.shortcuts"))
.translation("gui.worldhandler.config.key.settings.shortcuts")
.define("shortcuts", false);
this.valueShortcutKeys = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.key_shortcuts"))
.translation("gui.worldhandler.config.key.settings.key_shortcuts")
.define("key_shortcuts", false);
this.valueTooltips = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.tooltips"))
.translation("gui.worldhandler.config.key.settings.tooltips")
.define("tooltips", true);
this.valueWatch = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.watch"))
.translation("gui.worldhandler.config.key.settings.watch")
.define("watch", true);
this.valueSmoothWatch = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.smooth_watch"))
.translation("gui.worldhandler.config.key.settings.smooth_watch")
.define("smooth_watch", true);
this.valuePause = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.pause_game"))
.translation("gui.worldhandler.config.key.settings.pause_game")
.define("pause_game", false);
this.valueCustomTimes = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.custom_times"))
.translation("gui.worldhandler.config.key.settings.custom_times")
.define("custom_times", false);
this.valuePermissionQuery = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.permission_query"))
.translation("gui.worldhandler.config.key.settings.permission_query")
.define("permission_query", true);
this.valueHighlightBlocks = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.highlight_blocks"))
.translation("gui.worldhandler.config.key.settings.highlight_blocks")
.define("highlight_blocks", true);
this.valueDawn = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.custom_time_dawn"))
.translation("gui.worldhandler.config.key.settings.custom_time_dawn")
.defineInRange("custom_time_dawn", 1000, 0, 24000);
this.valueNoon = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.custom_time_noon"))
.translation("gui.worldhandler.config.key.settings.custom_time_noon")
.defineInRange("custom_time_noon", 6000, 0, 24000);
this.valueSunset = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.custom_time_sunset"))
.translation("gui.worldhandler.config.key.settings.custom_time_sunset")
.defineInRange("custom_time_sunset", 12500, 0, 24000);
this.valueMidnight = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.custom_time_midnight"))
.translation("gui.worldhandler.config.key.settings.custom_time_midnight")
.defineInRange("custom_time_midnight", 18000, 0, 24000);
this.valueBlockPlacingMode = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.block_placing_mode"))
.translation("gui.worldhandler.config.key.settings.block_placing_mode")
.defineInList("block_placing_mode", "keep", Arrays.asList("keep", "replace", "destroy"));
builder.pop();
}
public void read()
{
this.commandSyntax = this.valueCommandSyntax.get();
this.shortcuts = this.valueShortcuts.get();
this.shortcutKeys = this.valueShortcutKeys.get();
this.tooltips = this.valueTooltips.get();
this.watch = this.valueWatch.get();
this.smoothWatch = this.valueSmoothWatch.get();
this.pause = this.valuePause.get();
this.customTimes = this.valueCustomTimes.get();
this.permissionQuery = this.valuePermissionQuery.get();
this.highlightBlocks = this.valueHighlightBlocks.get();
this.dawn = this.valueDawn.get();
this.noon = this.valueNoon.get();
this.sunset = this.valueSunset.get();
this.midnight = this.valueMidnight.get();
this.blockPlacingMode = this.valueBlockPlacingMode.get();
}
private void write()
{
Config.set(this.valueCommandSyntax, this.commandSyntax);
Config.set(this.valueShortcuts, this.shortcuts);
Config.set(this.valueShortcutKeys, this.shortcutKeys);
Config.set(this.valueTooltips, this.tooltips);
Config.set(this.valueWatch, this.watch);
Config.set(this.valueSmoothWatch, this.smoothWatch);
Config.set(this.valuePause, this.pause);
Config.set(this.valueCustomTimes, this.customTimes);
Config.set(this.valuePermissionQuery, this.permissionQuery);
Config.set(this.valueHighlightBlocks, this.highlightBlocks);
Config.set(this.valueDawn, this.dawn);
Config.set(this.valueNoon, this.noon);
Config.set(this.valueSunset, this.sunset);
Config.set(this.valueMidnight, this.midnight);
Config.set(this.valueBlockPlacingMode, this.blockPlacingMode);
}
public boolean commandSyntax()
{
return this.commandSyntax;
}
public void setCommandSyntax(boolean enabled)
{
this.commandSyntax = enabled;
this.write();
}
public boolean shortcuts()
{
return this.shortcuts;
}
public void setShortcuts(boolean enabled)
{
this.shortcuts = enabled;
this.write();
}
public boolean shortcutKeys()
{
return this.shortcutKeys;
}
public void setShortcutKeys(boolean enabled)
{
this.shortcutKeys = enabled;
this.write();
}
public boolean tooltips()
{
return this.tooltips;
}
public void setTooltips(boolean enabled)
{
this.tooltips = enabled;
this.write();
}
public boolean watch()
{
return this.watch;
}
public void setWatch(boolean enabled)
{
this.watch = enabled;
this.write();
}
public boolean smoothWatch()
{
return this.smoothWatch;
}
public void setSmoothWatch(boolean enabled)
{
this.smoothWatch = enabled;
this.write();
}
public boolean pause()
{
return this.pause;
}
public void setPause(boolean enabled)
{
this.pause = enabled;
this.write();
}
public boolean customTimes()
{
return this.customTimes;
}
public void setCustomTimes(boolean enabled)
{
this.customTimes = enabled;
this.write();
}
public boolean permissionQuery()
{
return this.permissionQuery;
}
public void setPermissionQuery(boolean enabled)
{
this.permissionQuery = enabled;
this.write();
}
public boolean highlightBlocks()
{
return this.highlightBlocks;
}
public void setHighlightBlocks(boolean enabled)
{
this.highlightBlocks = enabled;
this.write();
}
public int getDawn()
{
return this.dawn;
}
public void setDawn(int ticks)
{
this.dawn = ticks;
this.write();
}
public int getNoon()
{
return this.noon;
}
public void setNoon(int ticks)
{
this.noon = ticks;
this.write();
}
public int getSunset()
{
return this.sunset;
}
public void setSunset(int ticks)
{
this.sunset = ticks;
this.write();
}
public int getMidnight()
{
return this.midnight;
}
public void setMidnight(int ticks)
{
this.midnight = ticks;
this.write();
}
public String getBlockPlacingMode()
{
return this.blockPlacingMode;
}
public void setBlockPlacingMode(String mode)
{
this.blockPlacingMode = mode;
this.write();
}
}

View File

@@ -0,0 +1,343 @@
package exopandora.worldhandler.config;
import java.util.Arrays;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.common.ForgeConfigSpec.IntValue;
@OnlyIn(Dist.CLIENT)
public class ConfigCategorySkin
{
private int iconSize;
private int labelColor;
private int headlineColor;
private int backgroundRed;
private int backgroundGreen;
private int backgroundBlue;
private int backgroundAlpha;
private int buttonRed;
private int buttonGreen;
private int buttonBlue;
private int buttonAlpha;
private String type;
private boolean sharpEdges;
private boolean drawBackground;
private final ConfigValue<Integer> valueIconSize;
private final IntValue valueLabelColor;
private final IntValue valueHeadlineColor;
private final IntValue valueBackgroundRed;
private final IntValue valueBackgroundGreen;
private final IntValue valueBackgroundBlue;
private final IntValue valueBackgroundAlpha;
private final IntValue valueButtonRed;
private final IntValue valueButtonGreen;
private final IntValue valueButtonBlue;
private final IntValue valueButtonAlpha;
private final ConfigValue<String> valueType;
private final BooleanValue valueSharpEdges;
private final BooleanValue valueDrawBackground;
public ConfigCategorySkin(ForgeConfigSpec.Builder builder)
{
builder.push("skin");
this.valueIconSize = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.icon_size"))
.translation("gui.worldhandler.config.key.skin.icon_size")
.defineInList("icon_size", 16, Arrays.asList(16, 32, 64));
this.valueLabelColor = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.label_color"))
.translation("gui.worldhandler.config.key.skin.label_color")
.defineInRange("label_color", 0x1F1F1F, 0x80000000, 0x7FFFFFFF);
this.valueHeadlineColor = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.headline_color"))
.translation("gui.worldhandler.config.key.skin.headline_color")
.defineInRange("headline_color", 0x4F4F4F, 0x80000000, 0x7FFFFFFF);
this.valueBackgroundRed = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.background_red"))
.translation("gui.worldhandler.config.key.skin.background_red")
.defineInRange("background_red", 255, 0, 255);
this.valueBackgroundGreen = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.background_green"))
.translation("gui.worldhandler.config.key.skin.background_green")
.defineInRange("background_green", 255, 0, 255);
this.valueBackgroundBlue = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.background_blue"))
.translation("gui.worldhandler.config.key.skin.background_blue")
.defineInRange("background_blue", 255, 0, 255);
this.valueBackgroundAlpha = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.background_alpha"))
.translation("gui.worldhandler.config.key.skin.background_alpha")
.defineInRange("background_alpha", 255, 0, 255);
this.valueButtonRed = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.button_red"))
.translation("gui.worldhandler.config.key.skin.button_red")
.defineInRange("button_red", 255, 0, 255);
this.valueButtonGreen = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.button_green"))
.translation("gui.worldhandler.config.key.skin.button_green")
.defineInRange("button_green", 255, 0, 255);
this.valueButtonBlue = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.button_blue"))
.translation("gui.worldhandler.config.key.skin.button_blue")
.defineInRange("button_blue", 255, 0, 255);
this.valueButtonAlpha = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.button_alpha"))
.translation("gui.worldhandler.config.key.skin.button_alpha")
.defineInRange("button_alpha", 255, 0, 255);
this.valueType = builder
.comment(I18n.format("gui.worldhandler.config.comment.skin.textures"))
.translation("gui.worldhandler.config.key.skin.textures")
.defineInList("textures", "resourcepack", Arrays.asList("resourcepack", "vanilla"));
this.valueSharpEdges = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.sharp_tab_edges"))
.translation("gui.worldhandler.config.key.settings.sharp_tab_edges")
.define("sharp_tab_edges", false);
this.valueDrawBackground = builder
.comment(I18n.format("gui.worldhandler.config.comment.settings.draw_background"))
.translation("gui.worldhandler.config.key.settings.draw_background")
.define("draw_background", true);
builder.pop();
}
public void read()
{
this.iconSize = this.valueIconSize.get();
this.labelColor = this.valueLabelColor.get();
this.headlineColor = this.valueHeadlineColor.get();
this.backgroundRed = this.valueBackgroundRed.get();
this.backgroundGreen = this.valueBackgroundGreen.get();
this.backgroundBlue = this.valueBackgroundBlue.get();
this.backgroundAlpha = this.valueBackgroundAlpha.get();
this.buttonRed = this.valueButtonRed.get();
this.buttonGreen = this.valueButtonGreen.get();
this.buttonBlue = this.valueButtonBlue.get();
this.buttonAlpha = this.valueButtonAlpha.get();
this.type = this.valueType.get();
this.sharpEdges = this.valueSharpEdges.get();
this.drawBackground = this.valueDrawBackground.get();
}
private void write()
{
Config.set(this.valueIconSize, this.iconSize);
Config.set(this.valueLabelColor, this.labelColor);
Config.set(this.valueHeadlineColor, this.headlineColor);
Config.set(this.valueBackgroundRed, this.backgroundRed);
Config.set(this.valueBackgroundGreen, this.backgroundGreen);
Config.set(this.valueBackgroundBlue, this.backgroundBlue);
Config.set(this.valueBackgroundAlpha, this.backgroundAlpha);
Config.set(this.valueButtonRed, this.buttonRed);
Config.set(this.valueButtonGreen, this.buttonGreen);
Config.set(this.valueButtonBlue, this.buttonBlue);
Config.set(this.valueButtonAlpha, this.buttonAlpha);
Config.set(this.valueType, this.type);
Config.set(this.valueSharpEdges, this.sharpEdges);
Config.set(this.valueDrawBackground, this.drawBackground);
}
public int getIconSize()
{
return this.iconSize;
}
public void setIconSize(int size)
{
this.iconSize = size;
this.write();
}
public int getLabelColor()
{
return this.labelColor;
}
public void setLabelColor(int color)
{
this.labelColor = color;
this.write();
}
public int getHeadlineColor()
{
return this.headlineColor;
}
public void setHeadlineColor(int color)
{
this.headlineColor = color;
this.write();
}
private int getBackgroundRed()
{
return this.backgroundRed;
}
public float getBackgroundRedF()
{
return this.getBackgroundRed() / 255F;
}
public void setBackgroundRed(int red)
{
this.backgroundRed = red;
this.write();
}
private int getBackgroundGreen()
{
return this.backgroundGreen;
}
public float getBackgroundGreenF()
{
return this.getBackgroundGreen() / 255F;
}
public void setBackgroundGreen(int green)
{
this.backgroundGreen = green;
this.write();
}
private int getBackgroundBlue()
{
return this.backgroundBlue;
}
public float getBackgroundBlueF()
{
return this.getBackgroundBlue() / 255F;
}
public void setBackgroundBlue(int blue)
{
this.backgroundBlue = blue;
this.write();
}
private int getButtonRed()
{
return this.buttonRed;
}
public float getButtonRedF()
{
return this.getButtonRed() / 255F;
}
public void setButtonRed(int red)
{
this.backgroundRed = red;
this.write();
}
private int getButtonGreen()
{
return this.buttonGreen;
}
public float getButtonGreenF()
{
return this.getButtonGreen() / 255F;
}
public void setButtonGreen(int green)
{
this.buttonGreen = green;
this.write();
}
private int getButtonBlue()
{
return this.buttonBlue;
}
public float getButtonBlueF()
{
return this.getButtonBlue() / 255F;
}
public void setButtonBlue(int blue)
{
this.buttonBlue = blue;
this.write();
}
public String getTextureType()
{
return this.type;
}
public void setTextureType(String type)
{
this.type = type;
this.write();
}
public boolean sharpEdges()
{
return this.sharpEdges;
}
public void setSharpEdges(boolean enabled)
{
this.sharpEdges = enabled;
this.write();
}
public boolean drawBackground()
{
return this.drawBackground;
}
public void setDrawBackground(boolean enabled)
{
this.drawBackground = enabled;
this.write();
}
private int getBackgroundAlpha()
{
return this.backgroundAlpha;
}
public float getBackgroundAlphaF()
{
return this.getBackgroundAlpha() / 255F;
}
public void setBackgroundAlpha(int alpha)
{
this.backgroundAlpha = alpha;
this.write();
}
private int getButtonAlpha()
{
return this.buttonAlpha;
}
public float getButtonAlphaF()
{
return this.getButtonAlpha() / 255F;
}
public void setButtonAlpha(int alpha)
{
this.buttonAlpha = alpha;
this.write();
}
}

View File

@@ -0,0 +1,203 @@
package exopandora.worldhandler.config;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;
@OnlyIn(Dist.CLIENT)
public class ConfigCategorySliders
{
private double maxPotionAmplifier;
private double maxItemEnchantment;
private double maxItemAttributes;
private double maxSummonPotionAmplifier;
private double maxSummonPotionMinutes;
private double maxSummonAttributes;
private double maxExperience;
private double maxPlayerPoints;
private double maxTriggerValue;
private final DoubleValue valueMaxPotionAmplifier;
private final DoubleValue valueMaxItemEnchantment;
private final DoubleValue valueMaxItemAttributes;
private final DoubleValue valueMaxSummonPotionAmplifier;
private final DoubleValue valueMaxSummonPotionMinutes;
private final DoubleValue valueMaxSummonAttributes;
private final DoubleValue valueMaxExperience;
private final DoubleValue valueMaxPlayerPoints;
private final DoubleValue valueMaxTriggerValue;
public ConfigCategorySliders(ForgeConfigSpec.Builder builder)
{
builder.push("sliders");
this.valueMaxPotionAmplifier = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_potion_amplifier"))
.translation("gui.worldhandler.config.key.sliders.max_potion_amplifier")
.defineInRange("max_potion_amplifier", 100D, 0D, Byte.MAX_VALUE);
this.valueMaxItemEnchantment = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_item_enchantment"))
.translation("gui.worldhandler.config.key.sliders.max_item_enchantment")
.defineInRange("max_item_enchantment", 100D, 0D, Integer.MAX_VALUE);
this.valueMaxItemAttributes = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_item_attributes"))
.translation("gui.worldhandler.config.key.sliders.max_item_attributes")
.defineInRange("max_item_attributes", 100D, 0D, Double.MAX_VALUE);
this.valueMaxSummonPotionAmplifier = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_summon_potion_amplifier"))
.translation("gui.worldhandler.config.key.sliders.max_summon_potion_amplifier")
.defineInRange("max_summon_potion_amplifier", 100D, 0D, Byte.MAX_VALUE);
this.valueMaxSummonPotionMinutes = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_summon_potion_minutes"))
.translation("gui.worldhandler.config.key.sliders.max_summon_potion_minutes")
.defineInRange("max_summon_potion_minutes", 100D, 0D, 16000);
this.valueMaxSummonAttributes = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_summon_attributes"))
.translation("gui.worldhandler.config.key.sliders.max_summon_attributes")
.defineInRange("max_summon_attributes", 100D, 0D, Double.MAX_VALUE);
this.valueMaxExperience = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_experience"))
.translation("gui.worldhandler.config.key.sliders.max_experience")
.defineInRange("max_experience", 100D, 0D, 100000D);
this.valueMaxPlayerPoints = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_player_points"))
.translation("gui.worldhandler.config.key.sliders.max_player_points")
.defineInRange("max_player_points", 100D, 0D, 100000D);
this.valueMaxTriggerValue = builder
.comment(I18n.format("gui.worldhandler.config.comment.sliders.max_trigger_value"))
.translation("gui.worldhandler.config.key.sliders.max_trigger_value")
.defineInRange("max_trigger_value", 100D, 0D, 100000D);
builder.pop();
}
public void read()
{
this.maxPotionAmplifier = this.valueMaxPotionAmplifier.get();
this.maxItemEnchantment = this.valueMaxItemEnchantment.get();
this.maxItemAttributes = this.valueMaxItemAttributes.get();
this.maxSummonPotionAmplifier = this.valueMaxSummonPotionAmplifier.get();
this.maxSummonPotionMinutes = this.valueMaxSummonPotionMinutes.get();
this.maxSummonAttributes = this.valueMaxSummonAttributes.get();
this.maxExperience = this.valueMaxExperience.get();
this.maxPlayerPoints = this.valueMaxPlayerPoints.get();
this.maxTriggerValue = this.valueMaxTriggerValue.get();
}
private void write()
{
Config.set(this.valueMaxPotionAmplifier, this.maxPotionAmplifier);
Config.set(this.valueMaxItemEnchantment, this.maxItemEnchantment);
Config.set(this.valueMaxItemAttributes, this.maxItemAttributes);
Config.set(this.valueMaxSummonPotionAmplifier, this.maxSummonPotionAmplifier);
Config.set(this.valueMaxSummonPotionMinutes, this.maxSummonPotionMinutes);
Config.set(this.valueMaxSummonAttributes, this.maxSummonAttributes);
Config.set(this.valueMaxExperience, this.maxExperience);
Config.set(this.valueMaxPlayerPoints, this.maxPlayerPoints);
Config.set(this.valueMaxTriggerValue, this.maxTriggerValue);
}
public double getMaxPotionAmplifier()
{
return this.maxPotionAmplifier;
}
public void setMaxPotionAmplifier(double max)
{
this.maxPotionAmplifier = max;
this.write();
}
public double getMaxItemEnchantment()
{
return this.maxItemEnchantment;
}
public void setMaxItemEnchantment(double max)
{
this.maxItemEnchantment = max;
this.write();
}
public double getMaxItemAttributes()
{
return this.maxItemAttributes;
}
public void setMaxItemAttributes(double max)
{
this.maxItemAttributes = max;
this.write();
}
public double getMaxSummonPotionAmplifier()
{
return this.maxSummonPotionAmplifier;
}
public void setMaxSummonPotionAmplifier(double max)
{
this.maxSummonPotionAmplifier = max;
this.write();
}
public double getMaxSummonPotionMinutes()
{
return this.maxSummonPotionMinutes;
}
public void setMaxSummonPotionMinutes(double max)
{
this.maxSummonPotionMinutes = max;
this.write();
}
public double getMaxSummonAttributes()
{
return this.maxSummonAttributes;
}
public void setMaxSummonAttributes(double max)
{
this.maxSummonAttributes = max;
this.write();
}
public double getMaxExperience()
{
return this.maxExperience;
}
public void setMaxExperience(double max)
{
this.maxExperience = max;
this.write();
}
public double getMaxPlayerPoints()
{
return this.maxPlayerPoints;
}
public void setMaxPlayerPoints(double max)
{
this.maxPlayerPoints = max;
this.write();
}
public double getMaxTriggerValue()
{
return this.maxTriggerValue;
}
public void setMaxTriggerValue(double max)
{
this.maxTriggerValue = max;
this.write();
}
}

View File

@@ -1,136 +0,0 @@
package exopandora.worldhandler.config;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ConfigSettings
{
private static boolean BIOME_INDICATOR;
private static boolean COMMAND_SYNTAX;
private static boolean SHORTCUTS;
private static boolean SHORTCUT_KEYS;
private static boolean TOOLTIPS;
private static boolean WATCH;
private static boolean SMOOTH_WATCH;
private static boolean PAUSE;
private static boolean CUSTOM_TIMES;
private static boolean PERMISSION_QUERY;
private static boolean HIGHLIGHT_BLOCKS;
private static int DAWN;
private static int NOON;
private static int SUNSET;
private static int MIDNIGHT;
private static String BLOCK_PLACING_MODE;
public static final String CATEGORY = "settings";
public static void load(Configuration config)
{
BIOME_INDICATOR = config.getBoolean("biome_indicator", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.biome_indicator"), "gui.worldhandler.config.key.settings.biome_indicator");
COMMAND_SYNTAX = config.getBoolean("command_syntax", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.command_syntax"), "gui.worldhandler.config.key.settings.command_syntax");
SHORTCUTS = config.getBoolean("shortcuts", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.shortcuts"), "gui.worldhandler.config.key.settings.shortcuts");
SHORTCUT_KEYS = config.getBoolean("key_shortcuts", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.key_shortcuts"), "gui.worldhandler.config.key.settings.key_shortcuts");
TOOLTIPS = config.getBoolean("tooltips", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.settings.tooltips"), "gui.worldhandler.config.key.settings.tooltips");
WATCH = config.getBoolean("watch", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.settings.watch"), "gui.worldhandler.config.key.settings.watch");
SMOOTH_WATCH = config.getBoolean("smooth_watch", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.settings.smooth_watch"), "gui.worldhandler.config.key.settings.smooth_watch");
PAUSE = config.getBoolean("pause_game", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.pause_game"), "gui.worldhandler.config.key.settings.pause_game");
CUSTOM_TIMES = config.getBoolean("custom_times", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.settings.custom_times"), "gui.worldhandler.config.key.settings.custom_times");
PERMISSION_QUERY = config.getBoolean("permission_query", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.settings.permission_query"), "gui.worldhandler.config.key.settings.permission_query");
HIGHLIGHT_BLOCKS = config.getBoolean("highlight_blocks", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.settings.highlight_blocks"), "gui.worldhandler.config.key.settings.highlight_blocks");
DAWN = config.getInt("custom_time_dawn", CATEGORY, 1000, 0, 24000, I18n.format("gui.worldhandler.config.comment.settings.custom_time_dawn"), "gui.worldhandler.config.key.settings.custom_time_dawn");
NOON = config.getInt("custom_time_noon", CATEGORY, 6000, 0, 24000, I18n.format("gui.worldhandler.config.comment.settings.custom_time_noon"), "gui.worldhandler.config.key.settings.custom_time_noon");
SUNSET = config.getInt("custom_time_sunset", CATEGORY, 12500, 0, 24000, I18n.format("gui.worldhandler.config.comment.settings.custom_time_sunset"), "gui.worldhandler.config.key.settings.custom_time_sunset");
MIDNIGHT = config.getInt("custom_time_midnight", CATEGORY, 18000, 0, 24000, I18n.format("gui.worldhandler.config.comment.settings.custom_time_midnight"), "gui.worldhandler.config.key.settings.custom_time_midnight");
BLOCK_PLACING_MODE = config.getString("block_placing_mode", CATEGORY, "keep", I18n.format("gui.worldhandler.config.comment.settings.block_placing_mode"), new String[]{"keep", "replace", "destroy"}, "gui.worldhandler.config.key.settings.block_placing_mode");
if(config.hasChanged())
{
config.save();
}
}
public static boolean isBiomeIndicatorEnabled()
{
return BIOME_INDICATOR;
}
public static boolean isCommandSyntaxEnabled()
{
return COMMAND_SYNTAX;
}
public static boolean areShortcutsEnabled()
{
return SHORTCUTS;
}
public static boolean arePosShortcutsEnabled()
{
return SHORTCUT_KEYS;
}
public static boolean areTooltipsEnabled()
{
return TOOLTIPS;
}
public static boolean isWatchEnabled()
{
return WATCH;
}
public static boolean isSmoothWatchEnabled()
{
return SMOOTH_WATCH;
}
public static boolean isPauseEnabled()
{
return PAUSE;
}
public static boolean isCustomTimeEnabled()
{
return CUSTOM_TIMES;
}
public static boolean isPermissionQueryEnabled()
{
return PERMISSION_QUERY;
}
public static boolean isHighlightBlocksEnabled()
{
return HIGHLIGHT_BLOCKS;
}
public static int getDawn()
{
return DAWN;
}
public static int getNoon()
{
return NOON;
}
public static int getSunset()
{
return SUNSET;
}
public static int getMidnight()
{
return MIDNIGHT;
}
public static String getMode()
{
return BLOCK_PLACING_MODE;
}
}

View File

@@ -1,127 +0,0 @@
package exopandora.worldhandler.config;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ConfigSkin
{
private static int ICON_SIZE;
private static int LABEL_COLOR;
private static int HEADLINE_COLOR;
private static int BACKGROUND_RED;
private static int BACKGROUND_GREEN;
private static int BACKGROUND_BLUE;
private static int BACKGROUND_ALPHA;
private static int BUTTON_RED;
private static int BUTTON_GREEN;
private static int BUTTON_BLUE;
private static int BUTTON_ALPHA;
private static String TYPE;
private static boolean SHARP_EDGES;
private static boolean DRAW_BACKGROUND;
public static final String CATEGORY = "skin";
public static void load(Configuration config)
{
ICON_SIZE = Integer.valueOf(config.getString("icon_size", CATEGORY, "16", I18n.format("gui.worldhandler.config.comment.skin.icons"), new String[]{"16", "32", "64"}, "gui.worldhandler.config.key.skin.icons"));
LABEL_COLOR = config.getInt("label_color", CATEGORY, 0x1F1F1F, 0x80000000, 0x7FFFFFFF, I18n.format("gui.worldhandler.config.comment.skin.label_color"), "gui.worldhandler.config.key.skin.label_color");
HEADLINE_COLOR = config.getInt("headline_color", CATEGORY, 0x4F4F4F, 0x80000000, 0x7FFFFFFF, I18n.format("gui.worldhandler.config.comment.skin.headline_color"), "gui.worldhandler.config.key.skin.headline_color");
BACKGROUND_RED = config.getInt("background_red", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.background_red"), "gui.worldhandler.config.key.skin.background_red");
BACKGROUND_GREEN = config.getInt("background_green", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.background_green"), "gui.worldhandler.config.key.skin.background_green");
BACKGROUND_BLUE = config.getInt("background_blue", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.background_blue"), "gui.worldhandler.config.key.skin.background_blue");
BACKGROUND_ALPHA = config.getInt("background_alpha", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.background_alpha"), "gui.worldhandler.config.key.skin.background_alpha");
BUTTON_RED = config.getInt("button_red", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.button_red"), "gui.worldhandler.config.key.skin.button_red");
BUTTON_GREEN = config.getInt("button_green", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.button_green"), "gui.worldhandler.config.key.skin.button_green");
BUTTON_BLUE = config.getInt("button_blue", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.button_blue"), "gui.worldhandler.config.key.skin.button_blue");
BUTTON_ALPHA = config.getInt("button_alpha", CATEGORY, 255, 0, 255, I18n.format("gui.worldhandler.config.comment.skin.button_alpha"), "gui.worldhandler.config.key.skin.button_alpha");
TYPE = config.getString("textures", CATEGORY, "resourcepack", I18n.format("gui.worldhandler.config.comment.skin.textures"), new String[]{"resourcepack", "vanilla"}, "gui.worldhandler.config.key.skin.textures");
SHARP_EDGES = config.getBoolean("sharp_tab_edges", CATEGORY, false, I18n.format("gui.worldhandler.config.comment.skin.sharp_tab_edges"), "gui.worldhandler.config.key.skin.sharp_tab_edges");
DRAW_BACKGROUND = config.getBoolean("draw_background", CATEGORY, true, I18n.format("gui.worldhandler.config.comment.skin.draw_background"), "gui.worldhandler.config.key.skin.draw_background");
if(config.hasChanged())
{
config.save();
}
}
public static int getIconSize()
{
return ICON_SIZE;
}
public static int getLabelColor()
{
return LABEL_COLOR;
}
public static int getHeadlineColor()
{
return HEADLINE_COLOR;
}
public static int getBackgroundRed()
{
return BACKGROUND_RED;
}
public static int getBackgroundGreen()
{
return BACKGROUND_GREEN;
}
public static int getBackgroundBlue()
{
return BACKGROUND_BLUE;
}
public static int getButtonRed()
{
return BUTTON_RED;
}
public static int getButtonGreen()
{
return BUTTON_GREEN;
}
public static int getButtonBlue()
{
return BUTTON_BLUE;
}
public static String getTextureType()
{
return TYPE;
}
public static boolean areSharpEdgesEnabled()
{
return SHARP_EDGES;
}
public static boolean isBackgroundDrawingEnabled()
{
return DRAW_BACKGROUND;
}
public static int getBackgroundAlpha()
{
return BACKGROUND_ALPHA;
}
public static int getButtonAlpha()
{
return BUTTON_ALPHA;
}
}

View File

@@ -1,84 +0,0 @@
package exopandora.worldhandler.config;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ConfigSliders
{
private static double MAX_POTION_AMPLIFIER;
private static double MAX_ITEM_ENCHANTENT;
private static double MAX_ITEM_ATTRIBUTES;
private static double MAX_SUMMON_POTION_AMPLIFIER;
private static double MAX_SUMMON_POTION_MINUTES;
private static double MAX_SUMMON_ATTRIBUTES;
private static double MAX_EXPERIENCE;
private static double MAX_PLAYER_POINTS;
public static final String CATEGORY = "sliders";
public static void load(Configuration config)
{
MAX_POTION_AMPLIFIER = config.get(CATEGORY, "max_potion_amplifier", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_potion_amplifier"), 0D, Byte.MAX_VALUE).setLanguageKey("gui.worldhandler.config.key.sliders.max_potion_amplifier").getDouble();
MAX_ITEM_ENCHANTENT = config.get(CATEGORY, "max_item_enchantment", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_item_enchantment"), 0D, Integer.MAX_VALUE).setLanguageKey("gui.worldhandler.config.key.sliders.max_item_enchantment").getDouble();
MAX_ITEM_ATTRIBUTES = config.get(CATEGORY, "max_item_attributes", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_item_attributes"), 0D, Double.MAX_VALUE).setLanguageKey("gui.worldhandler.config.key.sliders.max_item_attributes").getDouble();
MAX_SUMMON_POTION_AMPLIFIER = config.get(CATEGORY, "max_summon_potion_amplifier", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_summon_potion_amplifier"), 0D, Byte.MAX_VALUE).setLanguageKey("gui.worldhandler.config.key.sliders.max_summon_potion_amplifier").getDouble();
MAX_SUMMON_POTION_MINUTES = config.get(CATEGORY, "max_summon_potion_minutes", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_summon_potion_minutes"), 0D, 16000).setLanguageKey("gui.worldhandler.config.key.sliders.max_summon_potion_minutes").getDouble();
MAX_SUMMON_ATTRIBUTES = config.get(CATEGORY, "max_summon_attributes", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_summon_attributes"), 0D, Double.MAX_VALUE).setLanguageKey("gui.worldhandler.config.key.sliders.max_summon_attributes").getDouble();
MAX_EXPERIENCE = config.get(CATEGORY, "max_experience", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_experience"), 0D, 100000D).setLanguageKey("gui.worldhandler.config.key.sliders.max_experience").getDouble();
MAX_PLAYER_POINTS = config.get(CATEGORY, "max_player_points", 100D, I18n.format("gui.worldhandler.config.comment.sliders.max_player_points"), 0D, 100000D).setLanguageKey("gui.worldhandler.config.key.sliders.max_player_points").getDouble();
if(config.hasChanged())
{
config.save();
}
}
public static double getMaxPotionAmplifier()
{
return MAX_POTION_AMPLIFIER;
}
public static double getMaxItemEnchantment()
{
return MAX_ITEM_ENCHANTENT;
}
public static double getMaxItemAttributes()
{
return MAX_ITEM_ATTRIBUTES;
}
public static double getMaxSummonPotionAmplifier()
{
return MAX_SUMMON_POTION_AMPLIFIER;
}
public static double getMaxSummonPotionMinutes()
{
return MAX_SUMMON_POTION_MINUTES;
}
public static double getMaxSummonAttributes()
{
return MAX_SUMMON_ATTRIBUTES;
}
public static double getMaxExperience()
{
return MAX_EXPERIENCE;
}
public static double getMaxPlayerPoints()
{
return MAX_PLAYER_POINTS;
}
}