mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 22:07:59 +01:00
37 lines
872 B
Java
37 lines
872 B
Java
|
package com.minelittlepony.unicopia.container;
|
||
|
|
||
|
import net.minecraft.text.Text;
|
||
|
import net.minecraft.text.TranslatableText;
|
||
|
import net.minecraft.util.math.MathHelper;
|
||
|
|
||
|
public enum SpellbookPage {
|
||
|
INVENTORY,
|
||
|
DISCOVERIES,
|
||
|
RECIPES;
|
||
|
|
||
|
public static final SpellbookPage[] VALUES = values();
|
||
|
private static int current;
|
||
|
|
||
|
private final Text label = new TranslatableText("gui.unicopia.spellbook.page." + name().toLowerCase());
|
||
|
|
||
|
public Text getLabel() {
|
||
|
return label;
|
||
|
}
|
||
|
|
||
|
public boolean isFirst() {
|
||
|
return ordinal() == 0;
|
||
|
}
|
||
|
|
||
|
public boolean isLast() {
|
||
|
return ordinal() == VALUES.length - 1;
|
||
|
}
|
||
|
|
||
|
public static SpellbookPage getCurrent() {
|
||
|
return VALUES[current];
|
||
|
}
|
||
|
|
||
|
public static void swap(int increment) {
|
||
|
current = MathHelper.clamp(current + increment, 0, VALUES.length - 1);
|
||
|
}
|
||
|
}
|