@@ -59,14 +59,14 @@ public class AllCreativeModeTabs {
59
59
() -> FabricItemGroup .builder ()
60
60
.title (Components .translatable ("itemGroup.create.base" ))
61
61
.icon (() -> AllBlocks .COGWHEEL .asStack ())
62
- .displayItems (new RegistrateDisplayItemsGenerator (true , Tabs . BASE ))
62
+ .displayItems (new RegistrateDisplayItemsGenerator (true , () -> AllCreativeModeTabs . BASE_CREATIVE_TAB ))
63
63
.build ());
64
64
65
65
public static final TabInfo PALETTES_CREATIVE_TAB = register ("palettes" ,
66
66
() -> FabricItemGroup .builder ()
67
67
.title (Components .translatable ("itemGroup.create.palettes" ))
68
68
.icon (() -> AllPaletteBlocks .ORNATE_IRON_WINDOW .asStack ())
69
- .displayItems (new RegistrateDisplayItemsGenerator (false , Tabs . PALETTES ))
69
+ .displayItems (new RegistrateDisplayItemsGenerator (false , () -> AllCreativeModeTabs . PALETTES_CREATIVE_TAB ))
70
70
.build ());
71
71
72
72
private static TabInfo register (String name , Supplier <CreativeModeTab > supplier ) {
@@ -81,29 +81,6 @@ public static void register() {
81
81
// fabric: just load the class
82
82
}
83
83
84
- public static ResourceKey <CreativeModeTab > getBaseTabKey () {
85
- return BASE_CREATIVE_TAB .key ();
86
- }
87
-
88
- public static ResourceKey <CreativeModeTab > getPalettesTabKey () {
89
- return PALETTES_CREATIVE_TAB .key ();
90
- }
91
-
92
- public enum Tabs {
93
- BASE (AllCreativeModeTabs ::getBaseTabKey ),
94
- PALETTES (AllCreativeModeTabs ::getPalettesTabKey );
95
-
96
- private final Supplier <ResourceKey <CreativeModeTab >> keySupplier ;
97
-
98
- Tabs (Supplier <ResourceKey <CreativeModeTab >> keySupplier ) {
99
- this .keySupplier = keySupplier ;
100
- }
101
-
102
- public ResourceKey <CreativeModeTab > getKey () {
103
- return keySupplier .get ();
104
- }
105
- }
106
-
107
84
private static class RegistrateDisplayItemsGenerator implements DisplayItemsGenerator {
108
85
private static final Predicate <Item > IS_ITEM_3D_PREDICATE ;
109
86
@@ -131,9 +108,9 @@ private static Predicate<Item> makeClient3dItemPredicate() {
131
108
}
132
109
133
110
private final boolean addItems ;
134
- private final Tabs tabFilter ;
111
+ private final Supplier < TabInfo > tabFilter ;
135
112
136
- public RegistrateDisplayItemsGenerator (boolean addItems , Tabs tabFilter ) {
113
+ public RegistrateDisplayItemsGenerator (boolean addItems , Supplier < TabInfo > tabFilter ) {
137
114
this .addItems = addItems ;
138
115
this .tabFilter = tabFilter ;
139
116
}
@@ -307,7 +284,7 @@ public void accept(ItemDisplayParameters parameters, Output output) {
307
284
private List <Item > collectBlocks (Predicate <Item > exclusionPredicate ) {
308
285
List <Item > items = new ReferenceArrayList <>();
309
286
for (RegistryEntry <Block > entry : Create .REGISTRATE .getAll (Registries .BLOCK )) {
310
- if (!CreateRegistrate .isInCreativeTab (entry , tabFilter .getKey ()))
287
+ if (!CreateRegistrate .isInCreativeTab (entry , tabFilter .get (). key ()))
311
288
continue ;
312
289
Item item = entry .get ()
313
290
.asItem ();
@@ -323,7 +300,7 @@ private List<Item> collectBlocks(Predicate<Item> exclusionPredicate) {
323
300
private List <Item > collectItems (Predicate <Item > exclusionPredicate ) {
324
301
List <Item > items = new ReferenceArrayList <>();
325
302
for (RegistryEntry <Item > entry : Create .REGISTRATE .getAll (Registries .ITEM )) {
326
- if (!CreateRegistrate .isInCreativeTab (entry , tabFilter .getKey ()))
303
+ if (!CreateRegistrate .isInCreativeTab (entry , tabFilter .get (). key ()))
327
304
continue ;
328
305
Item item = entry .get ();
329
306
if (item instanceof BlockItem )
0 commit comments