Make settings use Exposable, remove singleton of PonyManager

This commit is contained in:
Matthew Messinger 2015-11-17 00:17:35 -05:00
parent 9e707e4af9
commit f438369f51
20 changed files with 383 additions and 343 deletions

View file

@ -30,17 +30,19 @@ import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
public class MineLittlePony implements InitCompleteListener { 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 MOD_NAME = "Mine Little Pony";
public static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com"; public static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com";
public static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com"; public static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
public static final String UPLOAD_URL = "http://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 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 final KeyBinding skinKeybinding = new KeyBinding("Skin Manager", Keyboard.KEY_F1, "Mine Little Pony");
private static MineLittlePony instance;
private PonyConfig config; private PonyConfig config;
private PonyManager ponyManager; private PonyManager ponyManager;
private String spUsername;
private static MineLittlePony instance;
public MineLittlePony() { public MineLittlePony() {
instance = this; instance = this;
@ -67,56 +69,19 @@ public class MineLittlePony implements InitCompleteListener {
public void init(File configPath) { public void init(File configPath) {
LiteLoader.getInput().registerKeyBinding(guiKeybinding); LiteLoader.getInput().registerKeyBinding(guiKeybinding);
LiteLoader.getInput().registerKeyBinding(skinKeybinding); LiteLoader.getInput().registerKeyBinding(skinKeybinding);
SettingsPanelManager.addSettingsPanel("Pony", MineLittlePonyGUI.class); SettingsPanelManager.addSettingsPanel("Pony", MineLittlePonyGUI.class);
SettingsPanelManager.addSettingsPanel("Pony Mobs", MineLittlePonyGUIMob.class); SettingsPanelManager.addSettingsPanel("Pony Mobs", MineLittlePonyGUIMob.class);
this.ponyManager = PonyManager.getInstance();
this.config = new PonyConfig(); this.config = new PonyConfig();
this.ponyManager = new PonyManager(config);
int readInt = this.config.getIntPropertySafe("ponylevel", 0, 2); LiteLoader.getInstance().registerExposable(config, null);
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");
} }
@Override @Override
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) { public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
this.spUsername = minecraft.getSession().getUsername(); if (this.config.getHd().get()) {
if (this.ponyManager.getHD() == 1) {
HDSkinManager.clearSkinCache(); HDSkinManager.clearSkinCache();
HDSkinManager.setSkinUrl(SKIN_SERVER_URL); HDSkinManager.setSkinUrl(SKIN_SERVER_URL);
HDSkinManager.setGatewayURL(GATEWAY_URL); HDSkinManager.setGatewayURL(GATEWAY_URL);
@ -124,22 +89,22 @@ public class MineLittlePony implements InitCompleteListener {
} }
RenderManager rm = minecraft.getRenderManager(); RenderManager rm = minecraft.getRenderManager();
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm)); ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
if (this.ponyManager.getPonyVillagers() == 1) { if (this.config.getVillagers().get()) {
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm)); ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
MineLPLogger.info("Villagers are now ponies."); MineLPLogger.info("Villagers are now ponies.");
} }
if (this.ponyManager.getPonyZombies() == 1) { if (this.config.getZombies().get()) {
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie(rm)); ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie(rm));
MineLPLogger.info("Zombies are now ponies."); MineLPLogger.info("Zombies are now ponies.");
} }
if (this.ponyManager.getPonyPigzombies() == 1) { if (this.config.getPigZombies().get()) {
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyZombie(rm)); ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyZombie(rm));
MineLPLogger.info("Zombie pigmen are now ponies."); MineLPLogger.info("Zombie pigmen are now ponies.");
} }
if (this.ponyManager.getPonySkeletons() == 1) { if (this.config.getSkeletons().get()) {
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm)); ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton(rm));
MineLPLogger.info("Skeletons are now ponies."); MineLPLogger.info("Skeletons are now ponies.");
} }
@ -148,32 +113,29 @@ public class MineLittlePony implements InitCompleteListener {
@Override @Override
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) { 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()) { if (inGame && minecraft.currentScreen == null && guiKeybinding.isPressed()) {
minecraft.displayGuiScreen(new MineLittlePonyGUI()); minecraft.displayGuiScreen(new MineLittlePonyGUI());
} }
// if (Keyboard.isKeyDown(Keyboard.KEY_O)) {
// ponyManager.initmodels();
// }
boolean pressed = minecraft.currentScreen instanceof GuiMainMenu boolean pressed = minecraft.currentScreen instanceof GuiMainMenu
&& Keyboard.isKeyDown(skinKeybinding.getKeyCode()); && Keyboard.isKeyDown(skinKeybinding.getKeyCode());
boolean skins = minecraft.currentScreen instanceof GuiSkins boolean skins = minecraft.currentScreen instanceof GuiSkins
&& !(minecraft.currentScreen instanceof GuiSkinsMineLP); && !(minecraft.currentScreen instanceof GuiSkinsMineLP);
if (pressed || skins) { 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; return getInstance().config;
} }
public static String getSPUsername() { public static String getSPUsername() {
return getInstance().spUsername; return Minecraft.getMinecraft().getSession().getUsername();
} }
} }

