Update Kirin

This commit is contained in:
Sollace 2019-07-11 19:20:13 +02:00
parent b5708a9820
commit 4d81b3b449
10 changed files with 38 additions and 57 deletions

View file

@ -141,7 +141,7 @@ public class MineLittlePony implements ClientModInitializer {
private void onScreenInit(Screen screen, ScreenInitCallback.ButtonList buttons) {
if (screen instanceof TitleScreen) {
VisibilityMode mode = config.getHorseButtonMode();
VisibilityMode mode = config.horseButton.get();
boolean show = mode == VisibilityMode.ON || (mode == VisibilityMode.AUTO
&& !(hasHdSkins || hasModMenu
));

View file

@ -76,10 +76,10 @@ public class GuiPonySettings extends GameGui {
.setText("gui.done");
content.addButton(new Label(LEFT, row)).getStyle().setText(PONY_LEVEL);
content.addButton(new Slider(LEFT, row += 20, 0, 2, config.getPonyLevel().ordinal())
content.addButton(new Slider(LEFT, row += 20, 0, 2, config.ponyLevel.get().ordinal())
.onChange(v -> {
PonyLevel level = PonyLevel.valueFor(v);
config.setPonyLevel(level);
config.ponyLevel.set(level);
return (float)level.ordinal();
})
.setFormatter(value -> I18n.translate(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase())));
@ -90,8 +90,8 @@ public class GuiPonySettings extends GameGui {
.onChange(config::setGlobalScaleFactor)
.setFormatter(value -> I18n.translate("minelp.debug.scale.value", I18n.translate(describeCurrentScale(value)))));
content.addButton(new Label(LEFT, row += 30)).getStyle().setText("minelp.debug.size");
content.addButton(new EnumSlider<>(LEFT, row += 15, config.getOverrideSize())
.onChange(config::setSizeOverride));
content.addButton(new EnumSlider<>(LEFT, row += 15, config.sizeOverride.get())
.onChange(config.sizeOverride::set));
}
row += 20;
@ -104,8 +104,8 @@ public class GuiPonySettings extends GameGui {
content.addButton(new Label(LEFT, row += 20)).getStyle().setText(OPTIONS_PREFIX + "button");
content.addButton(new EnumSlider<>(LEFT, row += 20, config.getHorseButtonMode())
.onChange(config::setHorseButtonMode));
content.addButton(new EnumSlider<>(LEFT, row += 20, config.horseButton.get())
.onChange(config.horseButton::set));
if (RIGHT != LEFT) {
row = 0;

View file

@ -21,7 +21,7 @@ public abstract class MixinDefaultPlayerSkin {
at = @At("HEAD"),
cancellable = true)
private static void legacySkin(CallbackInfoReturnable<Identifier> cir) {
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
cir.setReturnValue(IPonyManager.STEVE);
}
}
@ -30,7 +30,7 @@ public abstract class MixinDefaultPlayerSkin {
at = @At("HEAD"),
cancellable = true)
private static void defaultSkin(UUID uuid, CallbackInfoReturnable<Identifier> cir) {
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
cir.setReturnValue(IPonyManager.getDefaultSkin(uuid));
}
}
@ -39,7 +39,7 @@ public abstract class MixinDefaultPlayerSkin {
at = @At("HEAD"),
cancellable = true)
private static void skinType(UUID uuid, CallbackInfoReturnable<String> cir) {
if (MineLittlePony.getInstance().getConfig().getPonyLevel() == PonyLevel.PONIES) {
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
cir.setReturnValue(PlayerModels.forRace(MineLittlePony.getInstance().getManager()
.getPony(IPonyManager.getDefaultSkin(uuid), uuid)

View file

@ -109,7 +109,7 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
public IPony getPony(Identifier resource, UUID uuid) {
IPony pony = getPony(resource);
if (config.getPonyLevel() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
if (config.ponyLevel.get() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
return getBackgroundPony(uuid);
}
@ -118,7 +118,7 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
@Override
public IPony getDefaultPony(UUID uuid) {
if (config.getPonyLevel() != PonyLevel.PONIES) {
if (config.ponyLevel.get() != PonyLevel.PONIES) {
return getPony(DefaultSkinHelper.getTexture(uuid));
}

View file

@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.PonyRenderManager;
import com.minelittlepony.common.util.settings.Config;
import com.minelittlepony.common.util.settings.Setting;
import java.util.List;
@ -13,7 +14,7 @@ import net.minecraft.entity.passive.*;
/**
* Central location where new entity renderers are registered and applied.
*/
public enum MobRenderers implements Config.Setting<Boolean> {
public enum MobRenderers implements Setting<Boolean> {
VILLAGERS {
@Override
void register(boolean state, PonyRenderManager pony) {
@ -78,9 +79,10 @@ public enum MobRenderers implements Config.Setting<Boolean> {
}
@Override
public void set(Boolean value) {
Config.Setting.super.set(value);
public Boolean set(Boolean value) {
value = Setting.super.set(value);
apply(PonyRenderManager.getInstance());
return value;
}
@Override

View file

@ -20,7 +20,7 @@ public class PlayerSkullRenderer extends PonySkull {
@Override
public boolean canRender(PonyConfig config) {
return config.getPonyLevel() != PonyLevel.HUMANS;
return config.ponyLevel.get() != PonyLevel.HUMANS;
}
@Override

View file

@ -5,11 +5,15 @@ import net.minecraft.entity.player.PlayerEntity;
import com.minelittlepony.client.render.entities.MobRenderers;
import com.minelittlepony.common.client.gui.VisibilityMode;
import com.minelittlepony.common.util.settings.Setting;
import com.minelittlepony.settings.PonyConfig;
public class ClientPonyConfig extends PonyConfig {
private final Setting<VisibilityMode> buttonMode = new Value<>("horseButton", VisibilityMode.AUTO);
/**
* Visibility mode for the horse button.
*/
public final Setting<VisibilityMode> horseButton = value("horseButton", VisibilityMode.AUTO);
public ClientPonyConfig() {
initWith(MobRenderers.values());
@ -23,13 +27,4 @@ public class ClientPonyConfig extends PonyConfig {
player.calculateDimensions();
}
}
public VisibilityMode getHorseButtonMode() {
return buttonMode.get();
}
public VisibilityMode setHorseButtonMode(VisibilityMode value) {
buttonMode.set(value);
return value;
}
}

View file

@ -56,7 +56,7 @@ public enum Size implements ITriggerPixelMapped<Size> {
}
public Size getEffectiveSize() {
Size sz = MineLittlePony.getInstance().getConfig().getOverrideSize();
Size sz = MineLittlePony.getInstance().getConfig().sizeOverride.get();
if (sz != UNSET) {
return sz;

View file

@ -3,6 +3,7 @@ package com.minelittlepony.settings;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.common.util.settings.JsonConfig;
import com.minelittlepony.common.util.settings.Setting;
import com.minelittlepony.pony.meta.Size;
/**
@ -10,9 +11,16 @@ import com.minelittlepony.pony.meta.Size;
*/
public class PonyConfig extends JsonConfig {
private final Setting<PonyLevel> ponyLevel = new Value<>("ponylevel", PonyLevel.PONIES);
private final Setting<Float> scaleFactor = new Value<>("globalScaleFactor", 0.9F);
private final Setting<Size> sizeOverride = new Value<>("sieOverride", Size.UNSET);
/**
* Sets the pony level. Want MOAR PONEHS? Well here you go.
*/
public final Setting<PonyLevel> ponyLevel = value("ponylevel", PonyLevel.PONIES);
private final Setting<Float> scaleFactor = value("globalScaleFactor", 0.9F);
/**
* Debug override for pony sizes.
*/
public final Setting<Size> sizeOverride = value("sizeOverride", Size.UNSET);
public PonyConfig() {
initWith(PonySettings.values());
@ -24,23 +32,7 @@ public class PonyConfig extends JsonConfig {
* @param ignorePony true to ignore whatever value the setting has.
*/
public PonyLevel getEffectivePonyLevel(boolean ignorePony) {
return ignorePony ? PonyLevel.BOTH : getPonyLevel();
}
/**
* Actually gets the pony level value. No option to ignore reality here.
*/
public PonyLevel getPonyLevel() {
return ponyLevel.get();
}
/**
* Sets the pony level. Want MOAR PONEHS? Well here you go.
*
* @param ponylevel
*/
public void setPonyLevel(PonyLevel ponylevel) {
ponyLevel.set(ponylevel);
return ignorePony ? PonyLevel.BOTH : ponyLevel.get();
}
public float setGlobalScaleFactor(float f) {
@ -58,13 +50,4 @@ public class PonyConfig extends JsonConfig {
public float getGlobalScaleFactor() {
return PonySettings.SHOWSCALE.get() ? scaleFactor.get() : 1;
}
public Size getOverrideSize() {
return sizeOverride.get();
}
public Size setSizeOverride(Size value) {
sizeOverride.set(value);
return value;
}
}

View file

@ -2,11 +2,12 @@ package com.minelittlepony.settings;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.common.util.settings.Config;
import com.minelittlepony.common.util.settings.Setting;
/**
* Mod settings.
*/
public enum PonySettings implements Config.Setting<Boolean> {
public enum PonySettings implements Setting<Boolean> {
SIZES,
SNUZZLES,
FILLYCAM,