mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
commit
b0a16695ee
21 changed files with 536 additions and 303 deletions
|
@ -1,13 +1,17 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.minelittlepony.gui.PonySettingsPanel;
|
||||||
|
import com.mumfrey.liteloader.Configurable;
|
||||||
import com.mumfrey.liteloader.InitCompleteListener;
|
import com.mumfrey.liteloader.InitCompleteListener;
|
||||||
import com.mumfrey.liteloader.Tickable;
|
import com.mumfrey.liteloader.Tickable;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
|
public class LiteModMineLittlePony implements Tickable, InitCompleteListener, Configurable {
|
||||||
|
|
||||||
private MineLittlePony mlp;
|
private MineLittlePony mlp;
|
||||||
|
|
||||||
|
@ -39,4 +43,9 @@ public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
|
||||||
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
|
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
|
||||||
mlp.onTick(minecraft, inGame);
|
mlp.onTick(minecraft, inGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
||||||
|
return PonySettingsPanel.class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.minelittlepony.gui.GuiPonySettings;
|
||||||
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
||||||
import com.minelittlepony.pony.data.IPonyData;
|
import com.minelittlepony.pony.data.IPonyData;
|
||||||
import com.minelittlepony.pony.data.PonyDataSerialzier;
|
import com.minelittlepony.pony.data.PonyDataSerialzier;
|
||||||
|
@ -81,7 +82,7 @@ public class MineLittlePony {
|
||||||
void onTick(Minecraft minecraft, boolean inGame) {
|
void onTick(Minecraft minecraft, boolean inGame) {
|
||||||
|
|
||||||
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
||||||
minecraft.displayGuiScreen(new PonySettingPanel());
|
minecraft.displayGuiScreen(new GuiPonySettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
boolean skins = minecraft.currentScreen instanceof GuiSkins
|
||||||
|
|
|
@ -2,22 +2,32 @@ package com.minelittlepony;
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.minelittlepony.pony.data.PonyLevel;
|
import com.minelittlepony.pony.data.PonyLevel;
|
||||||
|
import com.minelittlepony.settings.SensibleConfig;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
||||||
import com.mumfrey.liteloader.modconfig.Exposable;
|
import com.mumfrey.liteloader.modconfig.Exposable;
|
||||||
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage contained for MineLP client settings.
|
* Storage container for MineLP client settings.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
||||||
public class PonyConfig implements Exposable {
|
public class PonyConfig extends SensibleConfig implements Exposable {
|
||||||
|
|
||||||
@Expose private PonyLevel ponylevel = PonyLevel.PONIES;
|
@Expose private PonyLevel ponylevel = PonyLevel.PONIES;
|
||||||
|
|
||||||
@Expose public boolean sizes = true;
|
@Expose public boolean sizes = true;
|
||||||
@Expose public boolean snuzzles = true;
|
@Expose public boolean snuzzles = true;
|
||||||
@Expose public boolean hd = true;
|
@Expose public boolean hd = true;
|
||||||
@Expose public boolean showscale = true;
|
@Expose public boolean showscale = true;
|
||||||
|
|
||||||
|
public enum PonySettings implements Setting {
|
||||||
|
SIZES,
|
||||||
|
SNUZZLES,
|
||||||
|
HD,
|
||||||
|
SHOWSCALE;
|
||||||
|
}
|
||||||
|
|
||||||
@Expose public boolean villagers = true;
|
@Expose public boolean villagers = true;
|
||||||
@Expose public boolean zombies = true;
|
@Expose public boolean zombies = true;
|
||||||
@Expose public boolean pigzombies = true;
|
@Expose public boolean pigzombies = true;
|
||||||
|
|
|
@ -9,36 +9,12 @@ import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
||||||
import com.minelittlepony.model.player.PlayerModels;
|
import com.minelittlepony.model.player.PlayerModels;
|
||||||
import com.minelittlepony.render.LevitatingItemRenderer;
|
import com.minelittlepony.render.LevitatingItemRenderer;
|
||||||
import com.minelittlepony.render.player.RenderPonyPlayer;
|
import com.minelittlepony.render.player.RenderPonyPlayer;
|
||||||
import com.minelittlepony.render.ponies.RenderPonyGuardian;
|
import com.minelittlepony.render.ponies.MobRenderers;
|
||||||
import com.minelittlepony.render.ponies.RenderPonyIllager;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyPigman;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonySkeleton;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyVex;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyVillager;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyWitch;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyZombie;
|
|
||||||
import com.minelittlepony.render.ponies.RenderPonyZombieVillager;
|
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.Render;
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.monster.EntityElderGuardian;
|
|
||||||
import net.minecraft.entity.monster.EntityEvoker;
|
|
||||||
import net.minecraft.entity.monster.EntityGiantZombie;
|
|
||||||
import net.minecraft.entity.monster.EntityGuardian;
|
|
||||||
import net.minecraft.entity.monster.EntityHusk;
|
|
||||||
import net.minecraft.entity.monster.EntityIllusionIllager;
|
|
||||||
import net.minecraft.entity.monster.EntityPigZombie;
|
|
||||||
import net.minecraft.entity.monster.EntitySkeleton;
|
|
||||||
import net.minecraft.entity.monster.EntityStray;
|
|
||||||
import net.minecraft.entity.monster.EntityVex;
|
|
||||||
import net.minecraft.entity.monster.EntityVindicator;
|
|
||||||
import net.minecraft.entity.monster.EntityWitch;
|
|
||||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
|
||||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
|
||||||
import net.minecraft.entity.passive.EntityVillager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
|
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
|
||||||
|
@ -80,92 +56,32 @@ public class PonyRenderManager {
|
||||||
* Registers all entity model replacements. (except for players).
|
* Registers all entity model replacements. (except for players).
|
||||||
*/
|
*/
|
||||||
public void initializeMobRenderers(RenderManager manager, PonyConfig config) {
|
public void initializeMobRenderers(RenderManager manager, PonyConfig config) {
|
||||||
|
for (MobRenderers i : MobRenderers.values()) {
|
||||||
if (config.villagers) {
|
i.apply(this, manager);
|
||||||
pushNewRenderer(manager, EntityVillager.class, new RenderPonyVillager(manager));
|
|
||||||
pushNewRenderer(manager, EntityWitch.class, new RenderPonyWitch(manager));
|
|
||||||
pushNewRenderer(manager, EntityZombieVillager.class, new RenderPonyZombieVillager(manager));
|
|
||||||
MineLittlePony.logger.info("Villagers are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntityVillager.class);
|
|
||||||
restoreRenderer(EntityWitch.class);
|
|
||||||
restoreRenderer(EntityZombieVillager.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.zombies) {
|
|
||||||
pushNewRenderer(manager, EntityZombie.class, new RenderPonyZombie<>(manager));
|
|
||||||
pushNewRenderer(manager, EntityHusk.class, new RenderPonyZombie.Husk(manager));
|
|
||||||
pushNewRenderer(manager, EntityGiantZombie.class, new RenderPonyZombie.Giant(manager));
|
|
||||||
MineLittlePony.logger.info("Zombies are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntityZombie.class);
|
|
||||||
restoreRenderer(EntityHusk.class);
|
|
||||||
restoreRenderer(EntityGiantZombie.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.pigzombies) {
|
|
||||||
pushNewRenderer(manager, EntityPigZombie.class, new RenderPonyPigman(manager));
|
|
||||||
MineLittlePony.logger.info("Zombie pigmen are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntityPigZombie.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.skeletons) {
|
|
||||||
pushNewRenderer(manager, EntitySkeleton.class, new RenderPonySkeleton<>(manager));
|
|
||||||
pushNewRenderer(manager, EntityStray.class, new RenderPonySkeleton.Stray(manager));
|
|
||||||
pushNewRenderer(manager, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(manager));
|
|
||||||
MineLittlePony.logger.info("Skeletons are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntitySkeleton.class);
|
|
||||||
restoreRenderer(EntityStray.class);
|
|
||||||
restoreRenderer(EntityWitherSkeleton.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.illagers) {
|
|
||||||
pushNewRenderer(manager, EntityVex.class, new RenderPonyVex(manager));
|
|
||||||
pushNewRenderer(manager, EntityEvoker.class, new RenderPonyIllager.Evoker(manager));
|
|
||||||
pushNewRenderer(manager, EntityVindicator.class, new RenderPonyIllager.Vindicator(manager));
|
|
||||||
pushNewRenderer(manager, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(manager));
|
|
||||||
MineLittlePony.logger.info("Illagers are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntityVex.class);
|
|
||||||
restoreRenderer(EntityEvoker.class);
|
|
||||||
restoreRenderer(EntityVindicator.class);
|
|
||||||
restoreRenderer(EntityIllusionIllager.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.guardians) {
|
|
||||||
pushNewRenderer(manager, EntityGuardian.class, new RenderPonyGuardian(manager));
|
|
||||||
pushNewRenderer(manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
|
|
||||||
MineLittlePony.logger.info("Guardians are now ponies.");
|
|
||||||
} else {
|
|
||||||
restoreRenderer(EntityGuardian.class);
|
|
||||||
restoreRenderer(EntityElderGuardian.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a new renderer replacement storing the original internally. This change can be undone with {@link #restoreRenderer(Class)}
|
*
|
||||||
|
* Replaces an entity renderer depending on whether we want ponies or not.
|
||||||
|
*
|
||||||
|
* @param state True if we want ponies (the original will be stored)
|
||||||
* @param manager The render manager
|
* @param manager The render manager
|
||||||
* @param type The type to replace
|
* @param type The type to replace
|
||||||
* @param renderer The replacement value
|
* @param renderer The replacement value
|
||||||
* @param <T> The entity type
|
* @param <T> The entity type
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Entity, V extends T> void pushNewRenderer(RenderManager manager, Class<V> type, Render<T> renderer) {
|
public <T extends Entity, V extends T> void switchRenderer(boolean state, RenderManager manager, Class<V> type, Render<T> renderer) {
|
||||||
|
if (state) {
|
||||||
if (!renderMap.containsKey(type)) {
|
if (!renderMap.containsKey(type)) {
|
||||||
renderMap.put(type, manager.getEntityClassRenderObject(type));
|
renderMap.put(type, manager.getEntityClassRenderObject(type));
|
||||||
}
|
}
|
||||||
ModUtilities.addRenderer((Class<T>)type, renderer);
|
ModUtilities.addRenderer((Class<T>)type, renderer);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores a renderer to its previous value.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T extends Entity> void restoreRenderer(Class<T> type) {
|
|
||||||
if (renderMap.containsKey(type)) {
|
if (renderMap.containsKey(type)) {
|
||||||
ModUtilities.addRenderer(type, (Render<T>)renderMap.get(type));
|
ModUtilities.addRenderer(type, (Render<V>)renderMap.get(type));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,192 +0,0 @@
|
||||||
package com.minelittlepony;
|
|
||||||
|
|
||||||
import com.minelittlepony.pony.data.PonyLevel;
|
|
||||||
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
|
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In-Game options menu.
|
|
||||||
*
|
|
||||||
* TODO: What a mess
|
|
||||||
*/
|
|
||||||
public class PonySettingPanel extends GuiScreen {
|
|
||||||
|
|
||||||
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 PONY = PONY_LEVEL + ".ponies";
|
|
||||||
private static final String HUMAN = PONY_LEVEL + ".humans";
|
|
||||||
private static final String BOTH = PONY_LEVEL + ".both";
|
|
||||||
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 SNUZZLES = _PREFIX + "snuzzles";
|
|
||||||
private static final String SHOW_SCALE = _PREFIX + "showscale";
|
|
||||||
|
|
||||||
private static final String MOB_PREFIX = "minelp.mobs.";
|
|
||||||
|
|
||||||
private static final String MOB_TITLE = MOB_PREFIX + "title";
|
|
||||||
private static final String VILLAGERS = MOB_PREFIX + "villagers";
|
|
||||||
private static final String ZOMBIES = MOB_PREFIX + "zombies";
|
|
||||||
private static final String ZOMBIE_PIGMEN = MOB_PREFIX + "zombiepigmen";
|
|
||||||
private static final String SKELETONS = MOB_PREFIX + "skeletons";
|
|
||||||
private static final String ILLAGERS = MOB_PREFIX + "illagers";
|
|
||||||
private static final String GUARDIANS = MOB_PREFIX + "guardians";
|
|
||||||
|
|
||||||
private static final int PONY_ID = 0;
|
|
||||||
private static final int HUMAN_ID = 1;
|
|
||||||
private static final int BOTH_ID = 2;
|
|
||||||
private static final int HD_ID = 3;
|
|
||||||
private static final int SIZES_ID = 4;
|
|
||||||
private static final int SNUZZLES_ID = 5;
|
|
||||||
private static final int SHOW_SCALE_ID = 6;
|
|
||||||
|
|
||||||
private static final int VILLAGERS_ID = 7;
|
|
||||||
private static final int ZOMBIES_ID = 8;
|
|
||||||
private static final int ZOMBIE_PIGMEN_ID = 9;
|
|
||||||
private static final int SKELETONS_ID = 10;
|
|
||||||
private static final int ILLAGER_ID = 11;
|
|
||||||
private static final int GUARDIAN_ID = 12;
|
|
||||||
|
|
||||||
private PonyConfig config;
|
|
||||||
|
|
||||||
private GuiCheckbox ponies;
|
|
||||||
private GuiCheckbox humans;
|
|
||||||
private GuiCheckbox both;
|
|
||||||
|
|
||||||
public PonySettingPanel() {
|
|
||||||
config = MineLittlePony.getConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("UnusedAssignment")
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
final int LEFT = width / 10 + 16;
|
|
||||||
GuiCheckbox pony, human, both, hd, sizes, snuzzles, showscale, villager, zombie, pigmen, skeleton, illager, guardian;
|
|
||||||
int row = 32;
|
|
||||||
buttonList.add(pony = ponies = new GuiCheckbox(PONY_ID, LEFT, row += 15, I18n.format(PONY)));
|
|
||||||
buttonList.add(human = humans = new GuiCheckbox(HUMAN_ID, LEFT, row += 15, I18n.format(HUMAN)));
|
|
||||||
buttonList.add(both = this.both = new GuiCheckbox(BOTH_ID, LEFT, row += 15, I18n.format(BOTH)));
|
|
||||||
row += 15;
|
|
||||||
buttonList.add(hd = new GuiCheckbox(HD_ID, LEFT, row += 15, I18n.format(HD)));
|
|
||||||
buttonList.add(snuzzles = new GuiCheckbox(SNUZZLES_ID, LEFT, row += 15, I18n.format(SNUZZLES)));
|
|
||||||
buttonList.add(sizes = new GuiCheckbox(SIZES_ID, LEFT, row += 15, I18n.format(SIZES)));
|
|
||||||
buttonList.add(showscale = new GuiCheckbox(SHOW_SCALE_ID, LEFT, row += 15, I18n.format(SHOW_SCALE)));
|
|
||||||
|
|
||||||
final int RIGHT = width - width / 3;
|
|
||||||
row = 32;
|
|
||||||
buttonList.add(villager = new GuiCheckbox(VILLAGERS_ID, RIGHT, row += 15, I18n.format(VILLAGERS)));
|
|
||||||
buttonList.add(zombie = new GuiCheckbox(ZOMBIES_ID, RIGHT, row += 15, I18n.format(ZOMBIES)));
|
|
||||||
buttonList.add(pigmen = new GuiCheckbox(ZOMBIE_PIGMEN_ID, RIGHT, row += 15, I18n.format(ZOMBIE_PIGMEN)));
|
|
||||||
buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
|
|
||||||
buttonList.add(illager = new GuiCheckbox(ILLAGER_ID, RIGHT, row += 15, I18n.format(ILLAGERS)));
|
|
||||||
buttonList.add(guardian = new GuiCheckbox(GUARDIAN_ID, RIGHT, row += 15, I18n.format(GUARDIANS)));
|
|
||||||
|
|
||||||
switch (config.getPonyLevel()) {
|
|
||||||
default:
|
|
||||||
case PONIES:
|
|
||||||
pony.checked = true;
|
|
||||||
break;
|
|
||||||
case HUMANS:
|
|
||||||
human.checked = true;
|
|
||||||
break;
|
|
||||||
case BOTH:
|
|
||||||
both.checked = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
hd.checked = config.hd;
|
|
||||||
sizes.checked = config.sizes;
|
|
||||||
snuzzles.checked = config.snuzzles;
|
|
||||||
showscale.checked = config.showscale;
|
|
||||||
villager.checked = config.villagers;
|
|
||||||
zombie.checked = config.zombies;
|
|
||||||
pigmen.checked = config.pigzombies;
|
|
||||||
skeleton.checked = config.skeletons;
|
|
||||||
illager.checked = config.illagers;
|
|
||||||
guardian.checked = config.guardians;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
drawDefaultBackground();
|
|
||||||
|
|
||||||
drawCenteredString(mc.fontRenderer, I18n.format(TITLE), width / 2, 12, -1);
|
|
||||||
|
|
||||||
drawString(mc.fontRenderer, I18n.format(MOB_TITLE), width - width / 3 - 16, 32, -1);
|
|
||||||
drawString(mc.fontRenderer, I18n.format(PONY_LEVEL), width / 10, 32, -1);
|
|
||||||
drawString(mc.fontRenderer, I18n.format(OPTIONS), width / 10, 94, -1);
|
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(GuiButton button) throws IOException {
|
|
||||||
if (button instanceof GuiCheckbox) {
|
|
||||||
boolean checked = !((GuiCheckbox) button).checked;
|
|
||||||
((GuiCheckbox) button).checked = checked;
|
|
||||||
|
|
||||||
switch (button.id) {
|
|
||||||
case PONY_ID:
|
|
||||||
config.setPonyLevel(PonyLevel.PONIES);
|
|
||||||
ponies.checked = true;
|
|
||||||
humans.checked = false;
|
|
||||||
both.checked = false;
|
|
||||||
break;
|
|
||||||
case HUMAN_ID:
|
|
||||||
config.setPonyLevel(PonyLevel.HUMANS);
|
|
||||||
humans.checked = true;
|
|
||||||
ponies.checked = false;
|
|
||||||
both.checked = false;
|
|
||||||
break;
|
|
||||||
case BOTH_ID:
|
|
||||||
config.setPonyLevel(PonyLevel.BOTH);
|
|
||||||
both.checked = true;
|
|
||||||
ponies.checked = false;
|
|
||||||
humans.checked = false;
|
|
||||||
break;
|
|
||||||
case HD_ID:
|
|
||||||
config.hd = checked;
|
|
||||||
break;
|
|
||||||
case SIZES_ID:
|
|
||||||
config.sizes = checked;
|
|
||||||
break;
|
|
||||||
case SNUZZLES_ID:
|
|
||||||
config.snuzzles = checked;
|
|
||||||
break;
|
|
||||||
case SHOW_SCALE_ID:
|
|
||||||
config.showscale = checked;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VILLAGERS_ID:
|
|
||||||
config.villagers = checked;
|
|
||||||
break;
|
|
||||||
case ZOMBIES_ID:
|
|
||||||
config.zombies = checked;
|
|
||||||
break;
|
|
||||||
case ZOMBIE_PIGMEN_ID:
|
|
||||||
config.pigzombies = checked;
|
|
||||||
break;
|
|
||||||
case SKELETONS_ID:
|
|
||||||
config.skeletons = checked;
|
|
||||||
break;
|
|
||||||
case ILLAGER_ID:
|
|
||||||
config.illagers = checked;
|
|
||||||
break;
|
|
||||||
case GUARDIAN_ID:
|
|
||||||
config.guardians = checked;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGuiClosed() {
|
|
||||||
LiteLoader.getInstance().writeConfig(config);
|
|
||||||
MineLittlePony.getInstance().getRenderManager().initializeMobRenderers(mc.getRenderManager(), config);
|
|
||||||
}
|
|
||||||
}
|
|
22
src/main/java/com/minelittlepony/gui/Checkbox.java
Normal file
22
src/main/java/com/minelittlepony/gui/Checkbox.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
|
||||||
|
public class Checkbox extends GuiCheckbox implements IActionable {
|
||||||
|
|
||||||
|
private final IGUIAction<Boolean> action;
|
||||||
|
|
||||||
|
public Checkbox(int x, int y, String displayString, boolean value, IGUIAction<Boolean> callback) {
|
||||||
|
super(0, x, y, I18n.format(displayString));
|
||||||
|
action = callback;
|
||||||
|
checked = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform() {
|
||||||
|
checked = action.perform(!checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
97
src/main/java/com/minelittlepony/gui/GuiPonySettings.java
Normal file
97
src/main/java/com/minelittlepony/gui/GuiPonySettings.java
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
import com.minelittlepony.PonyConfig;
|
||||||
|
import com.minelittlepony.PonyConfig.PonySettings;
|
||||||
|
import com.minelittlepony.pony.data.PonyLevel;
|
||||||
|
import com.minelittlepony.render.ponies.MobRenderers;
|
||||||
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In-Game options menu.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GuiPonySettings extends GuiScreen {
|
||||||
|
|
||||||
|
private static final String OPTIONS_PREFIX = "minelp.options.";
|
||||||
|
|
||||||
|
private static final String PONY_LEVEL = OPTIONS_PREFIX + "ponylevel";
|
||||||
|
|
||||||
|
private static final String MOB_PREFIX = "minelp.mobs.";
|
||||||
|
|
||||||
|
private PonyConfig config;
|
||||||
|
|
||||||
|
public GuiPonySettings() {
|
||||||
|
config = MineLittlePony.getConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
final int LEFT = width / 10;
|
||||||
|
final int RIGHT = mustScroll() ? LEFT : width - width / 3 - 16;
|
||||||
|
|
||||||
|
int row = mustScroll() ? 0 : 32;
|
||||||
|
|
||||||
|
if (!mustScroll()) {
|
||||||
|
addButton(new Label(width / 2, 12, getTitle(), -1, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
addButton(new Label(LEFT, row += 15, PONY_LEVEL, -1));
|
||||||
|
addButton(new Slider(LEFT, row += 15, 0, 2, config.getPonyLevel().ordinal(), (int id, String name, float value) -> {
|
||||||
|
return I18n.format(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase());
|
||||||
|
}, v -> {
|
||||||
|
PonyLevel level = PonyLevel.valueFor(v);
|
||||||
|
config.setPonyLevel(level);
|
||||||
|
return (float)level.ordinal();
|
||||||
|
}));
|
||||||
|
|
||||||
|
row += 15;
|
||||||
|
addButton(new Label(LEFT, row += 15, OPTIONS_PREFIX + "options", -1));
|
||||||
|
for (PonySettings i : PonySettings.values()) {
|
||||||
|
addButton(new Checkbox(LEFT, row += 15, OPTIONS_PREFIX + i.name().toLowerCase(), i.get(), i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mustScroll()) {
|
||||||
|
row += 15;
|
||||||
|
} else {
|
||||||
|
row = 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
addButton(new Label(RIGHT, row += 15, MOB_PREFIX + "title", -1));
|
||||||
|
for (MobRenderers i : MobRenderers.values()) {
|
||||||
|
addButton(new Checkbox(RIGHT, row += 15, MOB_PREFIX + i.name().toLowerCase(), i.get(), i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button) throws IOException {
|
||||||
|
if (button instanceof IActionable) {
|
||||||
|
((IActionable)button).perform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
drawDefaultBackground();
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
LiteLoader.getInstance().writeConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getTitle() {
|
||||||
|
return OPTIONS_PREFIX + "title";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean mustScroll() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
12
src/main/java/com/minelittlepony/gui/IActionable.java
Normal file
12
src/main/java/com/minelittlepony/gui/IActionable.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An element that can perform an action.
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IActionable {
|
||||||
|
/**
|
||||||
|
* Does whatever.
|
||||||
|
*/
|
||||||
|
void perform();
|
||||||
|
}
|
15
src/main/java/com/minelittlepony/gui/IGUIAction.java
Normal file
15
src/main/java/com/minelittlepony/gui/IGUIAction.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response actions for UI events.
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IGUIAction<T> {
|
||||||
|
/**
|
||||||
|
* Performs this action now.
|
||||||
|
*
|
||||||
|
* @param value New Value of the field being changed
|
||||||
|
* @return Adjusted value the field must take on
|
||||||
|
*/
|
||||||
|
T perform(T value);
|
||||||
|
}
|
37
src/main/java/com/minelittlepony/gui/Label.java
Normal file
37
src/main/java/com/minelittlepony/gui/Label.java
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
|
||||||
|
public class Label extends GuiButton {
|
||||||
|
|
||||||
|
private boolean center;
|
||||||
|
|
||||||
|
private int color;
|
||||||
|
|
||||||
|
private String text;
|
||||||
|
|
||||||
|
public Label(int x, int y, String translationString, int color) {
|
||||||
|
this(x, y, translationString, color, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Label(int x, int y, String translationString, int color, boolean center) {
|
||||||
|
super(0, x, y, "");
|
||||||
|
this.color = color;
|
||||||
|
this.center = center;
|
||||||
|
this.text = translationString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
if (center) {
|
||||||
|
drawCenteredString(mc.fontRenderer, I18n.format(text), x, y, color);
|
||||||
|
} else {
|
||||||
|
drawString(mc.fontRenderer, I18n.format(text), x, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
104
src/main/java/com/minelittlepony/gui/PonySettingsPanel.java
Normal file
104
src/main/java/com/minelittlepony/gui/PonySettingsPanel.java
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
|
import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boilerplate because LiteLoader has to be such a 'special flower' -_-
|
||||||
|
*/
|
||||||
|
public class PonySettingsPanel extends GuiPonySettings implements ConfigPanel {
|
||||||
|
|
||||||
|
private int contentHeight;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPanelTitle() {
|
||||||
|
return I18n.format(getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getContentHeight() {
|
||||||
|
return contentHeight + 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <T extends GuiButton> T addButton(T button) {
|
||||||
|
if (button.y > contentHeight) {
|
||||||
|
contentHeight = button.y;
|
||||||
|
}
|
||||||
|
return super.addButton(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPanelShown(ConfigPanelHost host) {
|
||||||
|
mc = Minecraft.getMinecraft();
|
||||||
|
width = host.getWidth();
|
||||||
|
buttonList.clear();
|
||||||
|
initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPanelResize(ConfigPanelHost host) {
|
||||||
|
width = host.getWidth();
|
||||||
|
buttonList.clear();
|
||||||
|
initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPanelHidden() {
|
||||||
|
onGuiClosed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(ConfigPanelHost host) {
|
||||||
|
updateScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPanel(ConfigPanelHost host, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
try {
|
||||||
|
mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
mouseReleased(mouseX, mouseY, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseMoved(ConfigPanelHost host, int mouseX, int mouseY) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(ConfigPanelHost host, char keyChar, int keyCode) {
|
||||||
|
try {
|
||||||
|
keyTyped(keyChar, keyCode);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawWorldBackground(int tint) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean mustScroll() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
38
src/main/java/com/minelittlepony/gui/Slider.java
Normal file
38
src/main/java/com/minelittlepony/gui/Slider.java
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiSlider;
|
||||||
|
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
|
||||||
|
|
||||||
|
public class Slider extends GuiSlider {
|
||||||
|
|
||||||
|
private static Responder callback;
|
||||||
|
|
||||||
|
public Slider(int x, int y, float minIn, float maxIn, float defaultValue, GuiSlider.FormatHelper formatter, IGUIAction<Float> action) {
|
||||||
|
super(callback = new Responder(action), 0, x, y, "", minIn, maxIn, defaultValue, formatter);
|
||||||
|
callback.owner = this;
|
||||||
|
callback = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class Responder implements GuiResponder {
|
||||||
|
|
||||||
|
private final IGUIAction<Float> action;
|
||||||
|
|
||||||
|
private Slider owner;
|
||||||
|
|
||||||
|
private Responder(IGUIAction<Float> callback) {
|
||||||
|
action = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntryValue(int id, boolean value) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntryValue(int id, float value) {
|
||||||
|
owner.setSliderValue(action.perform(value), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntryValue(int id, String value) { }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -97,7 +97,7 @@ public class ModelPonyArmor extends AbstractPonyModel {
|
||||||
flankGuard.showModel = invisible;
|
flankGuard.showModel = invisible;
|
||||||
saddle.showModel = invisible;
|
saddle.showModel = invisible;
|
||||||
bipedHead.showModel = invisible;
|
bipedHead.showModel = invisible;
|
||||||
tail.isHidden = true;
|
tail.setVisible(false);
|
||||||
neck.isHidden = true;
|
neck.isHidden = true;
|
||||||
upperTorso.isHidden = true;
|
upperTorso.isHidden = true;
|
||||||
snout.isHidden = true;
|
snout.isHidden = true;
|
||||||
|
|
|
@ -19,4 +19,11 @@ public interface IModelPart {
|
||||||
* Renders this model component.
|
* Renders this model component.
|
||||||
*/
|
*/
|
||||||
void render(float scale);
|
void render(float scale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this part should be rendered.
|
||||||
|
*/
|
||||||
|
default void setVisible(boolean visible) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class PonyTail extends PlaneRenderer implements IModelPart {
|
||||||
|
|
||||||
private int tailStop = 0;
|
private int tailStop = 0;
|
||||||
|
|
||||||
|
public boolean isHidden = false;
|
||||||
|
|
||||||
public PonyTail(AbstractPonyModel model) {
|
public PonyTail(AbstractPonyModel model) {
|
||||||
super(model);
|
super(model);
|
||||||
theModel = model;
|
theModel = model;
|
||||||
|
@ -72,6 +74,11 @@ public class PonyTail extends PlaneRenderer implements IModelPart {
|
||||||
rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F;
|
rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
isHidden = !visible;
|
||||||
|
}
|
||||||
|
|
||||||
private class TailSegment extends PlaneRenderer {
|
private class TailSegment extends PlaneRenderer {
|
||||||
|
|
||||||
private final int index;
|
private final int index;
|
||||||
|
@ -103,7 +110,7 @@ public class PonyTail extends PlaneRenderer implements IModelPart {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float scale) {
|
public void render(float scale) {
|
||||||
if (index < tailStop) {
|
if (!isHidden && index < tailStop) {
|
||||||
super.render(scale);
|
super.render(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,13 @@ package com.minelittlepony.pony.data;
|
||||||
public enum PonyLevel {
|
public enum PonyLevel {
|
||||||
PONIES,
|
PONIES,
|
||||||
HUMANS,
|
HUMANS,
|
||||||
BOTH
|
BOTH;
|
||||||
|
|
||||||
|
public static PonyLevel valueFor(float index) {
|
||||||
|
PonyLevel[] values = values();
|
||||||
|
if (index < 0) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
return values[(int)Math.round(index) % values.length];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package com.minelittlepony.render.ponies;
|
||||||
|
|
||||||
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
import com.minelittlepony.PonyRenderManager;
|
||||||
|
import com.minelittlepony.settings.SensibleConfig.Setting;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.entity.monster.*;
|
||||||
|
import net.minecraft.entity.passive.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Central location where new entity renderers are registered and applied.
|
||||||
|
*
|
||||||
|
* Due to the limitations in Mumfrey's framework, needs to be paired with a field in PonyConfig.
|
||||||
|
*/
|
||||||
|
public enum MobRenderers implements Setting {
|
||||||
|
VILLAGERS {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityVillager.class, new RenderPonyVillager(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityWitch.class, new RenderPonyWitch(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityZombieVillager.class, new RenderPonyZombieVillager(manager));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ZOMBIES {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityZombie.class, new RenderPonyZombie<>(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityHusk.class, new RenderPonyZombie.Husk(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityGiantZombie.class, new RenderPonyZombie.Giant(manager));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
PIGZOMBIES {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityPigZombie.class, new RenderPonyPigman(manager));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SKELETONS {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntitySkeleton.class, new RenderPonySkeleton<>(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityStray.class, new RenderPonySkeleton.Stray(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(manager));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ILLAGERS {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityVex.class, new RenderPonyVex(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityEvoker.class, new RenderPonyIllager.Evoker(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityVindicator.class, new RenderPonyIllager.Vindicator(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(manager));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
GUARDIANS {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityGuardian.class, new RenderPonyGuardian(manager));
|
||||||
|
pony.switchRenderer(state, manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(boolean value) {
|
||||||
|
Setting.super.set(value);
|
||||||
|
apply(MineLittlePony.getInstance().getRenderManager(), Minecraft.getMinecraft().getRenderManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply(PonyRenderManager pony, RenderManager manager) {
|
||||||
|
boolean state = get();
|
||||||
|
register(state, pony, manager);
|
||||||
|
if (state) {
|
||||||
|
MineLittlePony.logger.info(name() + " are now ponies.");
|
||||||
|
} else {
|
||||||
|
MineLittlePony.logger.info(name() + " are no longer ponies.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void register(boolean state, PonyRenderManager pony, RenderManager manager);
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.minelittlepony.settings;
|
||||||
|
|
||||||
|
import com.minelittlepony.gui.IGUIAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sensible config container that actually lets us programatically index values by a key.
|
||||||
|
*
|
||||||
|
* Reflection because Mumfrey pls.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// Mumfrey pls.
|
||||||
|
public abstract class SensibleConfig {
|
||||||
|
|
||||||
|
private static SensibleConfig instance;
|
||||||
|
|
||||||
|
public SensibleConfig() {
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Setting extends IGUIAction<Boolean> {
|
||||||
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the config value associated with this entry.
|
||||||
|
*/
|
||||||
|
default boolean get() {
|
||||||
|
return instance.getValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the config value associated with this entry.
|
||||||
|
*/
|
||||||
|
default void set(boolean value) {
|
||||||
|
instance.setValue(this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default Boolean perform(Boolean v) {
|
||||||
|
set(v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getValue(Setting key) {
|
||||||
|
try {
|
||||||
|
return this.getClass().getField(key.name().toLowerCase()).getBoolean(this);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setValue(Setting key, boolean value) {
|
||||||
|
try {
|
||||||
|
this.getClass().getField(key.name().toLowerCase()).setBoolean(this, value);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) {
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ minelp.options.showscale=Use show-accurate scaling
|
||||||
minelp.mobs.title=Mob Settings
|
minelp.mobs.title=Mob Settings
|
||||||
minelp.mobs.villagers=Ponify villagers
|
minelp.mobs.villagers=Ponify villagers
|
||||||
minelp.mobs.zombies=Ponify zombies
|
minelp.mobs.zombies=Ponify zombies
|
||||||
minelp.mobs.zombiepigmen=Ponify zombie pigmen
|
minelp.mobs.pigzombies=Ponify zombie pigmen
|
||||||
minelp.mobs.skeletons=Ponify skeletons
|
minelp.mobs.skeletons=Ponify skeletons
|
||||||
minelp.mobs.illagers=Ponify illagers
|
minelp.mobs.illagers=Ponify illagers
|
||||||
minelp.mobs.guardians=Ponify guardians
|
minelp.mobs.guardians=Ponify guardians
|
||||||
|
|
|
@ -15,7 +15,7 @@ minelp.options.showscale=Utiliser échelle fidéle á MLP
|
||||||
minelp.mobs.title=Options de mobs
|
minelp.mobs.title=Options de mobs
|
||||||
minelp.mobs.villagers=Ponifier villageois
|
minelp.mobs.villagers=Ponifier villageois
|
||||||
minelp.mobs.zombies=Ponifier zombies
|
minelp.mobs.zombies=Ponifier zombies
|
||||||
minelp.mobs.zombiepigmen=Ponifier cochon-zombie
|
minelp.mobs.pigzombies=Ponifier cochon-zombie
|
||||||
minelp.mobs.skeletons=Ponifier squelettes
|
minelp.mobs.skeletons=Ponifier squelettes
|
||||||
minelp.mobs.illagers=Ponifier illagers
|
minelp.mobs.illagers=Ponifier illagers
|
||||||
minelp.mobs.guardians=Ponifier gardien
|
minelp.mobs.guardians=Ponifier gardien
|
||||||
|
|
|
@ -12,5 +12,5 @@ minelp.options.showscale=Использовать более точное мас
|
||||||
minelp.mobs.title=Пони-мобы
|
minelp.mobs.title=Пони-мобы
|
||||||
minelp.mobs.villagers=Пони-житель
|
minelp.mobs.villagers=Пони-житель
|
||||||
minelp.mobs.zombies=Пони-зомби
|
minelp.mobs.zombies=Пони-зомби
|
||||||
minelp.mobs.zombiepigmen=Пони-свинозомби
|
minelp.mobs.pigzombies=Пони-свинозомби
|
||||||
minelp.mobs.skeletons=Пони-скелеты
|
minelp.mobs.skeletons=Пони-скелеты
|
||||||
|
|
Loading…
Reference in a new issue