2019-03-23 21:58:50 +02:00
|
|
|
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;
|
|
|
|
|
2019-07-11 09:41:16 +02:00
|
|
|
import com.minelittlepony.common.util.settings.JsonConfig;
|
2019-06-05 15:42:20 +02:00
|
|
|
import com.minelittlepony.pony.meta.Size;
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
2018-05-15 16:26:52 +02:00
|
|
|
* Storage container for MineLP client settings.
|
2018-04-25 21:29:49 +02:00
|
|
|
*/
|
2019-05-30 21:24:57 +02:00
|
|
|
public class PonyConfig extends JsonConfig {
|
2019-05-28 10:26:26 +02:00
|
|
|
|
2019-05-30 21:24:57 +02:00
|
|
|
private final Setting<PonyLevel> ponyLevel = new Value<>("ponylevel", PonyLevel.PONIES);
|
|
|
|
private final Setting<Float> scaleFactor = new Value<>("globalScaleFactor", 0.9F);
|
2019-06-05 15:42:20 +02:00
|
|
|
private final Setting<Size> sizeOverride = new Value<>("sieOverride", Size.UNSET);
|
2018-04-24 14:55:32 +02:00
|
|
|
|
2019-05-30 21:24:57 +02:00
|
|
|
public PonyConfig() {
|
|
|
|
initWith(PonySettings.values());
|
|
|
|
}
|
2018-10-21 17:19:00 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the current PonyLevel. That is the level of ponies you would like to see.
|
2018-08-26 18:27:28 -04:00
|
|
|
*
|
2018-04-25 21:29:49 +02:00
|
|
|
* @param ignorePony true to ignore whatever value the setting has.
|
|
|
|
*/
|
2018-05-01 19:33:17 +02:00
|
|
|
public PonyLevel getEffectivePonyLevel(boolean ignorePony) {
|
2018-04-24 14:55:32 +02:00
|
|
|
return ignorePony ? PonyLevel.BOTH : getPonyLevel();
|
|
|
|
}
|
2015-11-17 00:17:35 -05:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Actually gets the pony level value. No option to ignore reality here.
|
|
|
|
*/
|
2016-01-26 03:16:11 -05:00
|
|
|
public PonyLevel getPonyLevel() {
|
2019-05-30 21:24:57 +02:00
|
|
|
return ponyLevel.get();
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Sets the pony level. Want MOAR PONEHS? Well here you go.
|
2018-08-26 18:27:28 -04:00
|
|
|
*
|
2018-04-25 21:29:49 +02:00
|
|
|
* @param ponylevel
|
|
|
|
*/
|
2016-01-26 03:16:11 -05:00
|
|
|
public void setPonyLevel(PonyLevel ponylevel) {
|
2019-05-30 21:24:57 +02:00
|
|
|
ponyLevel.set(ponylevel);
|
2015-11-17 00:17:35 -05:00
|
|
|
}
|
2018-08-20 20:12:14 +02:00
|
|
|
|
2019-06-05 15:42:20 +02:00
|
|
|
public float setGlobalScaleFactor(float f) {
|
2019-05-30 21:24:57 +02:00
|
|
|
f = Math.round(MathHelper.clamp(f, 0.1F, 3) * 100) / 100F;
|
|
|
|
|
|
|
|
scaleFactor.set(f);
|
|
|
|
PonySettings.SHOWSCALE.set(f != 1);
|
2019-06-05 15:42:20 +02:00
|
|
|
|
|
|
|
return getGlobalScaleFactor();
|
2018-10-21 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the universal scale factor used to determine how tall ponies are.
|
|
|
|
*/
|
2018-08-20 20:12:14 +02:00
|
|
|
public float getGlobalScaleFactor() {
|
2019-05-30 21:24:57 +02:00
|
|
|
return PonySettings.SHOWSCALE.get() ? scaleFactor.get() : 1;
|
2018-08-20 20:12:14 +02:00
|
|
|
}
|
2019-06-05 15:42:20 +02:00
|
|
|
|
|
|
|
public Size getOverrideSize() {
|
|
|
|
return sizeOverride.get();
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:09:40 +02:00
|
|
|
public Size setSizeOverride(Size value) {
|
|
|
|
sizeOverride.set(value);
|
|
|
|
return value;
|
2019-06-05 15:42:20 +02:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|