Skip to content

Commit 38677b2

Browse files
fixed recipes for create 6.0.6
1 parent b685781 commit 38677b2

File tree

4 files changed

+64
-12
lines changed

4 files changed

+64
-12
lines changed

src/main/java/com/rae/creatingspace/content/recipes/air_liquefying/AirLiquefyingRecipe.java

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
package com.rae.creatingspace.content.recipes.air_liquefying;
22

3+
import com.mojang.serialization.MapCodec;
34
import com.rae.creatingspace.init.RecipeInit;
5+
import com.simibubi.create.content.kinetics.deployer.ItemApplicationRecipe;
6+
import com.simibubi.create.content.kinetics.deployer.ItemApplicationRecipeParams;
47
import 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;
510
import com.simibubi.create.foundation.item.SmartInventory;
611
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
712
import net.createmod.catnip.data.Iterate;
813
import net.minecraft.core.registries.BuiltInRegistries;
14+
import net.minecraft.network.RegistryFriendlyByteBuf;
15+
import net.minecraft.network.codec.StreamCodec;
916
import net.minecraft.resources.ResourceLocation;
1017
import net.minecraft.world.item.crafting.Recipe;
18+
import net.minecraft.world.item.crafting.RecipeSerializer;
1119
import net.minecraft.world.level.Level;
1220
import net.minecraft.world.level.block.Block;
1321
import net.minecraft.world.level.block.state.BlockState;
1422
import net.neoforged.neoforge.fluids.FluidStack;
23+
import net.neoforged.neoforge.items.wrapper.RecipeWrapper;
1524
import org.jetbrains.annotations.NotNull;
1625

1726
import java.util.ArrayList;
1827
import 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

src/main/java/com/rae/creatingspace/content/recipes/air_liquefying/AirLiquefyingRecipeParam.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AirLiquefyingRecipeParam extends ProcessingRecipeParams {
2424
params.dimension = dimension;
2525
return params;
2626
}));
27-
public static StreamCodec<RegistryFriendlyByteBuf, ItemApplicationRecipeParams> STREAM_CODEC = streamCodec(ItemApplicationRecipeParams::new);
27+
public static StreamCodec<RegistryFriendlyByteBuf, AirLiquefyingRecipeParam> STREAM_CODEC = streamCodec(AirLiquefyingRecipeParam::new);
2828

2929
ResourceLocation blockInFront;
3030
ResourceLocation dimension;

src/main/java/com/rae/creatingspace/init/RecipeInit.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
import com.rae.creatingspace.CreatingSpace;
44
import com.rae.creatingspace.content.recipes.air_liquefying.AirLiquefyingRecipe;
5+
import com.rae.creatingspace.content.recipes.air_liquefying.AirLiquefyingRecipeParam;
56
import com.rae.creatingspace.content.recipes.chemical_synthesis.ChemicalSynthesisRecipe;
67
import com.rae.creatingspace.content.recipes.electrolysis.MechanicalElectrolysisRecipe;
78
import com.simibubi.create.AllTags;
9+
import com.simibubi.create.content.kinetics.deployer.ItemApplicationRecipe;
10+
import com.simibubi.create.content.kinetics.deployer.ItemApplicationRecipeParams;
11+
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
812
import com.simibubi.create.content.processing.recipe.StandardProcessingRecipe;
913
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
1014
import net.createmod.catnip.lang.Lang;
@@ -61,7 +65,9 @@ public enum RecipeInit implements IRecipeTypeInfo , StringRepresentable {
6165
this(() -> new StandardProcessingRecipe.Serializer<>(processingFactory));
6266

6367
}
64-
68+
RecipeInit(ProcessingRecipe.Factory<AirLiquefyingRecipeParam, ? extends AirLiquefyingRecipe> liquefyingRecipeParamFactory) {
69+
this(() -> new AirLiquefyingRecipe.Serializer<>(liquefyingRecipeParamFactory));
70+
}
6571
@ApiStatus.Internal
6672
public static void register(IEventBus modEventBus) {
6773
ShapedRecipePattern.setCraftingSize(9, 9);

src/main/resources/META-INF/neoforge.mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ description='''
3333
[[dependencies.creatingspace]]
3434
modId="create"
3535
mandatory=true
36-
versionRange="[0.6.0.1,)"
36+
versionRange="[0.6.0.6,)"
3737
ordering="NONE"
3838
side="BOTH"
3939

0 commit comments

Comments
 (0)