11package com .rae .creatingspace .content .recipes .air_liquefying ;
22
3+ import com .mojang .serialization .MapCodec ;
34import com .rae .creatingspace .init .RecipeInit ;
5+ import com .simibubi .create .content .kinetics .deployer .ItemApplicationRecipe ;
6+ import com .simibubi .create .content .kinetics .deployer .ItemApplicationRecipeParams ;
47import com .simibubi .create .content .processing .recipe .ProcessingRecipe ;
8+ import com .simibubi .create .content .processing .recipe .ProcessingRecipeBuilder ;
9+ import com .simibubi .create .content .processing .recipe .ProcessingRecipeParams ;
510import com .simibubi .create .foundation .item .SmartInventory ;
611import com .simibubi .create .foundation .recipe .IRecipeTypeInfo ;
712import net .createmod .catnip .data .Iterate ;
813import net .minecraft .core .registries .BuiltInRegistries ;
14+ import net .minecraft .network .RegistryFriendlyByteBuf ;
15+ import net .minecraft .network .codec .StreamCodec ;
916import net .minecraft .resources .ResourceLocation ;
1017import net .minecraft .world .item .crafting .Recipe ;
18+ import net .minecraft .world .item .crafting .RecipeSerializer ;
1119import net .minecraft .world .level .Level ;
1220import net .minecraft .world .level .block .Block ;
1321import net .minecraft .world .level .block .state .BlockState ;
1422import net .neoforged .neoforge .fluids .FluidStack ;
23+ import net .neoforged .neoforge .items .wrapper .RecipeWrapper ;
1524import org .jetbrains .annotations .NotNull ;
1625
1726import java .util .ArrayList ;
1827import java .util .List ;
1928
20- public class AirLiquefyingRecipe extends ProcessingRecipe <SmartInventory , AirLiquefyingRecipeParam > {
29+ public class AirLiquefyingRecipe extends ProcessingRecipe <RecipeWrapper , AirLiquefyingRecipeParam > {
2130
2231 private final ResourceLocation blockInFront ;
2332 private final ResourceLocation dimension ;
@@ -65,7 +74,9 @@ private static boolean apply(AirLiquefierBlockEntity airLiquefierBlockEntity, Re
6574
6675 return true ;
6776 }
68-
77+ public AirLiquefyingRecipe (AirLiquefyingRecipeParam params ) {
78+ this (RecipeInit .AIR_LIQUEFYING , params );
79+ }
6980 protected AirLiquefyingRecipe (IRecipeTypeInfo type , AirLiquefyingRecipeParam params ) {
7081 super (type , params );
7182 blockInFront = params .blockInFront ;
@@ -90,9 +101,7 @@ protected int getMaxOutputCount() {
90101 return 0 ;
91102 }
92103
93- public AirLiquefyingRecipe (AirLiquefyingRecipeParam params ) {
94- this (RecipeInit .AIR_LIQUEFYING , params );
95- }
104+
96105
97106 @ Override
98107 protected int getMaxFluidOutputCount () {
@@ -105,13 +114,50 @@ protected boolean canSpecifyDuration() {
105114 }
106115
107116 @ Override
108- public boolean matches (@ NotNull SmartInventory smartInventory , @ NotNull Level level ) {
117+ public boolean matches (@ NotNull RecipeWrapper smartInventory , @ NotNull Level level ) {
109118 return false ;
110119 }
120+ @ FunctionalInterface
121+ public interface Factory <R extends AirLiquefyingRecipe > extends ProcessingRecipe .Factory <AirLiquefyingRecipeParam , R > {
122+ R create (AirLiquefyingRecipeParam params );
123+ }
124+
125+ public static class Builder <R extends AirLiquefyingRecipe > extends ProcessingRecipeBuilder <AirLiquefyingRecipeParam , R , AirLiquefyingRecipe .Builder <R >> {
126+ public Builder (AirLiquefyingRecipe .Factory <R > factory , ResourceLocation recipeId ) {
127+ super (factory , recipeId );
128+ }
129+
130+ @ Override
131+ protected AirLiquefyingRecipeParam createParams () {
132+ return new AirLiquefyingRecipeParam ();
133+ }
134+
135+ @ Override
136+ public AirLiquefyingRecipe .Builder <R > self () {
137+ return this ;
138+ }
139+
140+ }
141+
142+ public static class Serializer <R extends AirLiquefyingRecipe > implements RecipeSerializer <R > {
143+ private final MapCodec <R > codec ;
144+ private final StreamCodec <RegistryFriendlyByteBuf , R > streamCodec ;
145+
146+ public Serializer (ProcessingRecipe .Factory <AirLiquefyingRecipeParam , R > factory ) {
147+ this .codec = ProcessingRecipe .codec (factory , AirLiquefyingRecipeParam .CODEC );
148+ this .streamCodec = ProcessingRecipe .streamCodec (factory , AirLiquefyingRecipeParam .STREAM_CODEC );
149+ }
150+
151+ @ Override
152+ public MapCodec <R > codec () {
153+ return codec ;
154+ }
155+
156+ @ Override
157+ public StreamCodec <RegistryFriendlyByteBuf , R > streamCodec () {
158+ return streamCodec ;
159+ }
111160
112- @ Override
113- public @ NotNull AirLiquefyingRecipeParam getParams () {
114- return super .getParams ();
115161 }
116162
117163
0 commit comments