ConstructionWand/src/main/java/thetadev/constructionwand/basics/options/EnumReplace.java
Theta-Dev 14fb5689d1 Update 1.2:
Added RecipeGenerator
Fixed placing blocks facing player
2020-08-26 01:04:53 +02:00

34 lines
647 B
Java

package thetadev.constructionwand.basics.options;
import com.google.common.base.Enums;
public enum EnumReplace implements IEnumOption
{
YES,
NO;
private static EnumReplace[] vals = values();
public IEnumOption fromName(String name) {
return Enums.getIfPresent(EnumReplace.class, name.toUpperCase()).or(this);
}
public EnumReplace next(boolean dir) {
int i = this.ordinal() + (dir ? 1:-1);
if(i < 0) i += vals.length;
return vals[i % vals.length];
}
public int getOrdinal() {
return ordinal();
}
public String getOptionKey() {
return "replace";
}
public String getValue() {
return this.name().toLowerCase();
}
}