Skip to content

Commit 15513fa

Browse files
fixed engine recipe
1 parent 0404e6b commit 15513fa

File tree

114 files changed

+729
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+729
-181
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ minecraft_version=1.21.1
1818
# as they do not follow standard versioning conventions.
1919
minecraft_version_range=[1.21.1,1.22)
2020
# The Neo version must agree with the Minecraft version to get a valid artifact
21-
neo_version=21.1.152
21+
neo_version=21.1.200
2222
# The Neo version range can use any version of Neo as bounds
2323
neo_version_range=[21.1.0,)
2424
# The loader version range can only use the major version of FML as bounds
@@ -39,13 +39,13 @@ mod_version=1.21.1_1.7.10
3939

4040
create_version = 6.0.6-98
4141
flywheel_version = 1.0.4
42-
ponder_version = 1.0.56
42+
ponder_version = 1.0.59
4343

4444
registrate_version = MC1.21-1.3.0+62
45-
jei_version=19.10.0.126
45+
jei_version= 19.21.0.247
4646

4747

48-
curios_version = 5.2.0-beta.3+1.20.1
48+
curios_version = 9.2.2
4949

5050
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
5151
# This should match the base package used for the mod sources.

src/main/java/com/rae/creatingspace/content/rocket/contraption/behaviour/interaction/RocketControlInteraction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public boolean handlePlayerInteraction(Player player, InteractionHand activeHand
1717
AbstractContraptionEntity contraptionEntity) {
1818
if (contraptionEntity instanceof RocketContraptionEntity rocketContraption) {
1919
if ((player instanceof ServerPlayer serverPlayer)) {
20-
player.openMenu( rocketContraption);
20+
serverPlayer.openMenu( rocketContraption,
21+
byteBuf ->
22+
byteBuf.writeVarInt(rocketContraption.getId()));
2123
return true;
2224
}
2325
return true;

src/main/java/com/rae/creatingspace/init/ingameobject/ItemInit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private static ArrayList<ItemEntry<? extends Item>> smartRegisterSequenced3DItem
222222
.model((c,p) -> p.withExistingParent(name,
223223
MODID + ":item/3d_items"))
224224
.register());
225-
// registerSequencedItem("incomplete_" + name); // we don't put the incomplete version in the creative tab
225+
registerSequencedItem("incomplete_" + name); // we don't put the incomplete version in the creative tab
226226
System.out.println(collector);
227227
return collector;
228228
}

src/main/java/com/rae/creatingspace/mixin/recipe/ProcessingRecipeMixin.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22

33
import com.rae.creatingspace.content.recipes.IMoreNbtConditions;
44
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
5+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeParams;
6+
import org.lwjgl.system.NonnullDefault;
57
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
69
import org.spongepowered.asm.mixin.Unique;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
713

814
import java.util.ArrayList;
915

