Skip to content

Commit b685781

Browse files
fixed recipes for create 6.0.6
1 parent 131b959 commit b685781

File tree

9 files changed

+129
-121
lines changed

9 files changed

+129
-121
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mod_license=MIT
3737
mod_version=1.21.1_1.7.10
3838

3939

40-
create_version = 6.0.4-55
40+
create_version = 6.0.6-97
4141
flywheel_version = 1.0.2
4242
ponder_version = 1.0.46
4343
registrate_version = MC1.21-1.3.0+62

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

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package com.rae.creatingspace.content.recipes.air_liquefying;
22

3-
import com.google.gson.JsonObject;
43
import com.rae.creatingspace.init.RecipeInit;
54
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
6-
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeParams;
75
import com.simibubi.create.foundation.item.SmartInventory;
86
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
97
import net.createmod.catnip.data.Iterate;
108
import net.minecraft.core.registries.BuiltInRegistries;
11-
import net.minecraft.network.FriendlyByteBuf;
129
import net.minecraft.resources.ResourceLocation;
1310
import net.minecraft.world.item.crafting.Recipe;
1411
import net.minecraft.world.level.Level;
@@ -17,14 +14,13 @@
1714
import net.neoforged.neoforge.fluids.FluidStack;
1815
import org.jetbrains.annotations.NotNull;
1916

20-
import javax.annotation.Nonnull;
2117
import java.util.ArrayList;
2218
import java.util.List;
2319

