Archive eaglercraft-archive-resent-3-3-source (source, 1.8.8, clean)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package dev.resent.setting;
|
||||
|
||||
public class BooleanSetting extends Setting{
|
||||
public boolean value;
|
||||
|
||||
public BooleanSetting(String name, String description, boolean value) {
|
||||
super(name, description);
|
||||
this.value = value;
|
||||
this.gameSetting = false;
|
||||
}
|
||||
|
||||
public boolean getValue() { return value; }
|
||||
public void setValue(boolean value) { this.value = value; }
|
||||
public void toggle(){ this.value = !this.value;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package dev.resent.setting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ModeSetting extends Setting{
|
||||
public List<String> modes = new ArrayList<>();
|
||||
|
||||
public String current;
|
||||
|
||||
public int curr = 0;
|
||||
|
||||
public ModeSetting(String name, String description, String... modes) {
|
||||
super(name, description);
|
||||
Collections.addAll(this.modes, modes);
|
||||
if (curr == this.modes.size()) {
|
||||
curr = 0;
|
||||
}
|
||||
current = this.modes.get(curr);
|
||||
}
|
||||
|
||||
public void onChange() { }
|
||||
|
||||
public void setValue(String val) {
|
||||
if (this.modes.contains(val)) {
|
||||
this.current = val;
|
||||
}
|
||||
}
|
||||
|
||||
public void next() {
|
||||
++curr;
|
||||
if (curr >= this.modes.size()) {
|
||||
curr = 0;
|
||||
}
|
||||
current = this.modes.get(curr);
|
||||
onChange();
|
||||
}
|
||||
|
||||
public void back() {
|
||||
--curr;
|
||||
if (curr <= this.modes.size()) {
|
||||
curr = 0;
|
||||
}
|
||||
|
||||
current = this.modes.get(curr);
|
||||
onChange();
|
||||
}
|
||||
|
||||
public String getValue() { return current; }
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package dev.resent.setting;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class NumberSetting extends Setting {
|
||||
public float value;
|
||||
public float increment;
|
||||
public float decrement;
|
||||
public float min;
|
||||
public float max;
|
||||
|
||||
public NumberSetting(String name, String description, float value, float min, float max, float increment, float decrement) {
|
||||
super(name, description);
|
||||
this.value = value;
|
||||
this.increment = increment;
|
||||
this.decrement = decrement;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void incr() {
|
||||
if (value + increment >= max) {
|
||||
value = max;
|
||||
} else {
|
||||
value += increment;
|
||||
}
|
||||
}
|
||||
|
||||
public void decr() {
|
||||
if (value - decrement <= min) {
|
||||
value = min;
|
||||
} else {
|
||||
value -= decrement;
|
||||
}
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public float getIncrement() {
|
||||
return increment;
|
||||
}
|
||||
|
||||
public void setIncrement(float increment) {
|
||||
this.increment = increment;
|
||||
}
|
||||
|
||||
public float getDecrement() {
|
||||
return decrement;
|
||||
}
|
||||
|
||||
public void setDecrement(float decrement) {
|
||||
this.decrement = decrement;
|
||||
}
|
||||
|
||||
public float getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(float min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public float getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(float max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void setValue(float value) {
|
||||
float newValue = 0;
|
||||
for (float i = 0; (i - 1) * increment < value; i++) {
|
||||
newValue = (i) * increment;
|
||||
}
|
||||
this.value = MathHelper.clamp_float(newValue, min, max);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package dev.resent.setting;
|
||||
|
||||
public class Setting {
|
||||
|
||||
public String name;
|
||||
public boolean gameSetting;
|
||||
public String description;
|
||||
|
||||
public Setting(String name, String description) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Setting(String name, String description, boolean gameSetting) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.gameSetting = gameSetting;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user