mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Usability tweaks + added a button to open the hd skins gui directly from the pony settings screen
This commit is contained in:
parent
1423e6d7b0
commit
e85ac9f6c1
5 changed files with 71 additions and 21 deletions
|
@ -18,6 +18,6 @@ org.gradle.daemon=false
|
|||
|
||||
# Dependencies
|
||||
modmenu_version=1.15.+
|
||||
kirin_version=1.8-21w19a-SNAPSHOT
|
||||
kirin_version=1.8.2-21w19a-SNAPSHOT
|
||||
hd_skins_version=6.4.1-21w19a-SNAPSHOT
|
||||
mson_version=1.3.2-21w19a-SNAPSHOT
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -10,13 +9,14 @@ import com.minelittlepony.client.render.MobRenderers;
|
|||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
import com.minelittlepony.common.client.gui.GameGui;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
import com.minelittlepony.common.client.gui.Tooltip;
|
||||
import com.minelittlepony.common.client.gui.element.AbstractSlider;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.client.gui.element.EnumSlider;
|
||||
import com.minelittlepony.common.client.gui.element.Label;
|
||||
import com.minelittlepony.common.client.gui.element.Slider;
|
||||
import com.minelittlepony.common.client.gui.element.Toggle;
|
||||
import com.minelittlepony.common.util.settings.Setting;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -61,7 +61,6 @@ public class GuiPonySettings extends GameGui {
|
|||
@SuppressWarnings("unchecked")
|
||||
private void rebuildContent() {
|
||||
|
||||
|
||||
int LEFT = content.width / 2 - 210;
|
||||
int RIGHT = content.width / 2 + 10;
|
||||
|
||||
|
@ -81,13 +80,11 @@ 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.ponyLevel.get().ordinal())
|
||||
.onChange(v -> {
|
||||
PonyLevel level = PonyLevel.valueFor(v);
|
||||
config.ponyLevel.set(level);
|
||||
return (float)level.ordinal();
|
||||
})
|
||||
.setFormatter(value -> I18n.translate(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase())));
|
||||
|
||||
content.addButton(new EnumSlider<>(LEFT, row += 20, config.ponyLevel.get())
|
||||
.onChange(config.ponyLevel::set)
|
||||
.setTextFormat(sender -> new TranslatableText(PONY_LEVEL + "." + sender.getValue().name().toLowerCase()))
|
||||
.setTooltipFormat(sender -> Tooltip.of(PONY_LEVEL + "." + sender.getValue().name().toLowerCase() + ".tooltip", 200)));
|
||||
|
||||
boolean allowCameraChange = client.player == null || client.player.isCreative() || client.player.isSpectator() || client.isInSingleplayer();
|
||||
|
||||
|
@ -95,7 +92,7 @@ public class GuiPonySettings extends GameGui {
|
|||
content.addButton(new Label(LEFT, row += 30)).getStyle().setText("minelp.debug.scale");
|
||||
content.addButton(new Slider(LEFT, row += 15, 0.1F, 3, config.getGlobalScaleFactor())
|
||||
.onChange(config::setGlobalScaleFactor)
|
||||
.setFormatter(this::describeCurrentScale));
|
||||
.setTextFormat(this::describeCurrentScale));
|
||||
content.addButton(new Label(LEFT, row += 30)).getStyle().setText("minelp.debug.size");
|
||||
content.addButton(new EnumSlider<>(LEFT, row += 15, config.sizeOverride.get())
|
||||
.onChange(config.sizeOverride::set));
|
||||
|
@ -119,9 +116,9 @@ 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.horseButton.get())
|
||||
.onChange(config.horseButton::set));
|
||||
.onChange(config.horseButton::set)
|
||||
.setTooltipFormat(sender -> Tooltip.of(OPTIONS_PREFIX + "button." + sender.getValue().name().toLowerCase(), 200)));
|
||||
|
||||
if (RIGHT != LEFT) {
|
||||
row = 0;
|
||||
|
@ -135,30 +132,36 @@ public class GuiPonySettings extends GameGui {
|
|||
.onChange(i::set)
|
||||
.getStyle().setText(MOB_PREFIX + i.name);
|
||||
}
|
||||
|
||||
row += 15;
|
||||
|
||||
content.addButton(new Label(RIGHT, row)).getStyle().setText("minelp.options.skins");
|
||||
SkinsProxy.instance.renderOption(this, row, RIGHT, content);
|
||||
}
|
||||
|
||||
public String describeCurrentScale(float value) {
|
||||
public TranslatableText describeCurrentScale(AbstractSlider<Float> sender) {
|
||||
float value = sender.getValue();
|
||||
if (value >= 3) {
|
||||
return "minelp.debug.scale.meg";
|
||||
return new TranslatableText("minelp.debug.scale.meg");
|
||||
}
|
||||
if (value == 2) {
|
||||
return "minelp.debug.scale.max";
|
||||
return new TranslatableText("minelp.debug.scale.max");
|
||||
}
|
||||
if (value == 1) {
|
||||
return "minelp.debug.scale.mid";
|
||||
return new TranslatableText("minelp.debug.scale.mid");
|
||||
}
|
||||
if (value == 0.9F) {
|
||||
return "minelp.debug.scale.sa";
|
||||
return new TranslatableText("minelp.debug.scale.sa");
|
||||
}
|
||||
if (value <= 0.1F) {
|
||||
return "minelp.debug.scale.min";
|
||||
return new TranslatableText("minelp.debug.scale.min");
|
||||
}
|
||||
|
||||
value *= 100F;
|
||||
value = Math.round(value);
|
||||
value /= 100F;
|
||||
|
||||
return I18n.translate("minelp.debug.scale.value", value);
|
||||
return new TranslatableText("minelp.debug.scale.value", value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,9 +2,13 @@ package com.minelittlepony.client;
|
|||
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
import com.minelittlepony.common.client.gui.Tooltip;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.texture.PlayerSkinProvider;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -29,7 +33,29 @@ public class SkinsProxy {
|
|||
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
|
||||
public void renderOption(Screen parent, int row, int RIGHT, ScrollContainer content) {
|
||||
content.addButton(new Button(RIGHT, row += 20, 150, 20))
|
||||
.setEnabled(false)
|
||||
.getStyle()
|
||||
.setTooltip(Tooltip.of("minelp.options.skins.hdskins.disabled", 200))
|
||||
.setText("minelp.options.skins.hdskins.open");
|
||||
}
|
||||
|
||||
public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) {
|
||||
return manager.getPony(player).getTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony.client.hdskins;
|
|||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.event.ClientReadyCallback;
|
||||
import com.minelittlepony.hdskins.client.SkinCacheClearCallback;
|
||||
import com.minelittlepony.hdskins.client.ducks.ClientPlayerInfo;
|
||||
|
@ -15,6 +17,8 @@ import com.minelittlepony.hdskins.profile.SkinType;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -46,6 +50,14 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOption(Screen parent, int row, int RIGHT, ScrollContainer content) {
|
||||
content.addButton(new Button(RIGHT, row += 20, 150, 20))
|
||||
.onClick(button -> MinecraftClient.getInstance().openScreen(GuiSkins.create(parent, HDSkins.getInstance().getSkinServerList())))
|
||||
.getStyle()
|
||||
.setText("minelp.options.skins.hdskins.open");;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) {
|
||||
if (player instanceof DummyPlayer) {
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
"minelp.options.title": "Mine Little Pony Settings",
|
||||
"minelp.options.ponylevel": "Pony Level",
|
||||
"minelp.options.ponylevel.ponies": "Ponies Only",
|
||||
"minelp.options.ponylevel.ponies.tooltip": "All players are ponies\n\nNon-pony skins are replaced with a random background pony",
|
||||
"minelp.options.ponylevel.humans": "Humans Only",
|
||||
"minelp.options.ponylevel.humans.tooltip": "All players are humans\n\nPony skins are used but will be applied to the human model",
|
||||
"minelp.options.ponylevel.both": "Both",
|
||||
"minelp.options.ponylevel.both.tooltip": "Players can be ponies or humans",
|
||||
"minelp.options.options": "Pony Options",
|
||||
"minelp.options.sizes": "Varied Pony Sizes",
|
||||
"minelp.options.skins": "Skin Uploader",
|
||||
"minelp.options.skins.hdskins.open": "Open HD Skins",
|
||||
"minelp.options.skins.hdskins.disabled": "HD Skins is not installed\n\nThe HD Skins mod is required to upload skins from in-game and to use custom skin servers.\n\nIf you cannot use that you will have to go to www.minecraft.net to upload your skin there.",
|
||||
"minelp.options.snuzzles": "Show Snuzzles",
|
||||
"minelp.options.fillycam": "Filly Cam",
|
||||
"minelp.options.showscale": "Show-accurate scaling",
|
||||
|
@ -14,6 +20,9 @@
|
|||
"minelp.options.ponyskulls": "Pony Skulls",
|
||||
"minelp.options.frustrum": "Frustum checks",
|
||||
"minelp.options.button": "Display On Title Screen",
|
||||
"minelp.options.button.on": "Always Display\n\nBoth the pony button and HD Skins button are visible (if installed)",
|
||||
"minelp.options.button.auto": "Display only when HD Skins is not installed",
|
||||
"minelp.options.button.off": "Never Display\n\nYou will only see the HD Skins button if installed.",
|
||||
"minelp.options.option.disabled": "This option is locked in survival multiplayer.\n\nChange game modes or leave and rejoin\nthe server to change this setting.",
|
||||
"minelp.mobs.title": "Mob Settings",
|
||||
"minelp.mobs.villagers": "Ponify Villagers",
|
||||
|
|
Loading…
Reference in a new issue