ConfigBuilder.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package me.shedaniel.clothconfig2.api;
  2. import me.shedaniel.clothconfig2.impl.ConfigBuilderImpl;
  3. import me.shedaniel.clothconfig2.impl.ConfigEntryBuilderImpl;
  4. import net.minecraft.client.gui.screen.Screen;
  5. import net.minecraft.util.Identifier;
  6. import java.util.function.Consumer;
  7. public interface ConfigBuilder {
  8. @SuppressWarnings("deprecation")
  9. public static ConfigBuilder create() {
  10. return new ConfigBuilderImpl();
  11. }
  12. /**
  13. * @deprecated Use {@link ConfigBuilder#create()}
  14. */
  15. @Deprecated
  16. public static ConfigBuilder create(Screen parent, String title) {
  17. return create().setParentScreen(parent).setTitle(title);
  18. }
  19. ConfigBuilder setFallbackCategory(ConfigCategory fallbackCategory);
  20. Screen getParentScreen();
  21. ConfigBuilder setParentScreen(Screen parent);
  22. String getTitle();
  23. ConfigBuilder setTitle(String title);
  24. boolean isEditable();
  25. ConfigBuilder setEditable(boolean editable);
  26. ConfigCategory getOrCreateCategory(String categoryKey);
  27. ConfigBuilder removeCategory(String categoryKey);
  28. ConfigBuilder removeCategoryIfExists(String categoryKey);
  29. boolean hasCategory(String category);
  30. ConfigBuilder setShouldTabsSmoothScroll(boolean shouldTabsSmoothScroll);
  31. boolean isTabsSmoothScrolling();
  32. ConfigBuilder setShouldListSmoothScroll(boolean shouldListSmoothScroll);
  33. boolean isListSmoothScrolling();
  34. ConfigBuilder setDoesConfirmSave(boolean confirmSave);
  35. boolean doesConfirmSave();
  36. ConfigBuilder setDoesProcessErrors(boolean processErrors);
  37. boolean doesProcessErrors();
  38. Identifier getDefaultBackgroundTexture();
  39. ConfigBuilder setDefaultBackgroundTexture(Identifier texture);
  40. Runnable getSavingRunnable();
  41. ConfigBuilder setSavingRunnable(Runnable runnable);
  42. Consumer<Screen> getAfterInitConsumer();
  43. ConfigBuilder setAfterInitConsumer(Consumer<Screen> afterInitConsumer);
  44. default ConfigBuilder alwaysShowTabs() {
  45. return setAlwaysShowTabs(true);
  46. }
  47. boolean isAlwaysShowTabs();
  48. ConfigBuilder setAlwaysShowTabs(boolean alwaysShowTabs);
  49. ConfigBuilder setTransparentBackground(boolean transparentBackground);
  50. default ConfigBuilder transparentBackground() {
  51. return setTransparentBackground(true);
  52. }
  53. default ConfigBuilder solidBackground() {
  54. return setTransparentBackground(false);
  55. }
  56. @Deprecated
  57. default ConfigEntryBuilderImpl getEntryBuilder() {
  58. return (ConfigEntryBuilderImpl) entryBuilder();
  59. }
  60. default ConfigEntryBuilder entryBuilder() {
  61. return ConfigEntryBuilderImpl.create();
  62. }
  63. Screen build();
  64. }