View file

@ -20,7 +20,9 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
public class Pony { public class Pony {
public static PonyManager ponyManager = PonyManager.getInstance();
private static PonyConfig config = MineLittlePony.getConfig();
public PonyRace race = PonyRace.EARTH; public PonyRace race = PonyRace.EARTH;
public boolean advancedTexturing; public boolean advancedTexturing;
public ResourceLocation textureResourceLocation; public ResourceLocation textureResourceLocation;
@ -50,13 +52,15 @@ public class Pony {
public Pony(AbstractClientPlayer player) { public Pony(AbstractClientPlayer player) {
this.textureResourceLocation = player.getLocationSkin(); 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); this.checkSkin(this.textureResourceLocation);
} }
public Pony(ResourceLocation aTextureResourceLocation) { public Pony(ResourceLocation aTextureResourceLocation) {
this.textureResourceLocation = 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); this.checkSkin(this.textureResourceLocation);
} }
@ -84,7 +88,8 @@ public class Pony {
BufferedImage skinImage = null; BufferedImage skinImage = null;
try { 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); MineLPLogger.debug("Obtained skin from resource location %s", textureResourceLocation);
this.checkSkin(skinImage); this.checkSkin(skinImage);
} catch (Exception var6) { } catch (Exception var6) {
@ -188,7 +193,7 @@ public class Pony {
Color scootaloo = new Color(255, 190, 83); Color scootaloo = new Color(255, 190, 83);
Color bigmac = new Color(206, 50, 84); Color bigmac = new Color(206, 50, 84);
Color luna = new Color(42, 60, 120); Color luna = new Color(42, 60, 120);
if (ponyManager.getUseSizes() == 1) { if (config.getSizes().get()) {
if (sizecolor.equals(scootaloo)) { if (sizecolor.equals(scootaloo)) {
this.size = 0; this.size = 0;
} else if (sizecolor.equals(bigmac)) { } else if (sizecolor.equals(bigmac)) {
@ -273,7 +278,7 @@ public class Pony {
} }
public int size() { public int size() {
return ponyManager.getUseSizes() == 1 ? this.size : 1; return config.getSizes().get() ? this.size : 1;
} }
public boolean advancedTexturing() { public boolean advancedTexturing() {
@ -358,11 +363,11 @@ public class Pony {
public PlayerModel getModel(boolean ignorePony) { public PlayerModel getModel(boolean ignorePony) {
boolean is_a_pony = false; boolean is_a_pony = false;
switch (ignorePony ? PonyLevel.MIXED : ponyManager.getPonyLevel()) { switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel().get()) {
case HUMANS: case HUMANS:
is_a_pony = false; is_a_pony = false;
break; break;
case MIXED: case BOTH:
is_a_pony = isPonySkin; is_a_pony = isPonySkin;
break; break;
case PONIES: case PONIES:

View file

@ -1,69 +1,90 @@
package com.brohoof.minelittlepony; package com.brohoof.minelittlepony;
import com.minelittlepony.minelp.util.MineLPLogger; import java.io.File;
import com.voxelmodpack.common.properties.ModConfig;
public class PonyConfig extends ModConfig { import com.google.gson.GsonBuilder;
@Override import com.google.gson.annotations.Expose;
protected void setDefaults() { import com.mumfrey.liteloader.modconfig.AdvancedExposable;
this.defaults.setProperty("ponylevel", "2"); import com.mumfrey.liteloader.modconfig.ConfigStrategy;
this.defaults.setProperty("sizes", "1"); import com.mumfrey.liteloader.modconfig.ExposableOptions;
this.defaults.setProperty("ponyarmor", "1");
this.defaults.setProperty("snuzzles", "1"); import net.minecraft.util.EnumTypeAdapterFactory;
this.defaults.setProperty("hd", "1");
this.defaults.setProperty("showscale", "1"); @ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
this.defaults.setProperty("eqg", "0"); public class PonyConfig implements AdvancedExposable {
this.defaults.setProperty("villagers", "1");
this.defaults.setProperty("zombies", "1"); @Expose
this.defaults.setProperty("pigzombies", "1"); private Value<PonyLevel> ponylevel = new Value<PonyLevel>(PonyLevel.PONIES);
this.defaults.setProperty("skeletons", "1"); @Expose
this.defaults.setProperty("oldSkinUploaded", "0"); private Value<Boolean> sizes = new Value<Boolean>(true);
@Expose
private Value<Boolean> ponyarmor = new Value<Boolean>(true);
@Expose
private Value<Boolean> snuzzles = new Value<Boolean>(true);
@Expose
private Value<Boolean> hd = new Value<Boolean>(true);
@Expose
private Value<Boolean> showscale = new Value<Boolean>(true);
@Expose
private Value<Boolean> villagers = new Value<Boolean>(true);
@Expose
private Value<Boolean> zombies = new Value<Boolean>(true);
@Expose
private Value<Boolean> pigzombies = new Value<Boolean>(true);
@Expose
private Value<Boolean> skeletons = new Value<Boolean>(true);
public Value<PonyLevel> getPonyLevel() {
if (ponylevel.get() == null)
ponylevel.set(PonyLevel.PONIES);
return ponylevel;
} }
public PonyConfig() { public Value<Boolean> getSizes() {
super("Mine Little Pony", "minelittlepony.properties"); return sizes;
}
public Value<Boolean> getPonyArmor() {
return ponyarmor;
}
public Value<Boolean> getSnuzzles() {
return snuzzles;
}
public Value<Boolean> getHd() {
return hd;
}
public Value<Boolean> getShowScale() {
return showscale;
}
public Value<Boolean> getVillagers() {
return villagers;
}
public Value<Boolean> getZombies() {
return zombies;
}
public Value<Boolean> getPigZombies() {
return pigzombies;
}
public Value<Boolean> getSkeletons() {
return skeletons;
} }
@Override @Override
public String getOptionDisplayString(String binding) { public void setupGsonSerialiser(GsonBuilder gsonBuilder) {
return ""; gsonBuilder.registerTypeAdapterFactory(new EnumTypeAdapterFactory())
.registerTypeAdapter(Value.class, new Value.Serializer());
} }
public int getIntPropertySafe(String key) { @Override
return this.getIntPropertySafe(key, Integer.MIN_VALUE, Integer.MAX_VALUE); 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);
}
} }

View file

@ -1,23 +1,8 @@
package com.brohoof.minelittlepony; package com.brohoof.minelittlepony;
public enum PonyLevel { public enum PonyLevel {
PONIES, PONIES,
HUMANS, HUMANS,
MIXED; BOTH;
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();
}
} }

View file

@ -30,21 +30,14 @@ public class PonyManager {
public static List<ResourceLocation> villagerResourceLocations; public static List<ResourceLocation> villagerResourceLocations;
private static final int MAX_BGPONY_COUNT = 141; private static final int MAX_BGPONY_COUNT = 141;
private static int numberOfPonies; private static int numberOfPonies;
private PonyConfig config;
private Map<ResourceLocation, Pony> ponyResourceRegistry = new HashMap<ResourceLocation, Pony>(); private Map<ResourceLocation, Pony> ponyResourceRegistry = new HashMap<ResourceLocation, Pony>();
private Map<ResourceLocation, Pony> backgroudPonyResourceRegistry = new HashMap<ResourceLocation, Pony>(); private Map<ResourceLocation, Pony> backgroudPonyResourceRegistry = new HashMap<ResourceLocation, Pony>();
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(); initmodels();
} }
@ -54,14 +47,6 @@ public class PonyManager {
MineLPLogger.info("Done initializing models."); MineLPLogger.info("Done initializing models.");
} }
public static PonyManager getInstance() {
if (instance == null) {
instance = new PonyManager();
}
return instance;
}
private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) { private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) {
Pony myLittlePony; Pony myLittlePony;
if (!this.ponyResourceRegistry.containsKey(skinResourceLocation)) { if (!this.ponyResourceRegistry.containsKey(skinResourceLocation)) {
@ -85,7 +70,7 @@ public class PonyManager {
public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) { public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) {
Pony myLittlePony = this.getPonyFromResourceRegistry(player.getLocationSkin(), 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); myLittlePony = this.getPonyFromBackgroundResourceRegistry(player);
} }
@ -142,90 +127,10 @@ public class PonyManager {
return myLittlePony; return myLittlePony;
} }
public int getHD() {
return this.useHDSkinServer;
}
public int getNumberOfPonies() { public int getNumberOfPonies() {
return numberOfPonies; 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 { static {
for (int check = 0; check < MAX_BGPONY_COUNT; ++check) { for (int check = 0; check < MAX_BGPONY_COUNT; ++check) {
backgroundPonyResourceLocations backgroundPonyResourceLocations

View file

@ -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<T> {
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<Value<?>>, JsonDeserializer<Value<?>> {
@Override
public Value<?> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0];
return new Value<Object>(context.deserialize(json, type));
}
@Override
public JsonElement serialize(Value<?> src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src.get());
}
}
}

View file

@ -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.LiteModVoxelCommon;
import com.voxelmodpack.common.gui.interfaces.IExtendedGui; import com.voxelmodpack.common.gui.interfaces.IExtendedGui;
import com.voxelmodpack.common.properties.VoxelProperty; import com.voxelmodpack.common.properties.VoxelProperty;
import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProvider;
import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProviderInteger; import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProviderInteger;
public class FakeVoxelPropertyCheckBox extends VoxelProperty<IVoxelPropertyProviderInteger> { import net.minecraft.client.resources.I18n;
public class FakeVoxelPropertyToggleBox extends VoxelProperty<IVoxelPropertyProviderInteger> {
private Value<Boolean> value;
private int width = 11; private int width = 11;
public FakeVoxelPropertyCheckBox(IVoxelPropertyProvider propertyProvider, String binding, String text, int xPos, public FakeVoxelPropertyToggleBox(Value<Boolean> value, String text, int xPos,
int yPos) { int yPos) {
super(propertyProvider, binding, text, xPos, yPos); super(null, null, text, xPos, yPos);
this.width = this.fontRenderer.getStringWidth(this.displayText) + 20; this.value = value;
this.width = this.fontRenderer.getStringWidth(I18n.format(this.displayText)) + 20;
} }
@Override @Override
public void draw(IExtendedGui host, int mouseX, int mouseY) { 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 overButton = this.mouseOver(mouseX, mouseY);
boolean checked = true; boolean checked = this.value.get();
try {
int e = this.propertyProvider.getIntProperty(this.propertyBinding);
if (e < 2 && e > -1) {
if (e == 0) {
checked = false;
} else {
checked = true;
}
}
} catch (Exception var7) {
}
host.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, this.xPosition, this.yPosition, host.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, this.xPosition, this.yPosition,
this.xPosition + 11, this.yPosition + 11, 0, overButton ? 16 : 0, 16, overButton ? 32 : 16, 4); this.xPosition + 11, this.yPosition + 11, 0, overButton ? 16 : 0, 16, overButton ? 32 : 16, 4);
@ -43,29 +35,9 @@ public class FakeVoxelPropertyCheckBox extends VoxelProperty<IVoxelPropertyProvi
@Override @Override
public void mouseClicked(int mouseX, int mouseY) { public void mouseClicked(int mouseX, int mouseY) {
if (this.mouseOver(mouseX, mouseY)) { if (this.mouseOver(mouseX, mouseY)) {
boolean checked = true; value.set(!value.get());
try {
int e = this.propertyProvider.getIntProperty(this.propertyBinding);
if (e < 2 && e > -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);
}
}
}
public boolean mouseOver(int mouseX, int mouseY) { public boolean mouseOver(int mouseX, int mouseY) {
return mouseX > this.xPosition && mouseX < this.xPosition + this.width && mouseY > this.yPosition return mouseX > this.xPosition && mouseX < this.xPosition + this.width && mouseY > this.yPosition

View file

@ -0,0 +1,10 @@
package com.brohoof.minelittlepony.gui;
import com.voxelmodpack.common.properties.interfaces.IVoxelPropertyProvider;
public interface IPropertyProviderEnum<E extends Enum<E>> extends IVoxelPropertyProvider {
void setProperty(String key, E val);
E getEnumProperty(String key);
}

View file

@ -3,6 +3,8 @@ package com.brohoof.minelittlepony.gui;
import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.PonyConfig; import com.brohoof.minelittlepony.PonyConfig;
import com.brohoof.minelittlepony.PonyLevel; 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.VoxelProperty;
import com.voxelmodpack.common.properties.VoxelPropertyLabel; import com.voxelmodpack.common.properties.VoxelPropertyLabel;
import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel; import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel;
@ -11,35 +13,43 @@ import net.minecraft.client.resources.I18n;
public class MineLittlePonyGUI extends GuiVoxelBoxSettingsPanel { 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 PonyConfig config;
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");
public MineLittlePonyGUI() { public MineLittlePonyGUI() {
this.config = MineLittlePony.getConfig(); this.config = MineLittlePony.getConfig();
byte col1 = 30; final byte col1 = 30;
this.properties.add(new VoxelPropertyIntSlider(this.config, "ponylevel", ponylevel, PANEL_LEFT, PANEL_TOP + 24)); int row = PANEL_TOP;
this.properties.add(new VoxelPropertyLabel(options, PANEL_LEFT + 15, PANEL_TOP + 58)); this.properties.add(new VoxelPropertyEnum<PonyLevel>(config.getPonyLevel(), PONY_LEVEL, PONY_LEVEL + ".",
this.properties.add(check("hd", hd, PANEL_LEFT + col1, PANEL_TOP + 72)); PANEL_LEFT, row += 24, PonyLevel.class));
this.properties.add(check("sizes", sizes, PANEL_LEFT + col1, PANEL_TOP + 90)); this.properties.add(new VoxelPropertyLabel(I18n.format(OPTIONS), PANEL_LEFT + 15, row += 45));
this.properties.add(check("ponyarmor", ponyarmor, PANEL_LEFT + col1, PANEL_TOP + 108)); this.properties.add(check(config.getHd(), HD, PANEL_LEFT + col1, row += 15));
this.properties.add(check("snuzzles", snuzzles, PANEL_LEFT + col1, PANEL_TOP + 126)); this.properties.add(check(config.getSizes(), SIZES, PANEL_LEFT + col1, row += 15));
this.properties.add(check("showscale", showscale, PANEL_LEFT + col1, PANEL_TOP + 144)); 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) { private VoxelProperty<?> check(Value<Boolean> config, String text, int xPos, int yPos) {
return new FakeVoxelPropertyCheckBox(this.config, binding, text, xPos, yPos); return new FakeVoxelPropertyToggleBox(config, text, xPos, yPos);
} }
@Override @Override
public String getPanelTitle() { public String getPanelTitle() {
return title; return I18n.format(TITLE);
}
@Override
public void onGuiClosed() {
LiteLoader.getInstance().writeConfig(config);
} }
} }

View file

@ -2,6 +2,8 @@ package com.brohoof.minelittlepony.gui;
import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.PonyConfig; 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.VoxelProperty;
import com.voxelmodpack.common.properties.VoxelPropertyLabel; import com.voxelmodpack.common.properties.VoxelPropertyLabel;
import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel; import com.voxelmodpack.common.properties.gui.GuiVoxelBoxSettingsPanel;
@ -12,32 +14,39 @@ public class MineLittlePonyGUIMob extends GuiVoxelBoxSettingsPanel {
private static final String pref = "minelp.mobs."; private static final String pref = "minelp.mobs.";
private final String restart1 = I18n.format("minelp.restart1"); private static final String restart1 = "minelp.restart1";
private final String restart2 = I18n.format("minelp.restart2"); private static final String restart2 = "minelp.restart2";
private final String title = I18n.format(pref + "title"); private static final String title = pref + "title";
private final String villagers = I18n.format(pref + "villagers"); private static final String villagers = pref + "villagers";
private final String zombies = I18n.format(pref + "zombies"); private static final String zombies = pref + "zombies";
private final String zombiePigmen = I18n.format(pref + "zombiepigmen"); private static final String zombiePigmen = pref + "zombiepigmen";
private final String skeletons = I18n.format(pref + "skeletons"); private static final String skeletons = pref + "skeletons";
private PonyConfig config;
public MineLittlePonyGUIMob() { public MineLittlePonyGUIMob() {
this.config = MineLittlePony.getConfig(); this.config = MineLittlePony.getConfig();
byte col1 = 30; byte col1 = 30;
this.properties.add(new VoxelPropertyLabel(restart1, PANEL_LEFT + 15, PANEL_TOP + 11, 0xff6666)); this.properties.add(new VoxelPropertyLabel(I18n.format(restart1), PANEL_LEFT + 15, PANEL_TOP + 11, 0xff6666));
this.properties.add(new VoxelPropertyLabel(restart2, PANEL_LEFT + 15, PANEL_TOP + 23, 0xff6666)); this.properties.add(new VoxelPropertyLabel(I18n.format(restart2), PANEL_LEFT + 15, PANEL_TOP + 23, 0xff6666));
this.properties.add(check("villagers", villagers, PANEL_LEFT + col1, PANEL_TOP + 42)); this.properties.add(check(config.getVillagers(), villagers, PANEL_LEFT + col1, PANEL_TOP + 42));
this.properties.add(check("zombies", zombies, PANEL_LEFT + col1, PANEL_TOP + 60)); this.properties.add(check(config.getZombies(), zombies, PANEL_LEFT + col1, PANEL_TOP + 60));
this.properties.add(check("pigzombies", zombiePigmen, PANEL_LEFT + col1, PANEL_TOP + 78)); this.properties.add(check(config.getPigZombies(), zombiePigmen, PANEL_LEFT + col1, PANEL_TOP + 78));
this.properties.add(check("skeletons", skeletons, PANEL_LEFT + col1, PANEL_TOP + 96)); this.properties.add(check(config.getSkeletons(), skeletons, PANEL_LEFT + col1, PANEL_TOP + 96));
} }
private VoxelProperty<?> check(String binding, String text, int xPos, int yPos) { private VoxelProperty<?> check(Value<Boolean> config, String text, int xPos, int yPos) {
return new FakeVoxelPropertyCheckBox(this.config, binding, text, xPos, yPos); return new FakeVoxelPropertyToggleBox(config, text, xPos, yPos);
} }
@Override @Override
public String getPanelTitle() { public String getPanelTitle() {
return title; return I18n.format(title);
}
@Override
public void onGuiClosed() {
LiteLoader.getInstance().writeConfig(config);
} }
} }

View file

@ -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<E extends Enum<E>> extends VoxelProperty<IPropertyProviderEnum<E>> {
private Value<E> value;
private E[] possibleValues;
private String i18NPrefix;
private int height = 15;
private int defaultX;
private int defaultW;
public VoxelPropertyEnum(Value<E> value, String displayText, String i18nPrefix, int xPos, int yPos,
Class<E> 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) {}
}

View file

@ -11,6 +11,12 @@ import com.voxelmodpack.hdskins.gui.GuiSkins;
public class GuiSkinsMineLP extends GuiSkins { public class GuiSkinsMineLP extends GuiSkins {
private PonyManager ponyManager;
public GuiSkinsMineLP(PonyManager manager) {
this.ponyManager = manager;
}
@Override @Override
protected EntityPlayerModel getModel(GameProfile profile) { protected EntityPlayerModel getModel(GameProfile profile) {
return new EntityPonyModel(profile); return new EntityPonyModel(profile);
@ -19,20 +25,20 @@ public class GuiSkinsMineLP extends GuiSkins {
@Override @Override
protected void onSetLocalSkin(BufferedImage skin) { protected void onSetLocalSkin(BufferedImage skin) {
MineLPLogger.debug("Invalidating old local skin, checking updated local 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 @Override
protected void onSetRemoteSkin() { protected void onSetRemoteSkin() {
MineLPLogger.debug("Invalidating old remove skin, checking updated remote skin"); MineLPLogger.debug("Invalidating old remove skin, checking updated remote skin");
PonyManager.getInstance().getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck();
} }
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
super.onGuiClosed(); super.onGuiClosed();
PonyManager.getInstance().getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck(); ponyManager.getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).invalidateSkinCheck();
PonyManager.getInstance().getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck(); ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck();
} }
} }

View file

@ -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) { protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) {
this.bindEntityTexture(par1EntityLivingBase); this.bindEntityTexture(par1EntityLivingBase);
EntityPlayerModel playerModelEntity = (EntityPlayerModel) par1EntityLivingBase; EntityPlayerModel playerModelEntity = (EntityPlayerModel) par1EntityLivingBase;
Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity)); Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity));
thePony.checkSkin(); thePony.checkSkin();
PlayerModel pm = thePony.getModel(true); PlayerModel pm = thePony.getModel(true);
this.mainModel = pm.model; this.mainModel = pm.model;

View file

@ -884,7 +884,7 @@ public class pm_newPonyAdv extends ModelPony {
this.bipedHead.render(this.scale); this.bipedHead.render(this.scale);
this.headpiece[0].render(this.scale); this.headpiece[0].render(this.scale);
this.headpiece[1].render(this.scale); this.headpiece[1].render(this.scale);
if (PonyManager.getInstance().getShowSnuzzles() == 1) { if (MineLittlePony.getConfig().getSnuzzles().get()) {
int red; int red;
if (this.isMale) { if (this.isMale) {
for (red = 0; red < this.MuzzleMale.length; ++red) { for (red = 0; red < this.MuzzleMale.length; ++red) {

View file

@ -54,7 +54,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
@Obfuscated({ "a", "func_180596_a" }) @Obfuscated({ "a", "func_180596_a" })
public void doRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks) { public void doRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks) {
ItemStack currentItemStack = player.inventory.getCurrentItem(); ItemStack currentItemStack = player.inventory.getCurrentItem();
Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
this.playerModel = this.getModel(player); this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.model; this.mainModel = this.playerModel.model;
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = currentItemStack == null 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.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.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(); 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 (this.playerModel != PMAPI.human) {
if (thePony.size() == 0) { if (thePony.size() == 0) {
this.shadowSize = 0.25F; this.shadowSize = 0.25F;
@ -121,7 +121,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
@Obfuscated({ "a", "func_77039_a" }) @Obfuscated({ "a", "func_77039_a" })
public void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition) { 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) { if (this.playerModel.model.size == 2) {
scale(0.9F, 0.9F, 0.9F); scale(0.9F, 0.9F, 0.9F);
} else if (this.playerModel.model.size == 1 || this.playerModel.model.size == 0) { } 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) { public ResourceLocation getEntityTexture(AbstractClientPlayer player) {
Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
return thePony.getTextureResourceLocation(); return thePony.getTextureResourceLocation();
} }
@ -141,7 +141,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
} }
protected PlayerModel getModel(AbstractClientPlayer player) { protected PlayerModel getModel(AbstractClientPlayer player) {
Pony thePony = PonyManager.getInstance().getPonyFromResourceRegistry(player); Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
return thePony.getModel(); return thePony.getModel();
} }

View file

@ -81,7 +81,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
this.playerModel.armor.modelArmorChestplate.isSleeping = this.playerModel.armor.modelArmor.isSleeping = this.playerModel.model.isSleeping = false; this.playerModel.armor.modelArmorChestplate.isSleeping = this.playerModel.armor.modelArmor.isSleeping = this.playerModel.model.isSleeping = false;
this.playerModel.model.isVillager = false; this.playerModel.model.isVillager = false;
if (PonyManager.getInstance().getShowScale() == 1) { if (MineLittlePony.getConfig().getShowScale().get()) {
this.shadowSize = 0.4F; this.shadowSize = 0.4F;
} }

View file

@ -23,7 +23,7 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
this.shadowSize = 0.25F; this.shadowSize = 0.25F;
} else { } else {
this.mobModel.size = 1; this.mobModel.size = 1;
if (PonyManager.getInstance().getShowScale() == 1) { if (MineLittlePony.getConfig().getShowScale().get()) {
this.shadowSize = 0.4F; this.shadowSize = 0.4F;
} else { } else {
this.shadowSize = 0.5F; this.shadowSize = 0.5F;
@ -35,7 +35,7 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
@Override @Override
protected ResourceLocation getEntityTexture(EntityVillager villager) { protected ResourceLocation getEntityTexture(EntityVillager villager) {
Pony aVillagerPony = PonyManager.getInstance().getPonyFromResourceRegistry(villager); Pony aVillagerPony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(villager);
return aVillagerPony.getTextureResourceLocation(); return aVillagerPony.getTextureResourceLocation();
} }
} }

View file

@ -3,9 +3,9 @@ minelp.restart2=Minecraft before they will take effect!
minelp.options.title=Mine Little Pony Settings minelp.options.title=Mine Little Pony Settings
minelp.options.ponylevel=Pony Level minelp.options.ponylevel=Pony Level
minelp.options.ponylevel.pony=Ponies minelp.options.ponylevel.ponies=Ponies Only
minelp.options.ponylevel.human=Humans minelp.options.ponylevel.humans=Humans Only
minelp.options.ponylevel.mix=Mix minelp.options.ponylevel.both=Both
minelp.options.options=Pony Options minelp.options.options=Pony Options
minelp.options.hd=Enable MineLP skin server (requries restart) minelp.options.hd=Enable MineLP skin server (requries restart)
minelp.options.sizes=Allow all different sizes of pony minelp.options.sizes=Allow all different sizes of pony

View file

@ -5,9 +5,9 @@ minelp.restart2=Minecraft avant qu'ils prennent effet!
minelp.options.title=Options Mine Little Pony minelp.options.title=Options Mine Little Pony
minelp.options.ponylevel=Niveau Poney minelp.options.ponylevel=Niveau Poney
minelp.options.ponylevel.pony=Poneys minelp.options.ponylevel.ponies=Seuls Poneys
minelp.options.ponylevel.human=Humains minelp.options.ponylevel.humans=Seuls Humains
minelp.options.ponylevel.mix=Mix minelp.options.ponylevel.both=Deux
minelp.options.options=Options Poney minelp.options.options=Options Poney
minelp.options.hd=Activer MineLP serveur de skin (nécessite un redémarrage) minelp.options.hd=Activer MineLP serveur de skin (nécessite un redémarrage)
minelp.options.sizes=Autoriser tous les différentes tailles de poney minelp.options.sizes=Autoriser tous les différentes tailles de poney

View file

@ -2,9 +2,9 @@ minelp.restart1=Если вы измените эти параметры,
minelp.restart2=то для их активации вы должны перезапустить игру! minelp.restart2=то для их активации вы должны перезапустить игру!
minelp.options.title=Настроайки мода Mine Little Pony minelp.options.title=Настроайки мода Mine Little Pony
minelp.options.ponylevel=Уровень понификации minelp.options.ponylevel=Уровень понификации
minelp.options.ponylevel.pony=Только пони minelp.options.ponylevel.ponies=Только пони
minelp.options.ponylevel.human=Только люди minelp.options.ponylevel.humans=Только люди
minelp.options.ponylevel.mix=Вперемешку minelp.options.ponylevel.both=И то и другое
minelp.options.options=Опции minelp.options.options=Опции
minelp.options.hd=Включить Mine Little Pony скин-сервер (требуется перезапуск) minelp.options.hd=Включить Mine Little Pony скин-сервер (требуется перезапуск)
minelp.options.sizes=Разрешить пони разных размеров и расс minelp.options.sizes=Разрешить пони разных размеров и расс