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

56 lines
1.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;
/**
* Storage container for MineLP client settings.
*/
public class PonyConfig extends JsonConfig {
2019-05-28 10:26:26 +02:00
private final Setting<PonyLevel> ponyLevel = new Value<>("ponylevel", PonyLevel.PONIES);
private final Setting<Float> scaleFactor = new Value<>("globalScaleFactor", 0.9F);
public PonyConfig() {
initWith(PonySettings.values());
}
2018-10-21 17:19:00 +02:00
/**
* 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) {
return ignorePony ? PonyLevel.BOTH : getPonyLevel();
}
/**
* Actually gets the pony level value. No option to ignore reality here.
*/
2016-01-26 03:16:11 -05:00
public PonyLevel getPonyLevel() {
return ponyLevel.get();
2015-08-01 18:36:33 -04:00
}
/**
* Sets the pony level. Want MOAR PONEHS? Well here you go.
*
* @param ponylevel
*/
2016-01-26 03:16:11 -05:00
public void setPonyLevel(PonyLevel ponylevel) {
ponyLevel.set(ponylevel);
}
2018-10-21 17:19:00 +02:00
public void setGlobalScaleFactor(float f) {
f = Math.round(MathHelper.clamp(f, 0.1F, 3) * 100) / 100F;
scaleFactor.set(f);
PonySettings.SHOWSCALE.set(f != 1);
2018-10-21 17:19:00 +02:00
}
/**
* Gets the universal scale factor used to determine how tall ponies are.
*/
public float getGlobalScaleFactor() {
return PonySettings.SHOWSCALE.get() ? scaleFactor.get() : 1;
}
2015-08-01 18:36:33 -04:00
}