MineLittlePony/src/main/java/com/minelittlepony/settings/PonyConfig.java

81 lines
2.5 KiB
Java
Raw Normal View History

package com.minelittlepony.settings;
2015-08-01 18:36:33 -04:00
2018-10-21 17:19:00 +02:00
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.api.pony.meta.Sizes;
2019-07-11 09:41:16 +02:00
import com.minelittlepony.common.util.settings.JsonConfig;
2019-07-11 19:20:13 +02:00
import com.minelittlepony.common.util.settings.Setting;
2019-08-05 11:32:27 +02:00
import java.nio.file.Path;
/**
* Storage container for MineLP client settings.
*/
public class PonyConfig extends JsonConfig {
2019-07-11 19:20:13 +02:00
/**
* 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);
public final Setting<Boolean> sizes = value("settings", "sizes", true);
public final Setting<Boolean> snuzzles = value("settings", "snuzzles", true);
public final Setting<Boolean> fillycam = value("settings", "fillycam", true);
private final Setting<Boolean> showscale = value("settings", "showscale", true);
public final Setting<Boolean> fpsmagic = value("settings", "fpsmagic", true);
public final Setting<Boolean> tpsmagic = value("settings", "tpsmagic", true);
public final Setting<Boolean> ponyskulls = value("settings", "ponyskulls", true);
public final Setting<Boolean> frustrum = value("settings", "frustrum", true);
2019-07-11 19:20:13 +02:00
/**
* Debug override for pony sizes.
*/
public final Setting<Sizes> sizeOverride = value("sizeOverride", Sizes.UNSET);
2019-08-05 11:32:27 +02:00
public PonyConfig(Path path) {
super(path);
}
/**
* Gets the current PonyLevel. That is the level of ponies you would like to see.
*
* @param ignorePony true to ignore whatever value the setting has.
*/
public PonyLevel getEffectivePonyLevel(boolean ignorePony) {
2019-07-11 19:20:13 +02:00
return ignorePony ? PonyLevel.BOTH : ponyLevel.get();
}
public float setGlobalScaleFactor(float f) {
if (f < 0.15F) {
f = 0.1F;
}
if (f > 2.95) {
f = 3;
}
if (f > 1.97 && f < 2.03) {
f = 2;
}
if (f > 0.97 && f < 1.03) {
f = 1;
}
if (f > 0.87 && f < 0.93) {
f = 0.9F;
}
f = Math.round(MathHelper.clamp(f, 0.1F, 3) * 100F) / 100F;
scaleFactor.set(f);
showscale.set(f != 1);
return getGlobalScaleFactor();
2018-10-21 17:19:00 +02:00
}
/**
* Gets the universal scale factor used to determine how tall ponies are.
*/
public float getGlobalScaleFactor() {
return showscale.get() ? scaleFactor.get() : 1;
}
2015-08-01 18:36:33 -04:00
}