24-
public class AirLiquefyingRecipe extends ProcessingRecipe<SmartInventory> {
20+
public class AirLiquefyingRecipe extends ProcessingRecipe<SmartInventory, AirLiquefyingRecipeParam> {
2521

26-
private ResourceLocation blockInFront;
27-
private ResourceLocation dimension;
22+
private final ResourceLocation blockInFront;
23+
private final ResourceLocation dimension;
2824

2925
public static boolean match(AirLiquefierBlockEntity airLiquefierBlockEntity, Recipe<?> recipe) {
3026
return apply(airLiquefierBlockEntity, recipe, true);
@@ -40,7 +36,7 @@ private static boolean apply(AirLiquefierBlockEntity airLiquefierBlockEntity, Re
4036
BlockState state = airLiquefierBlockEntity.getBlockState();
4137
BlockState targetedState = airLiquefierBlockEntity.getLevel().getBlockState(airLiquefierBlockEntity.getBlockPos().relative(state.getValue(AirLiquefierBlock.FACING)));
4238
Block block = BuiltInRegistries.BLOCK.get(airLiquefyingRecipe.getBlockInFront());
43-
if (block != null && !targetedState.is(block)) {
39+
if (!targetedState.is(block)) {
4440
return false;
4541
}
4642
ResourceLocation currentDimension = airLiquefierBlockEntity.getLevel().dimension().location();
@@ -70,8 +66,10 @@ private static boolean apply(AirLiquefierBlockEntity airLiquefierBlockEntity, Re
7066
return true;
7167
}
7268

73-
protected AirLiquefyingRecipe(IRecipeTypeInfo type, ProcessingRecipeParams params) {
69+
protected AirLiquefyingRecipe(IRecipeTypeInfo type, AirLiquefyingRecipeParam params) {
7470
super(type, params);
71+
blockInFront = params.blockInFront;
72+
dimension = params.dimension;
7573
}
7674

7775
public ResourceLocation getBlockInFront() {
@@ -92,7 +90,7 @@ protected int getMaxOutputCount() {
9290
return 0;
9391
}
9492

95-
public AirLiquefyingRecipe(ProcessingRecipeParams params) {
93+
public AirLiquefyingRecipe(AirLiquefyingRecipeParam params) {
9694
this(RecipeInit.AIR_LIQUEFYING, params);
9795
}
9896

@@ -107,37 +105,14 @@ protected boolean canSpecifyDuration() {
107105
}
108106

109107
@Override
110-
public boolean matches(SmartInventory inv, @Nonnull Level worldIn) {
108+
public boolean matches(@NotNull SmartInventory smartInventory, @NotNull Level level) {
111109
return false;
112110
}
113111

114-
115-
116112
@Override
117-
public void readAdditional(@NotNull FriendlyByteBuf buffer) {
118-
super.readAdditional(buffer);
119-
blockInFront = buffer.readResourceLocation();
120-
if (blockInFront.equals(ResourceLocation.parse("minecraft:_"))) {
121-
blockInFront = null;
122-
}
123-
dimension = buffer.readResourceLocation();
124-
if (dimension.equals(ResourceLocation.parse("minecraft:_"))) {
125-
dimension = null;
126-
}
113+
public @NotNull AirLiquefyingRecipeParam getParams() {
114+
return super.getParams();
127115
}
128116

129-
@Override
130-
public void writeAdditional(@NotNull FriendlyByteBuf buffer) {
131-
super.writeAdditional(buffer);
132-
if (blockInFront != null)
133-
buffer.writeResourceLocation(blockInFront);
134-
else {
135-
buffer.writeResourceLocation(ResourceLocation.parse("minecraft:_"));
136-
}
137-
if (dimension != null)
138-
buffer.writeResourceLocation(dimension);
139-
else {
140-
buffer.writeResourceLocation(ResourceLocation.parse("minecraft:_"));
141-
}
142-
}
117+
143118
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.rae.creatingspace.content.recipes.air_liquefying;
2+
3+
import com.mojang.serialization.MapCodec;
4+
import com.mojang.serialization.codecs.RecordCodecBuilder;
5+
import com.simibubi.create.content.kinetics.deployer.ItemApplicationRecipeParams;
6+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeParams;
7+
import net.minecraft.network.RegistryFriendlyByteBuf;
8+
import net.minecraft.network.codec.StreamCodec;
9+
import net.minecraft.resources.ResourceLocation;
10+
import org.jetbrains.annotations.NotNull;
11+
12+
import java.util.function.Function;
13+
14+
public class AirLiquefyingRecipeParam extends ProcessingRecipeParams {
15+
private static final ResourceLocation DEFAULT_EMPTY = ResourceLocation.fromNamespaceAndPath("minecraft", "empy");
16+
public static MapCodec<AirLiquefyingRecipeParam> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
17+
codec(AirLiquefyingRecipeParam::new).forGetter(Function.identity()),
18+
ResourceLocation.CODEC.optionalFieldOf("blockInFront", DEFAULT_EMPTY)
19+
.forGetter( r -> r.blockInFront!=null?r.blockInFront: DEFAULT_EMPTY),
20+
ResourceLocation.CODEC.optionalFieldOf("dimension", DEFAULT_EMPTY)
21+
.forGetter( r -> r.dimension!=null?r.blockInFront: DEFAULT_EMPTY)
22+
).apply(instance, (params, blockInFront, dimension) -> {
23+
params.blockInFront = blockInFront;
24+
params.dimension = dimension;
25+
return params;
26+
}));
27+
public static StreamCodec<RegistryFriendlyByteBuf, ItemApplicationRecipeParams> STREAM_CODEC = streamCodec(ItemApplicationRecipeParams::new);
28+
29+
ResourceLocation blockInFront;
30+
ResourceLocation dimension;
31+
32+
@Override
33+
public void decode(@NotNull RegistryFriendlyByteBuf buffer) {
34+
super.decode(buffer);
35+
blockInFront = buffer.readResourceLocation();
36+
if (blockInFront.equals(DEFAULT_EMPTY)) {
37+
blockInFront = null;
38+
}
39+
dimension = buffer.readResourceLocation();
40+
if (dimension.equals(DEFAULT_EMPTY)) {
41+
dimension = null;
42+
}
43+
}
44+
45+
@Override
46+
public void encode(@NotNull RegistryFriendlyByteBuf buffer) {
47+
super.encode(buffer);
48+
if (blockInFront != null)
49+
buffer.writeResourceLocation(blockInFront);
50+
else {
51+
buffer.writeResourceLocation(ResourceLocation.parse("minecraft:empty"));
52+
}
53+
if (dimension != null)
54+
buffer.writeResourceLocation(dimension);
55+
else {
56+
buffer.writeResourceLocation(ResourceLocation.parse("minecraft:empty"));
57+
}
58+
}
59+
}

src/main/java/com/rae/creatingspace/content/recipes/chemical_synthesis/CatalystCarrierBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void tick() {
113113
if (processingTicks < 0) {
114114
float recipeSpeed = 1;
115115
if (currentRecipe instanceof ProcessingRecipe) {
116-
int t = ((ProcessingRecipe<?>) currentRecipe).getProcessingDuration();
116+
int t = ((ProcessingRecipe<?,?>) currentRecipe).getProcessingDuration();
117117
if (t != 0)
118118
recipeSpeed = t / 100f;
119119
}
Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,14 @@
11
package com.rae.creatingspace.content.recipes.chemical_synthesis;
22

3-
import com.google.gson.JsonObject;
4-
import com.mojang.serialization.JsonOps;
53
import com.rae.creatingspace.init.RecipeInit;
64
import com.simibubi.create.content.processing.basin.BasinRecipe;
7-
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeParams;
8-
import net.minecraft.nbt.NbtOps;
9-
import net.minecraft.network.FriendlyByteBuf;
10-
import net.minecraft.world.item.crafting.Ingredient;
5+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeParams;
6+
117

128
public class ChemicalSynthesisRecipe extends BasinRecipe {
13-
Ingredient catalyst;
9+
1410
public ChemicalSynthesisRecipe(ProcessingRecipeParams params) {
1511
super(RecipeInit.CHEMICAL_SYNTHESIS, params);
1612
}
1713

18-
/*@Override
19-
public void readAdditional(JsonObject json) {
20-
super.readAdditional(json);
21-
if (json.get("catalyst") == null)
22-
catalyst = Ingredient.EMPTY;
23-
else
24-
catalyst = Ingredient.CODEC.parse(JsonOps.INSTANCE,json.get("catalyst")).resultOrPartial().orElse(Ingredient.EMPTY);
25-
}*/
26-
27-
@Override
28-
public void readAdditional(FriendlyByteBuf buffer) {
29-
super.readAdditional(buffer);
30-
catalyst = buffer.readJsonWithCodec(Ingredient.CODEC);
31-
}
32-
33-
@Override
34-
public void writeAdditional(FriendlyByteBuf buffer) {
35-
super.writeAdditional(buffer);
36-
if (catalyst != null)
37-
buffer.writeJsonWithCodec(Ingredient.CODEC,catalyst);
38-
}
3914
}

src/main/java/com/rae/creatingspace/content/recipes/electrolysis/MechanicalElectrolysisRecipe.java

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

33
import com.rae.creatingspace.init.RecipeInit;
44
import com.simibubi.create.content.processing.basin.BasinRecipe;
5-
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeParams;
5+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeParams;
66

77
public class MechanicalElectrolysisRecipe extends BasinRecipe {
88
public MechanicalElectrolysisRecipe(ProcessingRecipeParams params) {

src/main/java/com/rae/creatingspace/content/recipes/electrolysis/MechanicalElectrolyzerBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void tick() {
110110
if (processingTicks < 0) {
111111
float recipeSpeed = 1;
112112
if (currentRecipe instanceof ProcessingRecipe) {
113-
int t = ((ProcessingRecipe<?>) currentRecipe).getProcessingDuration();
113+
int t = ((ProcessingRecipe<?,?>) currentRecipe).getProcessingDuration();
114114
if (t != 0)
115115
recipeSpeed = t / 100f;
116116
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import com.rae.creatingspace.content.recipes.chemical_synthesis.ChemicalSynthesisRecipe;
66
import com.rae.creatingspace.content.recipes.electrolysis.MechanicalElectrolysisRecipe;
77
import com.simibubi.create.AllTags;
8-
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
9-
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
8+
import com.simibubi.create.content.processing.recipe.StandardProcessingRecipe;
109
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
1110
import net.createmod.catnip.lang.Lang;
1211
import net.minecraft.core.registries.BuiltInRegistries;
@@ -58,8 +57,9 @@ public enum RecipeInit implements IRecipeTypeInfo , StringRepresentable {
5857
type = typeObject;
5958
}
6059

61-
RecipeInit(ProcessingRecipeBuilder.ProcessingRecipeFactory<?> processingFactory) {
62-
this(() -> new ProcessingRecipeSerializer<>(processingFactory));
60+
RecipeInit(StandardProcessingRecipe.Factory<?> processingFactory) {
61+
this(() -> new StandardProcessingRecipe.Serializer<>(processingFactory));
62+
6363
}
6464

6565
@ApiStatus.Internal

0 commit comments

Comments
 (0)