11package com .github .ethanicuss .astraladditions .compat .rei ;
22
3-
43import com .github .ethanicuss .astraladditions .AstralAdditions ;
4+ import com .github .ethanicuss .astraladditions .compat .rei .create .BulkShimmeringCategory ;
55import com .github .ethanicuss .astraladditions .compat .rei .desizer .DesizerCategory ;
66import com .github .ethanicuss .astraladditions .compat .rei .desizer .DesizerDisplay ;
77import com .github .ethanicuss .astraladditions .compat .rei .transmute .TransmuteCategory ;
2424import com .github .ethanicuss .astraladditions .recipes .ChromaticVacuumRecipe ;
2525import com .github .ethanicuss .astraladditions .registry .ModBlocks ;
2626import com .github .ethanicuss .astraladditions .registry .ModItems ;
27+ import com .simibubi .create .AllBlocks ;
28+ import com .simibubi .create .AllItems ;
29+ import com .simibubi .create .compat .rei .DoubleItemIcon ;
30+ import com .simibubi .create .compat .rei .EmptyBackground ;
31+ import com .simibubi .create .compat .rei .category .CreateRecipeCategory ;
32+ import com .simibubi .create .compat .rei .display .CreateDisplay ;
33+ import com .unascribed .yttr .crafting .*;
2734import com .unascribed .yttr .init .YEnchantments ;
2835import com .unascribed .yttr .init .YItems ;
2936import com .unascribed .yttr .init .YRecipeTypes ;
3340import me .shedaniel .rei .api .client .registry .screen .ScreenRegistry ;
3441import me .shedaniel .rei .api .common .category .CategoryIdentifier ;
3542import me .shedaniel .rei .api .common .util .EntryStacks ;
36- import net .minecraft .client .MinecraftClient ;
43+ import net .fabricmc .api .EnvType ;
44+ import net .fabricmc .api .Environment ;
3745import net .minecraft .enchantment .EnchantmentHelper ;
3846import net .minecraft .item .ItemStack ;
3947import net .minecraft .item .Items ;
4048import net .minecraft .nbt .NbtCompound ;
4149import net .minecraft .nbt .NbtList ;
4250import net .minecraft .nbt .NbtString ;
43- import net .minecraft .recipe .RecipeManager ;
4451import net .minecraft .recipe .RecipeType ;
52+ import net .minecraft .recipe .StonecuttingRecipe ;
4553import net .minecraft .text .Style ;
4654import net .minecraft .text .Text ;
4755import net .minecraft .text .TranslatableText ;
4856import net .minecraft .util .Formatting ;
4957import net .minecraft .util .Identifier ;
5058
59+ import java .util .Collections ;
5160import java .util .List ;
5261import java .util .Map ;
5362
63+ @ Environment (EnvType .CLIENT )
5464public class AstralAdditionsREIClientPlugin implements REIClientPlugin {
5565 public static final CategoryIdentifier <DesizerDisplay > DESIZER = CategoryIdentifier .of (new Identifier (AstralAdditions .MOD_ID , "desizer" ));
5666
@@ -65,6 +75,9 @@ public class AstralAdditionsREIClientPlugin implements REIClientPlugin {
6575 public static final CategoryIdentifier <VoidFilteringDisplay > VOID_FILTERING = CategoryIdentifier .of (new Identifier (AstralAdditions .MOD_ID , "void_filtering" ));
6676 public static final CategoryIdentifier <ShatteringDisplay > SHATTERING = CategoryIdentifier .of (new Identifier (AstralAdditions .MOD_ID , "shattering" ));
6777
78+ //* Create
79+ public static final CategoryIdentifier <CreateDisplay <TransmuteRecipe >> BULK_SHIMMERING = CategoryIdentifier .of (new Identifier (AstralAdditions .MOD_ID , "bulk_shimmering" ));
80+
6881 @ Override
6982 public void registerCategories (CategoryRegistry registry ) {
7083 registry .add (new DesizerCategory ());
@@ -103,53 +116,70 @@ public void registerCategories(CategoryRegistry registry) {
103116
104117 registry .addWorkstations (SHATTERING , EntryStacks .of (shatteringBook ));
105118
119+ CreateRecipeCategory .Info <TransmuteRecipe > shimmerInfo = new CreateRecipeCategory .Info <>(BULK_SHIMMERING , new TranslatableText ("category.astraladditions.bulk_shimmering" ), new EmptyBackground (178 , 110 ),
120+ new DoubleItemIcon (() -> new ItemStack (AllItems .PROPELLER .get ()), () -> new ItemStack (ModFluids .SHIMMER_BUCKET )),
121+ Collections ::emptyList ,
122+ List .of (() -> new ItemStack (AllItems .PROPELLER .get ()), () -> new ItemStack (ModFluids .SHIMMER_BUCKET )),
123+ 178 , 110 , recipe -> new CreateDisplay <>(recipe , BULK_SHIMMERING ));
124+
125+ BulkShimmeringCategory bulkShimmeringCategory = new BulkShimmeringCategory (shimmerInfo );
126+ registry .add (bulkShimmeringCategory );
127+
128+ registry .addWorkstations (BULK_SHIMMERING , EntryStacks .of (AllBlocks .ENCASED_FAN .get ()));
106129 }
107130
108131 @ Override
109132 public void registerDisplays (DisplayRegistry registry ) {
110- RecipeManager recipeManager = MinecraftClient . getInstance (). world . getRecipeManager ( );
133+ registry . registerRecipeFiller ( DesizerRecipe . class , DesizerRecipe . Type . INSTANCE , DesizerDisplay :: of );
111134
112- List <DesizerDisplay > desizerRecipes = recipeManager .listAllOfType (DesizerRecipe .Type .INSTANCE ).stream ().map (DesizerDisplay ::of ).toList ();
113- desizerRecipes .forEach (registry ::add );
135+ registry .registerRecipeFiller (TransmuteRecipe .class , TransmuteRecipe .Type .INSTANCE , TransmuteDisplay ::of );
114136
115- List <TransmuteDisplay > transmuteRecipes = recipeManager .listAllOfType (TransmuteRecipe .Type .INSTANCE ).stream ().map (TransmuteDisplay ::of ).toList ();
116- transmuteRecipes .forEach (registry ::add );
117-
118- registry .registerFiller (ChromaticVacuumRecipe .class , VacuumDisplay ::of );
137+ registry .registerRecipeFiller (ChromaticVacuumRecipe .class , ChromaticVacuumRecipe .Type .INSTANCE , VacuumDisplay ::of );
119138
120139 //* YTTR
121- List <CentrifugeDisplay > centrifugeRecipes = recipeManager .listAllOfType (YRecipeTypes .CENTRIFUGING ).stream ().map (CentrifugeDisplay ::of ).toList ();
122- centrifugeRecipes .forEach (registry ::add );
123-
124- List <PistonSmashingDisplay > pistonSmashingRecipes = recipeManager .listAllOfType (YRecipeTypes .PISTON_SMASHING ).stream ().map (PistonSmashingDisplay ::of ).toList ();
125- pistonSmashingRecipes .forEach (registry ::add );
126-
127- List <SoakingDisplay > soakingRecipes = recipeManager .listAllOfType (YRecipeTypes .SOAKING ).stream ().map (SoakingDisplay ::of ).toList ();
128- soakingRecipes .forEach (registry ::add );
129-
130- List <VoidFilteringDisplay > voidFilteringRecipe = recipeManager .listAllOfType (YRecipeTypes .VOID_FILTERING ).stream ().map (VoidFilteringDisplay ::of ).toList ();
131- voidFilteringRecipe .forEach (registry ::add );
132-
133- //Shattering stuff
134- List <ShatteringDisplay > shatteringRecipes = recipeManager .listAllOfType (YRecipeTypes .SHATTERING ).stream ()
135- .map (ShatteringDisplay ::of )
136- .toList ();
137- shatteringRecipes .forEach (registry ::add );
138-
139- List <ShatteringDisplay > shatteringstonecuttingRecipes = recipeManager .listAllOfType (RecipeType .STONECUTTING ).stream ()
140- .filter (r -> r .getOutput ().getCount () == 1 && !r .getIngredients ().isEmpty ())
141- .map (ShatteringDisplay ::of )
142- .toList ();
143- shatteringstonecuttingRecipes .forEach (registry ::add );
144-
145- List <ShatteringDisplay > shatteringoneByOneCraftingRecipes = recipeManager .listAllOfType (RecipeType .CRAFTING ).stream ()
146- .filter (r -> r .fits (1 , 1 ) && !r .getIngredients ().isEmpty ())
147- .map (ShatteringDisplay ::of )
148- .toList ();
149- shatteringoneByOneCraftingRecipes .forEach (registry ::add );
140+ registry .registerRecipeFiller (CentrifugingRecipe .class , YRecipeTypes .CENTRIFUGING , CentrifugeDisplay ::of );
141+
142+ registry .registerRecipeFiller (PistonSmashingRecipe .class , YRecipeTypes .PISTON_SMASHING , PistonSmashingDisplay ::of );
143+
144+ registry .registerRecipeFiller (SoakingRecipe .class , YRecipeTypes .SOAKING , SoakingDisplay ::of );
145+
146+ registry .registerRecipeFiller (VoidFilteringRecipe .class , YRecipeTypes .VOID_FILTERING , VoidFilteringDisplay ::of );
147+
148+ registry .registerRecipeFiller (ShatteringRecipe .class , YRecipeTypes .SHATTERING , ShatteringDisplay ::of );
149+
150+ registry .registerRecipeFiller (StonecuttingRecipe .class , RecipeType .STONECUTTING , ShatteringDisplay ::ofStonecutting );
151+
152+ registry .registerRecipeFiller (
153+ net .minecraft .recipe .CraftingRecipe .class ,
154+ RecipeType .CRAFTING ,
155+ recipe -> {
156+ if (recipe instanceof ShatteringRecipe ) return null ;
157+
158+ if (recipe .getIngredients ().size () != 1 ) return null ;
159+ if (recipe .getIngredients ().get (0 ).isEmpty ()) return null ;
160+
161+ ItemStack out = recipe .getOutput ();
162+ if (out .isEmpty ()) return null ;
163+
164+ return ShatteringDisplay .ofWrappedCrafting (recipe );
165+ }
166+ );
167+
168+ registry .registerRecipeFiller (
169+ TransmuteRecipe .class ,
170+ TransmuteRecipe .Type .INSTANCE ,
171+ recipe -> {
172+ ItemStack out = recipe .getOutput ();
173+ if (out == null || out .isEmpty ()) {
174+ return null ;
175+ }
176+ return new CreateDisplay <>(recipe , BULK_SHIMMERING );
177+ }
178+ );
150179 }
151180
152181
182+
153183 @ Override
154184 public void registerScreens (ScreenRegistry registry ) {
155185 REIClientPlugin .super .registerScreens (registry );
0 commit comments