From f438369f513439528e59ff316c4d684eee18eaf2 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 17 Nov 2015 00:17:35 -0500 Subject: [PATCH] Make settings use Exposable, remove singleton of PonyManager --- .../minelittlepony/MineLittlePony.java | 82 +++-------- .../java/com/brohoof/minelittlepony/Pony.java | 21 +-- .../brohoof/minelittlepony/PonyConfig.java | 133 ++++++++++-------- .../com/brohoof/minelittlepony/PonyLevel.java | 19 +-- .../brohoof/minelittlepony/PonyManager.java | 107 +------------- .../com/brohoof/minelittlepony/Value.java | 45 ++++++ .../gui/FakeVoxelPropertyToggleBox.java | 56 ++------ .../gui/IPropertyProviderEnum.java | 10 ++ .../minelittlepony/gui/MineLittlePonyGUI.java | 50 ++++--- .../gui/MineLittlePonyGUIMob.java | 41 +++--- .../minelittlepony/gui/VoxelPropertyEnum.java | 110 +++++++++++++++ .../hdskins/gui/GuiSkinsMineLP.java | 14 +- .../hdskins/gui/RenderPonyModel.java | 2 +- .../model/pony/pm_newPonyAdv.java | 2 +- .../minelittlepony/renderer/RenderPony.java | 10 +- .../renderer/RenderPonyMob.java | 2 +- .../renderer/RenderPonyVillager.java | 4 +- .../assets/minelittlepony/lang/en_US.lang | 6 +- .../assets/minelittlepony/lang/fr_FR.lang | 6 +- .../assets/minelittlepony/lang/ru_RU.lang | 6 +- 20 files changed, 383 insertions(+), 343 deletions(-) create mode 100644 src/main/java/com/brohoof/minelittlepony/Value.java create mode 100644 src/main/java/com/brohoof/minelittlepony/gui/IPropertyProviderEnum.java create mode 100644 src/main/java/com/brohoof/minelittlepony/gui/VoxelPropertyEnum.java diff --git a/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java b/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java index 1f392500..60232d83 100644 --- a/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java +++ b/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java @@ -30,17 +30,19 @@ import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityVillager; public class MineLittlePony implements InitCompleteListener { - public static final String MOD_VERSION = "1.8-UNOFFICIAL"; + + public static final String MOD_VERSION = "@VERSION@"; public static final String MOD_NAME = "Mine Little Pony"; public static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com"; public static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com"; public static final String UPLOAD_URL = "http://minelpskinmanager.voxelmodpack.com/"; private static final KeyBinding guiKeybinding = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony"); private static final KeyBinding skinKeybinding = new KeyBinding("Skin Manager", Keyboard.KEY_F1, "Mine Little Pony"); + + private static MineLittlePony instance; + private PonyConfig config; private PonyManager ponyManager; - private String spUsername; - private static MineLittlePony instance; public MineLittlePony() { instance = this; @@ -67,56 +69,19 @@ public class MineLittlePony implements InitCompleteListener { public void init(File configPath) { LiteLoader.getInput().registerKeyBinding(guiKeybinding); LiteLoader.getInput().registerKeyBinding(skinKeybinding); + SettingsPanelManager.addSettingsPanel("Pony", MineLittlePonyGUI.class); SettingsPanelManager.addSettingsPanel("Pony Mobs", MineLittlePonyGUIMob.class); - this.ponyManager = PonyManager.getInstance(); + this.config = new PonyConfig(); + this.ponyManager = new PonyManager(config); - int readInt = this.config.getIntPropertySafe("ponylevel", 0, 2); - this.ponyManager.setPonyLevel(PonyLevel.parse(readInt)); - MineLPLogger.info("Pony level is set to %d.", Integer.valueOf(readInt)); - - readInt = this.config.getIntPropertySafe("sizes", 0, 1); - this.ponyManager.setUseSizes(readInt); - MineLPLogger.info("Different pony sizes are %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("ponyarmor", 0, 1); - this.ponyManager.setPonyArmor(readInt); - MineLPLogger.info("Pony armor is %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("snuzzles", 0, 1); - this.ponyManager.setShowSnuzzles(readInt); - MineLPLogger.info("Snuzzels are %s.", readInt == 0 ? "disabled (You are a bad pony)" : "enabled"); - - readInt = this.config.getIntPropertySafe("hd", 0, 1); - this.ponyManager.setHD(readInt); - MineLPLogger.info("MineLittlePony skin server is %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("showscale", 0, 1); - this.ponyManager.setShowScale(readInt); - MineLPLogger.info("Show-accurate scaling is %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("villagers", 0, 1); - this.ponyManager.setPonyVillagers(readInt); - MineLPLogger.info("Pony villagers are %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("zombies", 0, 1); - this.ponyManager.setPonyZombies(readInt); - MineLPLogger.info("Pony zombies are %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("pigzombies", 0, 1); - this.ponyManager.setPonyPigzombies(readInt); - MineLPLogger.info("Pony pigzombies are %s.", readInt == 0 ? "disabled" : "enabled"); - - readInt = this.config.getIntPropertySafe("skeletons", 0, 1); - this.ponyManager.setPonySkeletons(readInt); - MineLPLogger.info("Pony skeletons are %s.", readInt == 0 ? "disabled" : "enabled"); + LiteLoader.getInstance().registerExposable(config, null); } @Override public void onInitCompleted(Minecraft minecraft, LiteLoader loader) { - this.spUsername = minecraft.getSession().getUsername(); - if (this.ponyManager.getHD() == 1) { + if (this.config.getHd().get()) { HDSkinManager.clearSkinCache(); HDSkinManager.setSkinUrl(SKIN_SERVER_URL); HDSkinManager.setGatewayURL(GATEWAY_URL); @@ -124,22 +89,22 @@ public class MineLittlePony implements InitCompleteListener { } RenderManager rm = minecraft.getRenderManager(); ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm)); - if (this.ponyManager.getPonyVillagers() == 1) { + if (this.config.getVillagers().get()) { ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm)); MineLPLogger.info("Villagers are now ponies."); } - if (this.ponyManager.getPonyZombies() == 1) { + if (this.config.getZombies().get()) { ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie(rm)); MineLPLogger.info("Zombies are now ponies."); } - if (this.ponyManager.getPonyPigzombies() == 1) { + if (this.config.getPigZombies().get()) { ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyZombie(rm)); MineLPLogger.info("Zombie pigmen are now ponies."); } - if (this.ponyManager.getPonySkeletons() == 1) { + if (this.config.getSkeletons().get()) { ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm)); MineLPLogger.info("Skeletons are now ponies."); } @@ -148,32 +113,29 @@ public class MineLittlePony implements InitCompleteListener { @Override public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) { - this.ponyManager.setPonyLevel(PonyLevel.parse(this.config.getIntPropertySafe("ponylevel", 0, 2))); - this.ponyManager.setUseSizes(this.config.getIntPropertySafe("sizes")); - this.ponyManager.setPonyArmor(this.config.getIntPropertySafe("ponyarmor")); - this.ponyManager.setShowSnuzzles(this.config.getIntPropertySafe("snuzzles")); - this.ponyManager.setShowScale(this.config.getIntPropertySafe("showscale")); if (inGame && minecraft.currentScreen == null && guiKeybinding.isPressed()) { minecraft.displayGuiScreen(new MineLittlePonyGUI()); } - // if (Keyboard.isKeyDown(Keyboard.KEY_O)) { - // ponyManager.initmodels(); - // } boolean pressed = minecraft.currentScreen instanceof GuiMainMenu && Keyboard.isKeyDown(skinKeybinding.getKeyCode()); boolean skins = minecraft.currentScreen instanceof GuiSkins && !(minecraft.currentScreen instanceof GuiSkinsMineLP); if (pressed || skins) { - minecraft.displayGuiScreen(new GuiSkinsMineLP()); + minecraft.displayGuiScreen(new GuiSkinsMineLP(ponyManager)); } } - public static ModConfig getConfig() { + public PonyManager getManager() { + return this.ponyManager; + } + + public static PonyConfig getConfig() { return getInstance().config; } public static String getSPUsername() { - return getInstance().spUsername; + return Minecraft.getMinecraft().getSession().getUsername(); } + } diff --git a/src/main/java/com/brohoof/minelittlepony/Pony.java b/src/main/java/com/brohoof/minelittlepony/Pony.java index ceebdb26..e175a9bd 100644 --- a/src/main/java/com/brohoof/minelittlepony/Pony.java +++ b/src/main/java/com/brohoof/minelittlepony/Pony.java @@ -20,7 +20,9 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class Pony { - public static PonyManager ponyManager = PonyManager.getInstance(); + + private static PonyConfig config = MineLittlePony.getConfig(); + public PonyRace race = PonyRace.EARTH; public boolean advancedTexturing; public ResourceLocation textureResourceLocation; @@ -50,13 +52,15 @@ public class Pony { public Pony(AbstractClientPlayer player) { this.textureResourceLocation = player.getLocationSkin(); - MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId, player.getCommandSenderName(), player.getUniqueID(), this.textureResourceLocation); + MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId, + player.getCommandSenderName(), player.getUniqueID(), this.textureResourceLocation); this.checkSkin(this.textureResourceLocation); } public Pony(ResourceLocation aTextureResourceLocation) { this.textureResourceLocation = aTextureResourceLocation; - MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation); + MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, + this.textureResourceLocation); this.checkSkin(this.textureResourceLocation); } @@ -84,7 +88,8 @@ public class Pony { BufferedImage skinImage = null; try { - skinImage = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation).getInputStream()); + skinImage = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation) + .getInputStream()); MineLPLogger.debug("Obtained skin from resource location %s", textureResourceLocation); this.checkSkin(skinImage); } catch (Exception var6) { @@ -188,7 +193,7 @@ public class Pony { Color scootaloo = new Color(255, 190, 83); Color bigmac = new Color(206, 50, 84); Color luna = new Color(42, 60, 120); - if (ponyManager.getUseSizes() == 1) { + if (config.getSizes().get()) { if (sizecolor.equals(scootaloo)) { this.size = 0; } else if (sizecolor.equals(bigmac)) { @@ -273,7 +278,7 @@ public class Pony { } public int size() { - return ponyManager.getUseSizes() == 1 ? this.size : 1; + return config.getSizes().get() ? this.size : 1; } public boolean advancedTexturing() { @@ -358,11 +363,11 @@ public class Pony { public PlayerModel getModel(boolean ignorePony) { boolean is_a_pony = false; - switch (ignorePony ? PonyLevel.MIXED : ponyManager.getPonyLevel()) { + switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel().get()) { case HUMANS: is_a_pony = false; break; - case MIXED: + case BOTH: is_a_pony = isPonySkin; break; case PONIES: diff --git a/src/main/java/com/brohoof/minelittlepony/PonyConfig.java b/src/main/java/com/brohoof/minelittlepony/PonyConfig.java index 792228b9..ada02857 100644 --- a/src/main/java/com/brohoof/minelittlepony/PonyConfig.java +++ b/src/main/java/com/brohoof/minelittlepony/PonyConfig.java @@ -1,69 +1,90 @@ package com.brohoof.minelittlepony; -import com.minelittlepony.minelp.util.MineLPLogger; -import com.voxelmodpack.common.properties.ModConfig; +import java.io.File; -public class PonyConfig extends ModConfig { - @Override - protected void setDefaults() { - this.defaults.setProperty("ponylevel", "2"); - this.defaults.setProperty("sizes", "1"); - this.defaults.setProperty("ponyarmor", "1"); - this.defaults.setProperty("snuzzles", "1"); - this.defaults.setProperty("hd", "1"); - this.defaults.setProperty("showscale", "1"); - this.defaults.setProperty("eqg", "0"); - this.defaults.setProperty("villagers", "1"); - this.defaults.setProperty("zombies", "1"); - this.defaults.setProperty("pigzombies", "1"); - this.defaults.setProperty("skeletons", "1"); - this.defaults.setProperty("oldSkinUploaded", "0"); +import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; +import com.mumfrey.liteloader.modconfig.AdvancedExposable; +import com.mumfrey.liteloader.modconfig.ConfigStrategy; +import com.mumfrey.liteloader.modconfig.ExposableOptions; + +import net.minecraft.util.EnumTypeAdapterFactory; + +@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned) +public class PonyConfig implements AdvancedExposable { + + @Expose + private Value ponylevel = new Value(PonyLevel.PONIES); + @Expose + private Value sizes = new Value(true); + @Expose + private Value ponyarmor = new Value(true); + @Expose + private Value snuzzles = new Value(true); + @Expose + private Value hd = new Value(true); + @Expose + private Value showscale = new Value(true); + @Expose + private Value villagers = new Value(true); + @Expose + private Value zombies = new Value(true); + @Expose + private Value pigzombies = new Value(true); + @Expose + private Value skeletons = new Value(true); + + public Value getPonyLevel() { + if (ponylevel.get() == null) + ponylevel.set(PonyLevel.PONIES); + return ponylevel; } - public PonyConfig() { - super("Mine Little Pony", "minelittlepony.properties"); + public Value getSizes() { + return sizes; + } + + public Value getPonyArmor() { + return ponyarmor; + } + + public Value getSnuzzles() { + return snuzzles; + } + + public Value getHd() { + return hd; + } + + public Value getShowScale() { + return showscale; + } + + public Value getVillagers() { + return villagers; + } + + public Value getZombies() { + return zombies; + } + + public Value getPigZombies() { + return pigzombies; + } + + public Value getSkeletons() { + return skeletons; } @Override - public String getOptionDisplayString(String binding) { - return ""; + public void setupGsonSerialiser(GsonBuilder gsonBuilder) { + gsonBuilder.registerTypeAdapterFactory(new EnumTypeAdapterFactory()) + .registerTypeAdapter(Value.class, new Value.Serializer()); } - public int getIntPropertySafe(String key) { - return this.getIntPropertySafe(key, Integer.MIN_VALUE, Integer.MAX_VALUE); + @Override + public File getConfigFile(File configFile, File configFileLocation, String defaultFileName) { + return null; } - public int getIntPropertySafe(String key, int minValue, int maxValue) { - int value; - try { - value = this.getIntProperty(key); - } catch (Exception var9) { - try { - boolean e2 = this.getBoolProperty(key); - if (e2) { - value = 1; - } else { - value = 0; - } - } catch (Exception var8) { - int defaultValue1 = this.getDefaultIntProperty(key); - this.setProperty(key, defaultValue1); - MineLPLogger.error("Invalid value for config key \"%s\", using default value %d", key, defaultValue1); - return defaultValue1; - } - } - - if (value >= minValue && value <= maxValue) { - return value; - } - int defaultValue = value = this.getDefaultIntProperty(key); - this.setProperty(key, defaultValue); - MineLPLogger.error("Invalid value for config key \"%s\", using default value %d. Found %d, expected value between %d and %d.", - key, defaultValue, value, minValue, maxValue); - return defaultValue; - } - - public boolean isSet(String key) { - return this.config.containsKey(key); - } } diff --git a/src/main/java/com/brohoof/minelittlepony/PonyLevel.java b/src/main/java/com/brohoof/minelittlepony/PonyLevel.java index 51cad3f6..5aaa3f69 100644 --- a/src/main/java/com/brohoof/minelittlepony/PonyLevel.java +++ b/src/main/java/com/brohoof/minelittlepony/PonyLevel.java @@ -1,23 +1,8 @@ package com.brohoof.minelittlepony; public enum PonyLevel { + PONIES, HUMANS, - MIXED; - - private static final PonyLevel[] oldValues = { HUMANS, MIXED, PONIES }; - - public static PonyLevel parse(int intValue) { - if (intValue < 0) - intValue = 0; - if (intValue > 2) - intValue = 2; - // it's an old value - return oldValues[intValue]; - } - - @Override - public String toString() { - return name().toString(); - } + BOTH; } diff --git a/src/main/java/com/brohoof/minelittlepony/PonyManager.java b/src/main/java/com/brohoof/minelittlepony/PonyManager.java index 7a8570b5..b382bc42 100644 --- a/src/main/java/com/brohoof/minelittlepony/PonyManager.java +++ b/src/main/java/com/brohoof/minelittlepony/PonyManager.java @@ -30,21 +30,14 @@ public class PonyManager { public static List villagerResourceLocations; private static final int MAX_BGPONY_COUNT = 141; private static int numberOfPonies; + + private PonyConfig config; + private Map ponyResourceRegistry = new HashMap(); private Map backgroudPonyResourceRegistry = new HashMap(); - private PonyLevel ponyLevel = PonyLevel.PONIES; - private int useSizes = 1; - private int ponyArmor = 1; - private int showSnuzzles = 1; - private int showScale = 1; - private int ponyVillagers = 1; - private int ponyZombies = 1; - private int ponyPigzombies = 1; - private int ponySkeletons = 1; - private int useHDSkinServer = 1; - private static PonyManager instance; - private PonyManager() { + public PonyManager(PonyConfig config) { + this.config = config; initmodels(); } @@ -54,14 +47,6 @@ public class PonyManager { MineLPLogger.info("Done initializing models."); } - public static PonyManager getInstance() { - if (instance == null) { - instance = new PonyManager(); - } - - return instance; - } - private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) { Pony myLittlePony; if (!this.ponyResourceRegistry.containsKey(skinResourceLocation)) { @@ -85,7 +70,7 @@ public class PonyManager { public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) { Pony myLittlePony = this.getPonyFromResourceRegistry(player.getLocationSkin(), player); - if (this.ponyLevel == PonyLevel.PONIES && !myLittlePony.isPonySkin()) { + if (config.getPonyLevel().get() == PonyLevel.PONIES && !myLittlePony.isPonySkin()) { myLittlePony = this.getPonyFromBackgroundResourceRegistry(player); } @@ -142,90 +127,10 @@ public class PonyManager { return myLittlePony; } - public int getHD() { - return this.useHDSkinServer; - } - public int getNumberOfPonies() { return numberOfPonies; } - public int getPonyArmor() { - return this.ponyArmor; - } - - public PonyLevel getPonyLevel() { - return this.ponyLevel; - } - - public int getPonyPigzombies() { - return this.ponyPigzombies; - } - - public int getPonySkeletons() { - return this.ponySkeletons; - } - - public int getPonyVillagers() { - return this.ponyVillagers; - } - - public int getPonyZombies() { - return this.ponyZombies; - } - - public int getShowScale() { - return this.showScale; - } - - public int getShowSnuzzles() { - return this.showSnuzzles; - } - - public int getUseSizes() { - return this.useSizes; - } - - public void setHD(int useHDSkinServer) { - this.useHDSkinServer = useHDSkinServer; - } - - public void setPonyArmor(int ponyArmor) { - this.ponyArmor = ponyArmor; - } - - public void setPonyLevel(PonyLevel ponyLevel) { - this.ponyLevel = ponyLevel; - } - - public void setPonyPigzombies(int ponyPigzombies) { - this.ponyPigzombies = ponyPigzombies; - } - - public void setPonySkeletons(int ponySkeletons) { - this.ponySkeletons = ponySkeletons; - } - - public void setPonyVillagers(int ponyVillagers) { - this.ponyVillagers = ponyVillagers; - } - - public void setPonyZombies(int ponyZombies) { - this.ponyZombies = ponyZombies; - } - - public void setShowScale(int showScale) { - this.showScale = showScale; - } - - public void setShowSnuzzles(int showSnuzzles) { - this.showSnuzzles = showSnuzzles; - } - - public void setUseSizes(int useSizes) { - this.useSizes = useSizes; - } - static { for (int check = 0; check < MAX_BGPONY_COUNT; ++check) { backgroundPonyResourceLocations diff --git a/src/main/java/com/brohoof/minelittlepony/Value.java b/src/main/java/com/brohoof/minelittlepony/Value.java new file mode 100644 index 00000000..02048f0f --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/Value.java @@ -0,0 +1,45 @@ +package com.brohoof.minelittlepony; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mumfrey.liteloader.core.LiteLoader; + +public class Value { + + private T value; + + public Value(T value) { + this.value = value; + } + + public T get() { + return value; + } + + public void set(T val) { + this.value = val; + LiteLoader.getInstance().writeConfig(MineLittlePony.getConfig()); + } + + public static class Serializer implements JsonSerializer>, JsonDeserializer> { + + @Override + public Value deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { + Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0]; + return new Value(context.deserialize(json, type)); + } + + @Override + public JsonElement serialize(Value src, Type typeOfSrc, JsonSerializationContext context) { + return context.serialize(src.get()); + } + } +} diff --git a/src/main/java/com/brohoof/minelittlepony/gui/FakeVoxelPropertyToggleBox.java b/src/main/java/com/brohoof/minelittlepony/gui/FakeVoxelPropertyToggleBox.java index b6725695..994dc004 100644 --- a/src/main/java/com/brohoof/minelittlepony/gui/FakeVoxelPropertyToggleBox.java +++ b/src/main/java/com/brohoof/minelittlepony/gui/FakeVoxelPropertyToggleBox.java @@ -1,38 +1,30 @@ -package com.minelittlepony.minelp.gui; +package com.brohoof.minelittlepony.gui; +import com.brohoof.minelittlepony.Value; import com.voxelmodpack.common.LiteModVoxelCommon; import com.voxelmodpack.common.gui.interfaces.IExtendedGui; import com.voxelmodpack.common.properties.VoxelProperty; -import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProvider; import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProviderInteger; -public class FakeVoxelPropertyCheckBox extends VoxelProperty { +import net.minecraft.client.resources.I18n; + +public class FakeVoxelPropertyToggleBox extends VoxelProperty { + + private Value value; private int width = 11; - public FakeVoxelPropertyCheckBox(IVoxelPropertyProvider propertyProvider, String binding, String text, int xPos, + public FakeVoxelPropertyToggleBox(Value value, String text, int xPos, int yPos) { - super(propertyProvider, binding, text, xPos, yPos); - this.width = this.fontRenderer.getStringWidth(this.displayText) + 20; + super(null, null, text, xPos, yPos); + this.value = value; + this.width = this.fontRenderer.getStringWidth(I18n.format(this.displayText)) + 20; } @Override public void draw(IExtendedGui host, int mouseX, int mouseY) { - this.drawString(this.fontRenderer, this.displayText, this.xPosition + 20, this.yPosition + 2, 16777215); + this.drawString(this.fontRenderer, I18n.format(this.displayText), this.xPosition + 20, this.yPosition + 2, 16777215); boolean overButton = this.mouseOver(mouseX, mouseY); - boolean checked = true; - - try { - int e = this.propertyProvider.getIntProperty(this.propertyBinding); - if (e < 2 && e > -1) { - if (e == 0) { - checked = false; - } else { - checked = true; - } - } - } catch (Exception var7) { - - } + boolean checked = this.value.get(); host.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, this.xPosition, this.yPosition, this.xPosition + 11, this.yPosition + 11, 0, overButton ? 16 : 0, 16, overButton ? 32 : 16, 4); @@ -43,28 +35,8 @@ public class FakeVoxelPropertyCheckBox extends VoxelProperty -1) { - if (e == 0) { - checked = false; - } else { - checked = true; - } - } - } catch (Exception var5) { - - } - - if (checked) { - this.propertyProvider.setProperty(this.propertyBinding, 0); - } else { - this.propertyProvider.setProperty(this.propertyBinding, 1); - } + value.set(!value.get()); } - } public boolean mouseOver(int mouseX, int mouseY) { diff --git a/src/main/java/com/brohoof/minelittlepony/gui/IPropertyProviderEnum.java b/src/main/java/com/brohoof/minelittlepony/gui/IPropertyProviderEnum.java new file mode 100644 index 00000000..1604880e --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/gui/IPropertyProviderEnum.java @@ -0,0 +1,10 @@ +package com.brohoof.minelittlepony.gui; + +import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProvider; + +public interface IPropertyProviderEnum> extends IVoxelPropertyProvider { + + void setProperty(String key, E val); + + E getEnumProperty(String key); +} diff --git a/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUI.java b/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUI.java index 3788ee3e..56ecb663 100644 --- a/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUI.java +++ b/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUI.java @@ -3,6 +3,8 @@ package com.brohoof.minelittlepony.gui; import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.PonyConfig; import com.brohoof.minelittlepony.PonyLevel; +import com.brohoof.minelittlepony.Value; +import com.mumfrey.liteloader.core.LiteLoader; import com.voxelmodpack.common.properties.VoxelProperty; import com.voxelmodpack.common.properties.VoxelPropertyLabel; import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel; @@ -11,35 +13,43 @@ import net.minecraft.client.resources.I18n; public class MineLittlePonyGUI extends GuiVoxelBoxSettingsPanel { - private static final String pref = "minelp.options."; + private static final String _PREFIX = "minelp.options."; + private static final String TITLE = _PREFIX + "title"; + private static final String PONY_LEVEL = _PREFIX + "ponylevel"; + private static final String OPTIONS = _PREFIX + "options"; + private static final String HD = _PREFIX + "hd"; + private static final String SIZES = _PREFIX + "sizes"; + private static final String PONY_ARMOR = _PREFIX + "ponyarmor"; + private static final String SNUZZLES = _PREFIX + "snuzzles"; + private static final String SHOW_SCALE = _PREFIX + "showscale"; - private final String title = I18n.format(pref + "title"); - private final String ponylevel = I18n.format(pref + "ponylevel"); - private final String options = I18n.format(pref + "options"); - private final String hd = I18n.format(pref + "hd"); - private final String sizes = I18n.format(pref + "sizes"); - private final String ponyarmor = I18n.format(pref + "ponyarmor"); - private final String snuzzles = I18n.format(pref + "snuzzles"); - private final String showscale = I18n.format(pref + "showscale"); + private PonyConfig config; public MineLittlePonyGUI() { this.config = MineLittlePony.getConfig(); - byte col1 = 30; - this.properties.add(new VoxelPropertyIntSlider(this.config, "ponylevel", ponylevel, PANEL_LEFT, PANEL_TOP + 24)); - this.properties.add(new VoxelPropertyLabel(options, PANEL_LEFT + 15, PANEL_TOP + 58)); - this.properties.add(check("hd", hd, PANEL_LEFT + col1, PANEL_TOP + 72)); - this.properties.add(check("sizes", sizes, PANEL_LEFT + col1, PANEL_TOP + 90)); - this.properties.add(check("ponyarmor", ponyarmor, PANEL_LEFT + col1, PANEL_TOP + 108)); - this.properties.add(check("snuzzles", snuzzles, PANEL_LEFT + col1, PANEL_TOP + 126)); - this.properties.add(check("showscale", showscale, PANEL_LEFT + col1, PANEL_TOP + 144)); + final byte col1 = 30; + int row = PANEL_TOP; + this.properties.add(new VoxelPropertyEnum(config.getPonyLevel(), PONY_LEVEL, PONY_LEVEL + ".", + PANEL_LEFT, row += 24, PonyLevel.class)); + this.properties.add(new VoxelPropertyLabel(I18n.format(OPTIONS), PANEL_LEFT + 15, row += 45)); + this.properties.add(check(config.getHd(), HD, PANEL_LEFT + col1, row += 15)); + this.properties.add(check(config.getSizes(), SIZES, PANEL_LEFT + col1, row += 15)); + this.properties.add(check(config.getPonyArmor(), PONY_ARMOR, PANEL_LEFT + col1, row += 15)); + this.properties.add(check(config.getSnuzzles(), SNUZZLES, PANEL_LEFT + col1, row += 15)); + this.properties.add(check(config.getShowScale(), SHOW_SCALE, PANEL_LEFT + col1, row += 15)); } - private VoxelProperty check(String binding, String text, int xPos, int yPos) { - return new FakeVoxelPropertyCheckBox(this.config, binding, text, xPos, yPos); + private VoxelProperty check(Value config, String text, int xPos, int yPos) { + return new FakeVoxelPropertyToggleBox(config, text, xPos, yPos); } @Override public String getPanelTitle() { - return title; + return I18n.format(TITLE); + } + + @Override + public void onGuiClosed() { + LiteLoader.getInstance().writeConfig(config); } } diff --git a/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUIMob.java b/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUIMob.java index d2fad70e..27706797 100644 --- a/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUIMob.java +++ b/src/main/java/com/brohoof/minelittlepony/gui/MineLittlePonyGUIMob.java @@ -2,6 +2,8 @@ package com.brohoof.minelittlepony.gui; import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.PonyConfig; +import com.brohoof.minelittlepony.Value; +import com.mumfrey.liteloader.core.LiteLoader; import com.voxelmodpack.common.properties.VoxelProperty; import com.voxelmodpack.common.properties.VoxelPropertyLabel; import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel; @@ -12,32 +14,39 @@ public class MineLittlePonyGUIMob extends GuiVoxelBoxSettingsPanel { private static final String pref = "minelp.mobs."; - private final String restart1 = I18n.format("minelp.restart1"); - private final String restart2 = I18n.format("minelp.restart2"); + private static final String restart1 = "minelp.restart1"; + private static final String restart2 = "minelp.restart2"; - private final String title = I18n.format(pref + "title"); - private final String villagers = I18n.format(pref + "villagers"); - private final String zombies = I18n.format(pref + "zombies"); - private final String zombiePigmen = I18n.format(pref + "zombiepigmen"); - private final String skeletons = I18n.format(pref + "skeletons"); + private static final String title = pref + "title"; + private static final String villagers = pref + "villagers"; + private static final String zombies = pref + "zombies"; + private static final String zombiePigmen = pref + "zombiepigmen"; + private static final String skeletons = pref + "skeletons"; + + private PonyConfig config; public MineLittlePonyGUIMob() { this.config = MineLittlePony.getConfig(); byte col1 = 30; - this.properties.add(new VoxelPropertyLabel(restart1, PANEL_LEFT + 15, PANEL_TOP + 11, 0xff6666)); - this.properties.add(new VoxelPropertyLabel(restart2, PANEL_LEFT + 15, PANEL_TOP + 23, 0xff6666)); - this.properties.add(check("villagers", villagers, PANEL_LEFT + col1, PANEL_TOP + 42)); - this.properties.add(check("zombies", zombies, PANEL_LEFT + col1, PANEL_TOP + 60)); - this.properties.add(check("pigzombies", zombiePigmen, PANEL_LEFT + col1, PANEL_TOP + 78)); - this.properties.add(check("skeletons", skeletons, PANEL_LEFT + col1, PANEL_TOP + 96)); + this.properties.add(new VoxelPropertyLabel(I18n.format(restart1), PANEL_LEFT + 15, PANEL_TOP + 11, 0xff6666)); + this.properties.add(new VoxelPropertyLabel(I18n.format(restart2), PANEL_LEFT + 15, PANEL_TOP + 23, 0xff6666)); + this.properties.add(check(config.getVillagers(), villagers, PANEL_LEFT + col1, PANEL_TOP + 42)); + this.properties.add(check(config.getZombies(), zombies, PANEL_LEFT + col1, PANEL_TOP + 60)); + this.properties.add(check(config.getPigZombies(), zombiePigmen, PANEL_LEFT + col1, PANEL_TOP + 78)); + this.properties.add(check(config.getSkeletons(), skeletons, PANEL_LEFT + col1, PANEL_TOP + 96)); } - private VoxelProperty check(String binding, String text, int xPos, int yPos) { - return new FakeVoxelPropertyCheckBox(this.config, binding, text, xPos, yPos); + private VoxelProperty check(Value config, String text, int xPos, int yPos) { + return new FakeVoxelPropertyToggleBox(config, text, xPos, yPos); } @Override public String getPanelTitle() { - return title; + return I18n.format(title); + } + + @Override + public void onGuiClosed() { + LiteLoader.getInstance().writeConfig(config); } } diff --git a/src/main/java/com/brohoof/minelittlepony/gui/VoxelPropertyEnum.java b/src/main/java/com/brohoof/minelittlepony/gui/VoxelPropertyEnum.java new file mode 100644 index 00000000..695fca14 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/gui/VoxelPropertyEnum.java @@ -0,0 +1,110 @@ +package com.brohoof.minelittlepony.gui; + +import com.brohoof.minelittlepony.Value; +import com.voxelmodpack.common.LiteModVoxelCommon; +import com.voxelmodpack.common.gui.interfaces.IExtendedGui; +import com.voxelmodpack.common.properties.VoxelProperty; + +import net.minecraft.client.resources.I18n; + +public class VoxelPropertyEnum> extends VoxelProperty> { + + private Value value; + private E[] possibleValues; + private String i18NPrefix; + private int height = 15; + + private int defaultX; + private int defaultW; + + public VoxelPropertyEnum(Value value, String displayText, String i18nPrefix, int xPos, int yPos, + Class eclass) { + super(null, null, displayText, xPos, yPos); + this.value = value; + this.i18NPrefix = i18nPrefix; + this.possibleValues = eclass.getEnumConstants(); + defaultX = xPosition + 150; + defaultW = 55; + } + + @Override + public void draw(IExtendedGui gui, int mouseX, int mouseY) { + boolean overReset = mouseOverReset(mouseX, mouseY); + int outset = overReset ? 1 : 0; + int v = overReset ? 16 : 0; + + drawRect(defaultX - outset, this.yPosition + 11 - outset, + defaultX + defaultW + outset - 1, this.yPosition + 26 + outset, + -16777216); + gui.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, + defaultX - 1 - outset, this.yPosition + 10 - outset, + defaultX + outset + defaultW, this.yPosition + 27 + outset, + 0, v, 16, 16 + v, 4); + this.drawString(this.mc.fontRendererObj, "Default", defaultX + 8, this.yPosition + 15, + overReset ? 16777215 : 10066329); + + if (this.displayText != null) { + this.drawString(this.mc.fontRendererObj, I18n.format(this.displayText), this.xPosition + 15, + this.yPosition - 14, 10079487); + } + + for (int i = 0; i < possibleValues.length; i++) { + drawRadio(gui, mouseX, mouseY, i); + } + + } + + public void drawRadio(IExtendedGui host, int mouseX, int mouseY, int idx) { + boolean overButton = this.mouseOver(mouseX, mouseY, idx); + boolean checked = this.possibleValues[idx] == value.get(); + + int xPos = xPosition + 30; + int yPos = yPosition + (height * idx); + + E e = possibleValues[idx]; + String text = I18n.format(i18NPrefix + e.toString().toLowerCase()); + this.drawString(this.fontRenderer, text, xPos + 20, yPos + 2, 0xffffff); + + // the border + host.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, xPos, yPos, + xPos + 11, yPos + 11, 0, overButton ? 16 : 0, 16, overButton ? 32 : 16, 4); + // the check + host.drawTexturedModalRect(LiteModVoxelCommon.GUIPARTS, xPos, yPos, xPos + 10, + yPos + 10, checked ? 12 : 0, 52, checked ? 23 : 11, 63); + } + + protected boolean mouseIn(int mouseX, int mouseY, int x1, int y1, int x2, int y2) { + return mouseX > x1 + 5 && mouseX < x2 + 5 && mouseY > y1 && mouseY < y2; + } + + protected boolean mouseOverReset(int mouseX, int mouseY) { + return mouseX > this.defaultX && mouseX < this.defaultX + this.defaultW + && mouseY > this.yPosition + 10 && mouseY < this.yPosition + 27; + } + + @Override + public void mouseClicked(int mouseX, int mouseY) { + if (mouseOverReset(mouseX, mouseY)) { + value.set(possibleValues[0]); + } else { + for (int i = 0; i < possibleValues.length; i++) { + if (mouseOver(mouseX, mouseY, i)) { + value.set(possibleValues[i]); + return; + } + } + } + } + + protected boolean mouseOver(int mouseX, int mouseY, int idx) { + E e = possibleValues[idx]; + int yPos = yPosition + (height * idx); + int width = 20 + mc.fontRendererObj.getStringWidth(I18n.format(i18NPrefix + e.toString().toLowerCase())); + + return mouseX > this.xPosition + 30 && mouseX < this.xPosition + width + 30 + && mouseY > yPos && mouseY < yPos + 11; + } + + @Override + public void keyTyped(char keyChar, int keyCode) {} +} diff --git a/src/main/java/com/brohoof/minelittlepony/hdskins/gui/GuiSkinsMineLP.java b/src/main/java/com/brohoof/minelittlepony/hdskins/gui/GuiSkinsMineLP.java index f5b2552e..90946168 100644 --- a/src/main/java/com/brohoof/minelittlepony/hdskins/gui/GuiSkinsMineLP.java +++ b/src/main/java/com/brohoof/minelittlepony/hdskins/gui/GuiSkinsMineLP.java @@ -11,6 +11,12 @@ import com.voxelmodpack.hdskins.gui.GuiSkins; public class GuiSkinsMineLP extends GuiSkins { + private PonyManager ponyManager; + + public GuiSkinsMineLP(PonyManager manager) { + this.ponyManager = manager; + } + @Override protected EntityPlayerModel getModel(GameProfile profile) { return new EntityPonyModel(profile); @@ -19,20 +25,20 @@ public class GuiSkinsMineLP extends GuiSkins { @Override protected void onSetLocalSkin(BufferedImage skin) { MineLPLogger.debug("Invalidating old local skin, checking updated local skin"); - PonyManager.getInstance().getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).checkSkin(skin); + ponyManager.getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).checkSkin(skin); } @Override protected void onSetRemoteSkin() { MineLPLogger.debug("Invalidating old remove skin, checking updated remote skin"); - PonyManager.getInstance().getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); + ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); } @Override public void onGuiClosed() { super.onGuiClosed(); - PonyManager.getInstance().getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck(); - PonyManager.getInstance().getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); + ponyManager.getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck(); + ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); } } diff --git a/src/main/java/com/brohoof/minelittlepony/hdskins/gui/RenderPonyModel.java b/src/main/java/com/brohoof/minelittlepony/hdskins/gui/RenderPonyModel.java index 2a942d39..010cc087 100644 --- a/src/main/java/com/brohoof/minelittlepony/hdskins/gui/RenderPonyModel.java +++ b/src/main/java/com/brohoof/minelittlepony/hdskins/gui/RenderPonyModel.java @@ -19,7 +19,7 @@ public class RenderPonyModel extends RenderPlayerModel { protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) { this.bindEntityTexture(par1EntityLivingBase); EntityPlayerModel playerModelEntity = (EntityPlayerModel) par1EntityLivingBase; - Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity)); + Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity)); thePony.checkSkin(); PlayerModel pm = thePony.getModel(true); this.mainModel = pm.model; diff --git a/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java b/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java index a80a8555..d37859c7 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java +++ b/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java @@ -884,7 +884,7 @@ public class pm_newPonyAdv extends ModelPony { this.bipedHead.render(this.scale); this.headpiece[0].render(this.scale); this.headpiece[1].render(this.scale); - if (PonyManager.getInstance().getShowSnuzzles() == 1) { + if (MineLittlePony.getConfig().getSnuzzles().get()) { int red; if (this.isMale) { for (red = 0; red < this.MuzzleMale.length; ++red) { diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java index e13d1c34..49b575b9 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java @@ -54,7 +54,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender @Obfuscated({ "a", "func_180596_a" }) public void doRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks) { ItemStack currentItemStack = player.inventory.getCurrentItem(); - Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); + Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player); this.playerModel = this.getModel(player); this.mainModel = this.playerModel.model; this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = currentItemStack == null @@ -81,7 +81,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender this.playerModel.armor.modelArmorChestplate.isUnicorn = this.playerModel.armor.modelArmor.isUnicorn = this.playerModel.model.isUnicorn = thePony.isUnicorn(); this.playerModel.armor.modelArmorChestplate.isMale = this.playerModel.armor.modelArmor.isMale = this.playerModel.model.isMale = thePony.isMale(); this.playerModel.armor.modelArmorChestplate.size = this.playerModel.armor.modelArmor.size = this.playerModel.model.size = thePony.size(); - if (PonyManager.getInstance().getShowScale() == 1) { + if (MineLittlePony.getConfig().getShowScale().get()) { if (this.playerModel != PMAPI.human) { if (thePony.size() == 0) { this.shadowSize = 0.25F; @@ -121,7 +121,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender @Obfuscated({ "a", "func_77039_a" }) public void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition) { - if (PonyManager.getInstance().getShowScale() == 1 && !(playerModel.model instanceof pm_Human)) { + if (MineLittlePony.getConfig().getShowScale().get() && !(playerModel.model instanceof pm_Human)) { if (this.playerModel.model.size == 2) { scale(0.9F, 0.9F, 0.9F); } else if (this.playerModel.model.size == 1 || this.playerModel.model.size == 0) { @@ -131,7 +131,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender } public ResourceLocation getEntityTexture(AbstractClientPlayer player) { - Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); + Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player); return thePony.getTextureResourceLocation(); } @@ -141,7 +141,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender } protected PlayerModel getModel(AbstractClientPlayer player) { - Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); + Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player); return thePony.getModel(); } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java index 2f604cd7..3d9f732e 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java @@ -81,7 +81,7 @@ public abstract class RenderPonyMob extends RenderLiving this.playerModel.armor.modelArmorChestplate.isSleeping = this.playerModel.armor.modelArmor.isSleeping = this.playerModel.model.isSleeping = false; this.playerModel.model.isVillager = false; - if (PonyManager.getInstance().getShowScale() == 1) { + if (MineLittlePony.getConfig().getShowScale().get()) { this.shadowSize = 0.4F; } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java index c3bb3537..47f75766 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java @@ -23,7 +23,7 @@ public class RenderPonyVillager extends RenderPonyMob { this.shadowSize = 0.25F; } else { this.mobModel.size = 1; - if (PonyManager.getInstance().getShowScale() == 1) { + if (MineLittlePony.getConfig().getShowScale().get()) { this.shadowSize = 0.4F; } else { this.shadowSize = 0.5F; @@ -35,7 +35,7 @@ public class RenderPonyVillager extends RenderPonyMob { @Override protected ResourceLocation getEntityTexture(EntityVillager villager) { - Pony aVillagerPony = PonyManager.getInstance().getPonyFromResourceRegistry(villager); + Pony aVillagerPony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(villager); return aVillagerPony.getTextureResourceLocation(); } } diff --git a/src/main/resources/assets/minelittlepony/lang/en_US.lang b/src/main/resources/assets/minelittlepony/lang/en_US.lang index c4a7d7e0..57e9933f 100644 --- a/src/main/resources/assets/minelittlepony/lang/en_US.lang +++ b/src/main/resources/assets/minelittlepony/lang/en_US.lang @@ -3,9 +3,9 @@ minelp.restart2=Minecraft before they will take effect! minelp.options.title=Mine Little Pony Settings minelp.options.ponylevel=Pony Level -minelp.options.ponylevel.pony=Ponies -minelp.options.ponylevel.human=Humans -minelp.options.ponylevel.mix=Mix +minelp.options.ponylevel.ponies=Ponies Only +minelp.options.ponylevel.humans=Humans Only +minelp.options.ponylevel.both=Both minelp.options.options=Pony Options minelp.options.hd=Enable MineLP skin server (requries restart) minelp.options.sizes=Allow all different sizes of pony diff --git a/src/main/resources/assets/minelittlepony/lang/fr_FR.lang b/src/main/resources/assets/minelittlepony/lang/fr_FR.lang index be8e2572..4e3c3ae5 100644 --- a/src/main/resources/assets/minelittlepony/lang/fr_FR.lang +++ b/src/main/resources/assets/minelittlepony/lang/fr_FR.lang @@ -5,9 +5,9 @@ minelp.restart2=Minecraft avant qu'ils prennent effet! minelp.options.title=Options Mine Little Pony minelp.options.ponylevel=Niveau Poney -minelp.options.ponylevel.pony=Poneys -minelp.options.ponylevel.human=Humains -minelp.options.ponylevel.mix=Mix +minelp.options.ponylevel.ponies=Seuls Poneys +minelp.options.ponylevel.humans=Seuls Humains +minelp.options.ponylevel.both=Deux minelp.options.options=Options Poney minelp.options.hd=Activer MineLP serveur de skin (nécessite un redémarrage) minelp.options.sizes=Autoriser tous les différentes tailles de poney diff --git a/src/main/resources/assets/minelittlepony/lang/ru_RU.lang b/src/main/resources/assets/minelittlepony/lang/ru_RU.lang index 48392c69..565a8177 100644 --- a/src/main/resources/assets/minelittlepony/lang/ru_RU.lang +++ b/src/main/resources/assets/minelittlepony/lang/ru_RU.lang @@ -2,9 +2,9 @@ minelp.restart1=Если вы измените эти параметры, minelp.restart2=то для их активации вы должны перезапустить игру! minelp.options.title=Настроайки мода Mine Little Pony minelp.options.ponylevel=Уровень понификации -minelp.options.ponylevel.pony=Только пони -minelp.options.ponylevel.human=Только люди -minelp.options.ponylevel.mix=Вперемешку +minelp.options.ponylevel.ponies=Только пони +minelp.options.ponylevel.humans=Только люди +minelp.options.ponylevel.both=И то и другое minelp.options.options=Опции minelp.options.hd=Включить Mine Little Pony скин-сервер (требуется перезапуск) minelp.options.sizes=Разрешить пони разных размеров и расс