16+
@NonnullDefault
1017
@Mixin(value = ProcessingRecipe.class)
11-
public class ProcessingRecipeMixin implements IMoreNbtConditions {
18+
public class ProcessingRecipeMixin implements IMoreNbtConditions {
19+
@Shadow protected ProcessingRecipeParams params;
1220
@Unique
1321
public ArrayList<String> nbtKeys = new ArrayList<>();
1422
@Unique
1523
public ArrayList<String> matchNbtList = new ArrayList<>();
1624

25+
@Inject(method = "<init>", at = @At("TAIL"))
26+
public void ctor(CallbackInfo ci) {
27+
nbtKeys = ((IMoreNbtConditions) params).getKeepNbt();
28+
matchNbtList = ((IMoreNbtConditions) params).getMachNbt();
29+
}
30+
1731
public void setKeepNbt(ArrayList<String> nbtKeys) {
1832
this.nbtKeys = nbtKeys;
1933
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package com.rae.creatingspace.mixin.recipe;
2+
3+
import com.rae.creatingspace.content.recipes.IMoreNbtConditions;
4+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeParams;
5+
import net.minecraft.core.NonNullList;
6+
import net.minecraft.network.RegistryFriendlyByteBuf;
7+
import net.minecraft.network.codec.ByteBufCodecs;
8+
import net.minecraft.world.item.crafting.Ingredient;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.Shadow;
11+
import org.spongepowered.asm.mixin.Unique;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
import java.util.ArrayList;
17+
18+
@Mixin(ProcessingRecipeParams.class)
19+
public class ProcessingRecipeParamsMixin implements IMoreNbtConditions {
20+
@Shadow protected NonNullList<Ingredient> ingredients;
21+
@Unique
22+
public ArrayList<String> nbtKeys = new ArrayList<>();
23+
@Unique
24+
public ArrayList<String> matchNbtList = new ArrayList<>();
25+
26+
public void setKeepNbt(ArrayList<String> nbtKeys) {
27+
this.nbtKeys = nbtKeys;
28+
}
29+
30+
@Override
31+
public ArrayList<String> getKeepNbt() {
32+
return nbtKeys;
33+
}
34+
35+
@Override
36+
public void setMachNbt(ArrayList<String> machNbtList) {
37+
matchNbtList = machNbtList;
38+
}
39+
40+
@Override
41+
public ArrayList<String> getMachNbt() {
42+
return matchNbtList;
43+
}
44+
45+
@Override
46+
public boolean isKeepNbt() {
47+
return !nbtKeys.isEmpty();
48+
}
49+
50+
@Override
51+
public boolean isMachNbt() {
52+
return !matchNbtList.isEmpty();
53+
}
54+
55+
@Inject(method = "encode", at = @At("HEAD"))
56+
private void addEncodeFailSafe(RegistryFriendlyByteBuf buf, CallbackInfo ci){
57+
//buf.writeCollection(nbtKeys, ByteBufCodecs.STRING_UTF8);
58+
//buf.writeCollection(matchNbtList,ByteBufCodecs.STRING_UTF8);
59+
}
60+
61+
@Inject(method = "encode", at = @At("TAIL"))
62+
private void addEncode(RegistryFriendlyByteBuf buf, CallbackInfo ci){
63+
buf.writeCollection(nbtKeys, ByteBufCodecs.STRING_UTF8);
64+
buf.writeCollection(matchNbtList,ByteBufCodecs.STRING_UTF8);
65+
}
66+
67+
@Inject(method = "decode", at = @At("TAIL"))
68+
private void addDecode(RegistryFriendlyByteBuf buf, CallbackInfo ci){
69+
nbtKeys = buf.readCollection(size -> new ArrayList<>(),ByteBufCodecs.STRING_UTF8);
70+
matchNbtList = buf.readCollection(size -> new ArrayList<>(),ByteBufCodecs.STRING_UTF8);
71+
}
72+
}

src/main/java/com/rae/creatingspace/mixin/recipe/ProcessingRecipeSerializerMixin.java

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/main/java/com/rae/creatingspace/mixin/recipe/SequencedAssemblyRecipeMixin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.minecraft.resources.ResourceLocation;
99
import net.minecraft.world.item.ItemStack;
1010
import net.minecraft.world.item.component.CustomData;
11+
import org.lwjgl.system.NonnullDefault;
1112
import org.spongepowered.asm.mixin.Mixin;
1213
import org.spongepowered.asm.mixin.Unique;
1314
import org.spongepowered.asm.mixin.injection.At;
@@ -17,6 +18,7 @@
1718
import java.util.ArrayList;
1819
import java.util.Objects;
1920

21+
@NonnullDefault
2022
@Mixin(value = SequencedAssemblyRecipe.class)
2123
public class SequencedAssemblyRecipeMixin implements IMoreNbtConditions {
2224
@Unique
Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.rae.creatingspace.mixin.recipe;
22

33
import com.mojang.serialization.*;
4+
import com.mojang.serialization.codecs.RecordCodecBuilder;
45
import com.rae.creatingspace.content.recipes.IMoreNbtConditions;
56
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipe;
67
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipeSerializer;
@@ -24,57 +25,8 @@
2425
@Mixin(value = SequencedAssemblyRecipeSerializer.class)
2526
public abstract class SequencedAssemblyRecipeSerializerMixin {
2627

27-
@Shadow @Final private MapCodec<SequencedAssemblyRecipe> CODEC;
28-
final MapCodec<SequencedAssemblyRecipe> NEW_CODEC = new MapCodec<>() {
29-
@Override
30-
public <T> RecordBuilder<T> encode(SequencedAssemblyRecipe input, DynamicOps<T> ops, RecordBuilder<T> prefix) {
31-
return cS_1_21_1$encode(input, ops, prefix);
32-
}
33-
34-
@Override
35-
public <T> DataResult<SequencedAssemblyRecipe> decode(DynamicOps<T> ops, MapLike<T> input) {
36-
return cS_1_21_1$decode(ops, input);
37-
}
38-
39-
@Override
40-
public <T> Stream<T> keys(DynamicOps<T> ops) {
41-
return Stream.concat(
42-
CODEC.keys(ops),
43-
Stream.of(ops.createString("keepNbt"), ops.createString("matchNbt"))
44-
);
45-
}
46-
};
47-
48-
49-
//Black Magic
50-
@Unique
51-
private <T> DataResult<SequencedAssemblyRecipe> cS_1_21_1$decode(DynamicOps<T> ops, MapLike<T> input) {
52-
return CODEC.decode(ops, input).flatMap(assemblyRecipe -> {
53-
54-
DataResult<List<String>> keepNbtResult = Codec.STRING.listOf().parse(ops,input.get(ops.createString("keepNbt")));
55-
56-
DataResult<List<String>> matchNbtResult = Codec.STRING.listOf().parse(ops,input.get(ops.createString("matchNbt")));
57-
58-
return keepNbtResult.flatMap(keepNbt ->
59-
matchNbtResult.map(matchNbt -> {
60-
((IMoreNbtConditions)assemblyRecipe).setKeepNbt(new ArrayList<>(keepNbt));
61-
((IMoreNbtConditions)assemblyRecipe).setMachNbt(new ArrayList<>(matchNbt));
62-
return assemblyRecipe;
63-
})
64-
);
65-
});
66-
}
67-
6828
@Unique
69-
private <T> RecordBuilder<T> cS_1_21_1$encode(SequencedAssemblyRecipe recipe, DynamicOps<T> ops, RecordBuilder<T> prefix) {
70-
return CODEC.encode(recipe, ops, prefix)
71-
.add("keepNbt", Codec.STRING.listOf().encodeStart(ops, ((IMoreNbtConditions) recipe).getKeepNbt()))
72-
.add("matchNbt", Codec.STRING.listOf().encodeStart(ops, ((IMoreNbtConditions) recipe).getMachNbt()));
73-
}
74-
75-
private static final
76-
@Unique
77-
StreamCodec<ByteBuf, List<String>> STRING_LIST_STREAM_CODEC =
29+
private static final StreamCodec<ByteBuf, List<String>> STRING_LIST_STREAM_CODEC =
7830
ByteBufCodecs.fromCodec(Codec.list(Codec.STRING));
7931

8032
@Inject(method = "fromNetwork", at = @At("RETURN"), cancellable = true)
@@ -93,6 +45,32 @@ public void writeKeepNbt(RegistryFriendlyByteBuf buffer, SequencedAssemblyRecipe
9345

9446
@Inject(method = "codec", at = @At("RETURN"), cancellable = true)
9547
public void addToCodec(CallbackInfoReturnable<MapCodec<SequencedAssemblyRecipe>> cir) {
96-
cir.setReturnValue(NEW_CODEC);
48+
cir.setReturnValue(RecordCodecBuilder.mapCodec(
49+
i -> i.group(
50+
cir.getReturnValue().forGetter(r -> r),
51+
Codec.list(Codec.STRING).optionalFieldOf("keepNbt",List.of()).forGetter(
52+
r -> {
53+
if (r instanceof IMoreNbtConditions moreNbtConditions) {
54+
return moreNbtConditions.getKeepNbt();
55+
}
56+
return List.of();
57+
}
58+
),
59+
Codec.list(Codec.STRING).optionalFieldOf("matchNbt",List.of()).forGetter(
60+
r -> {
61+
if (r instanceof IMoreNbtConditions moreNbtConditions) {
62+
return moreNbtConditions.getMachNbt();
63+
}
64+
return List.of();
65+
}
66+
)
67+
).apply(i, (recipe, mach, keep) -> {
68+
((IMoreNbtConditions) recipe).setKeepNbt(new ArrayList<>(keep));
69+
((IMoreNbtConditions) recipe).setMachNbt(new ArrayList<>(mach));
70+
return recipe;
71+
}
72+
)
73+
));
74+
9775
}
9876
}

src/main/java/package-info.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
@NonnullDefault
1+
@ParametersAreNonnullByDefault
2+
@MethodsReturnNonnullByDefault
23
package com.rae.creatingspace;
34

4-
import org.lwjgl.system.NonnullDefault;
5+
import net.minecraft.MethodsReturnNonnullByDefault;
6+
import javax.annotation.ParametersAreNonnullByDefault;
57

68
//TODO reduce visibility where it's possible.
79
//TODO remove unused non api methods on all release branches (unused methods are often used for development purposes)
17 KB
Loading

0 commit comments

Comments
 (0)