ConfigObjectImpl.java 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * Roughly Enough Items by Danielshe.
  3. * Licensed under the MIT License.
  4. */
  5. package me.shedaniel.rei.impl;
  6. import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
  7. import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
  8. import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
  9. import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
  10. import me.shedaniel.rei.api.ConfigObject;
  11. import me.shedaniel.rei.api.annotations.Internal;
  12. import me.shedaniel.rei.gui.config.*;
  13. @Deprecated
  14. @Internal
  15. @Config(name = "roughlyenoughitems/config")
  16. public class ConfigObjectImpl implements ConfigObject, ConfigData {
  17. @ConfigEntry.Category("!general")
  18. @ConfigEntry.Gui.TransitiveObject
  19. @DontApplyFieldName
  20. private General general = new General();
  21. @ConfigEntry.Category("appearance")
  22. @ConfigEntry.Gui.TransitiveObject
  23. @DontApplyFieldName
  24. private Appearance appearance = new Appearance();
  25. @ConfigEntry.Category("modules")
  26. @ConfigEntry.Gui.TransitiveObject
  27. @DontApplyFieldName
  28. private Modules modules = new Modules();
  29. @ConfigEntry.Category("technical")
  30. @ConfigEntry.Gui.TransitiveObject
  31. @DontApplyFieldName
  32. private Technical technical = new Technical();
  33. @Override
  34. public boolean isLighterButtonHover() {
  35. return appearance.lighterButtonHover;
  36. }
  37. @Override
  38. public void setLighterButtonHover(boolean lighterButtonHover) {
  39. appearance.lighterButtonHover = lighterButtonHover;
  40. }
  41. @Override
  42. public boolean isOverlayVisible() {
  43. return general.overlayVisible;
  44. }
  45. @Override
  46. public void setOverlayVisible(boolean overlayVisible) {
  47. general.overlayVisible = overlayVisible;
  48. }
  49. @Override
  50. public boolean isCheating() {
  51. return general.cheating;
  52. }
  53. @Override
  54. public void setCheating(boolean cheating) {
  55. general.cheating = cheating;
  56. }
  57. @Override
  58. public ItemListOrdering getItemListOrdering() {
  59. return appearance.itemListOrdering.getOrdering();
  60. }
  61. @Override
  62. public boolean isItemListAscending() {
  63. return appearance.itemListOrdering.isAscending();
  64. }
  65. @Override
  66. public boolean isUsingDarkTheme() {
  67. return appearance.darkTheme;
  68. }
  69. @Override
  70. public boolean isToastDisplayedOnCopyIdentifier() {
  71. return modules.toastDisplayedOnCopyIdentifier;
  72. }
  73. @Override
  74. public boolean doesRenderEntryExtraOverlay() {
  75. return appearance.renderEntryExtraOverlay;
  76. }
  77. @Override
  78. public boolean isEntryListWidgetScrolled() {
  79. return appearance.scrollingEntryListWidget;
  80. }
  81. @Override
  82. public boolean shouldAppendModNames() {
  83. return appearance.appendModNames;
  84. }
  85. @Override
  86. public RecipeScreenType getRecipeScreenType() {
  87. return appearance.recipeScreenType;
  88. }
  89. @Override
  90. public void setRecipeScreenType(RecipeScreenType recipeScreenType) {
  91. appearance.recipeScreenType = recipeScreenType;
  92. }
  93. @Override
  94. public boolean isLoadingDefaultPlugin() {
  95. return technical.loadDefaultPlugin;
  96. }
  97. @Override
  98. public SearchFieldLocation getSearchFieldLocation() {
  99. return appearance.searchFieldLocation;
  100. }
  101. @Override
  102. public boolean isLeftHandSidePanel() {
  103. return appearance.mirrorItemPanel;
  104. }
  105. @Override
  106. public boolean isCraftableFilterEnabled() {
  107. return modules.enableCraftableOnlyButton;
  108. }
  109. @Override
  110. public String getGamemodeCommand() {
  111. return technical.gamemodeCommand;
  112. }
  113. @Override
  114. public String getGiveCommand() {
  115. return technical.giveCommand;
  116. }
  117. @Override
  118. public String getWeatherCommand() {
  119. return technical.weatherCommand;
  120. }
  121. @Override
  122. public int getMaxRecipePerPage() {
  123. return appearance.maxRecipePerPage;
  124. }
  125. @Override
  126. public boolean doesShowUtilsButtons() {
  127. return modules.showUtilsButtons;
  128. }
  129. @Override
  130. public boolean doesDisableRecipeBook() {
  131. return modules.disableRecipeBook;
  132. }
  133. @Override
  134. public boolean doesFixTabCloseContainer() {
  135. return modules.fixTabCloseContainer;
  136. }
  137. @Override
  138. public boolean areClickableRecipeArrowsEnabled() {
  139. return appearance.clickableRecipeArrows;
  140. }
  141. @Override
  142. public ItemCheatingMode getItemCheatingMode() {
  143. return appearance.itemCheatingMode;
  144. }
  145. @Override
  146. public boolean isUsingLightGrayRecipeBorder() {
  147. return appearance.lightGrayRecipeBorder;
  148. }
  149. @Override
  150. public boolean doesVillagerScreenHavePermanentScrollBar() {
  151. return appearance.villagerScreenPermanentScrollBar;
  152. }
  153. @Override
  154. public boolean doesRegisterRecipesInAnotherThread() {
  155. return technical.registerRecipesInAnotherThread;
  156. }
  157. @Override
  158. public boolean doesSnapToRows() {
  159. return appearance.snapToRows;
  160. }
  161. public static class General {
  162. @Comment("Declares whether cheating mode is on.")
  163. private boolean cheating = false;
  164. @Comment("Declares whether REI is visible.")
  165. @ConfigEntry.Gui.Excluded
  166. private boolean overlayVisible = true;
  167. }
  168. public static class Appearance {
  169. @Comment("The ordering of the items on the item panel.")
  170. @UseEnumSelectorInstead
  171. private ItemListOrderingConfig itemListOrdering = ItemListOrderingConfig.REGISTRY_ASCENDING;
  172. @Comment("Declares the appearance of REI windows.")
  173. private boolean darkTheme = false;
  174. @Comment("Whether REI should render entry's overlay.\nExample: Enchantment Glint")
  175. private boolean renderEntryExtraOverlay = true;
  176. @Comment("The ordering of the items on the item panel.")
  177. @UseEnumSelectorInstead
  178. private RecipeScreenType recipeScreenType = RecipeScreenType.UNSET;
  179. @Comment("Declares the position of the search field.")
  180. @UseEnumSelectorInstead
  181. private SearchFieldLocation searchFieldLocation = SearchFieldLocation.CENTER;
  182. @Comment("Declares the position of the item list panel.")
  183. private boolean mirrorItemPanel = false;
  184. @Comment("Declares the maximum amount of recipes displayed in a page if possible.")
  185. @ConfigEntry.BoundedDiscrete(min = 2, max = 99)
  186. private int maxRecipePerPage = 3;
  187. @Comment("Declares whether REI should lighten the button if hovered.")
  188. private boolean lighterButtonHover = true;
  189. private boolean clickableRecipeArrows = true;
  190. @UseEnumSelectorInstead
  191. private ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE;
  192. @Comment("Declares the appearance of recipe's border.")
  193. private boolean lightGrayRecipeBorder = false;
  194. @Comment("Declares whether REI should append mod names to item stacks.")
  195. private boolean appendModNames = true;
  196. @Comment("Declares how the scrollbar in villager screen should act.")
  197. private boolean villagerScreenPermanentScrollBar = false;
  198. @Comment("Declares whether if entry list widget is scrolled.")
  199. private boolean scrollingEntryListWidget = false;
  200. private boolean snapToRows = false;
  201. }
  202. public static class Technical {
  203. @Comment("To disable REI's default plugin.\nDon't change this unless you understand what you are doing!")
  204. private boolean loadDefaultPlugin = true;
  205. @Comment("Declares the command used to change gamemode.")
  206. private String gamemodeCommand = "/gamemode {gamemode}";
  207. @Comment("Declares the command used in servers to cheat items.")
  208. private String giveCommand = "/give {player_name} {item_identifier}{nbt} {count}";
  209. @Comment("Declares the command used to change weather.")
  210. private String weatherCommand = "/weather {weather}";
  211. private boolean registerRecipesInAnotherThread = true;
  212. }
  213. public static class Modules {
  214. @Comment("Declares whether the craftable filter button is enabled.")
  215. private boolean enableCraftableOnlyButton = true;
  216. private boolean toastDisplayedOnCopyIdentifier = true;
  217. @Comment("Declares whether the utils buttons are shown.")
  218. private boolean showUtilsButtons = false;
  219. @Comment("Declares whether REI should remove the recipe book.")
  220. private boolean disableRecipeBook = false;
  221. @Comment("Declares whether REI should fix closing container with tab.")
  222. private boolean fixTabCloseContainer = false;
  223. }
  224. }