-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73241aa
commit be8e307
Showing
6 changed files
with
29 additions
and
33 deletions.
There are no files selected for viewing
14 changes: 5 additions & 9 deletions
14
src/main/java/me/xmrvizzy/skyblocker/config/ConfigUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
package me.xmrvizzy.skyblocker.config; | ||
|
||
import dev.isxander.yacl3.api.Option; | ||
import dev.isxander.yacl3.api.controller.CyclingListControllerBuilder; | ||
import net.minecraft.text.Text; | ||
import dev.isxander.yacl3.api.controller.EnumControllerBuilder; | ||
|
||
public class ConfigUtils { | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <E extends Enum<?>> CyclingListControllerBuilder<E> createCyclingListController4Enum(Option<E> opt) { | ||
E[] constants = (E[]) opt.binding().defaultValue().getClass().getEnumConstants(); | ||
|
||
return CyclingListControllerBuilder.create(opt).values(constants).formatValue(formatter -> Text.of(formatter.toString())); | ||
} | ||
@SuppressWarnings("unchecked") | ||
public static <E extends Enum<E>> EnumControllerBuilder<E> createEnumCyclingListController(Option<E> opt) { | ||
return EnumControllerBuilder.create(opt).enumClass((Class<E>) opt.binding().defaultValue().getClass()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters