mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-20 20:22:17 +00:00
Unified build script (#175)
* Update build script * Update build script to import fix for shadow in dev and sources artifacts * Update fixed build script to shadow csv dependency in dev jar as well * Moved jitpack * Move new files
This commit is contained in:
1 parent
43b71b1de6
commit
a7ca6c8527
188 files changed
+646
-968
No files matched your search
@@ -0,0 +1,53 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
public class OptionCycled extends OptionButton
|
||||
{
|
||||
public final int count;
|
||||
public final boolean prefixed;
|
||||
|
||||
public OptionCycled(String name, int count, boolean prefixed) {
|
||||
super(name);
|
||||
this.count = count;
|
||||
this.prefixed = prefixed;
|
||||
}
|
||||
|
||||
public OptionCycled(String name, int count) {
|
||||
this(name, count, false);
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return renderTag().getIntValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return prefixed ? translateN(name) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
return cycle();
|
||||
}
|
||||
|
||||
public boolean cycle() {
|
||||
int next = value();
|
||||
do
|
||||
next = (next + 1) % count;
|
||||
while (!optionValid(next));
|
||||
|
||||
if (next == value())
|
||||
return false;
|
||||
|
||||
getTag().setIntValue(next);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean optionValid(int index) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user