mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Lock certain features to prevent people form abusing them in smp
This commit is contained in:
parent
d74a853824
commit
90055cd4cd
2 changed files with 16 additions and 4 deletions
|
@ -4,6 +4,7 @@ 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;
|
||||
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
|
@ -87,7 +88,9 @@ public class GuiPonySettings extends GameGui {
|
|||
})
|
||||
.setFormatter(value -> I18n.translate(PONY_LEVEL + "." + PonyLevel.valueFor(value).name().toLowerCase())));
|
||||
|
||||
if (hiddenOptions) {
|
||||
boolean allowCameraChange = client.player == null || client.player.isCreative() || client.player.isSpectator() || client.isInSingleplayer();
|
||||
|
||||
if (hiddenOptions && allowCameraChange) {
|
||||
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)
|
||||
|
@ -100,10 +103,18 @@ public class GuiPonySettings extends GameGui {
|
|||
row += 20;
|
||||
content.addButton(new Label(LEFT, row)).getStyle().setText(OPTIONS_PREFIX + "options");
|
||||
|
||||
for (Setting<?> i : MineLittlePony.getInstance().getConfig().getByCategory("settings")) {
|
||||
content.addButton(new Toggle(LEFT, row += 20, ((Setting<Boolean>)i).get()))
|
||||
for (Setting<?> i : config.getByCategory("settings")) {
|
||||
boolean enabled = i != config.fillycam || allowCameraChange;
|
||||
Button button = content
|
||||
.addButton(new Toggle(LEFT, row += 20, ((Setting<Boolean>)i).get()))
|
||||
.onChange((Setting<Boolean>)i)
|
||||
.getStyle().setText(OPTIONS_PREFIX + i.name().toLowerCase());
|
||||
.setEnabled(enabled);
|
||||
button.getStyle().setText(OPTIONS_PREFIX + i.name().toLowerCase());
|
||||
if (!enabled) {
|
||||
button.getStyle()
|
||||
.setTooltip(new TranslatableText(OPTIONS_PREFIX + "option.disabled"))
|
||||
.setTooltipOffset(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
content.addButton(new Label(LEFT, row += 20)).getStyle().setText(OPTIONS_PREFIX + "button");
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"minelp.options.ponyskulls": "Pony Skulls",
|
||||
"minelp.options.frustrum": "Frustum checks",
|
||||
"minelp.options.button": "Display On Title Screen",
|
||||
"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",
|
||||
"minelp.mobs.zombies": "Ponify Zombies",
|
||||
|
|
Loading…
Reference in a new issue