1
1
package gripe ._90 .appliede .mixin .crafting ;
2
2
3
- import com . llamalad7 . mixinextras . injector . wrapoperation . Operation ;
4
- import com . llamalad7 . mixinextras . injector . wrapoperation . WrapOperation ;
3
+ import java . util . ArrayList ;
4
+
5
5
import com .llamalad7 .mixinextras .sugar .Local ;
6
6
7
+ import org .spongepowered .asm .mixin .Final ;
7
8
import org .spongepowered .asm .mixin .Mixin ;
9
+ import org .spongepowered .asm .mixin .Shadow ;
8
10
import org .spongepowered .asm .mixin .Unique ;
9
11
import org .spongepowered .asm .mixin .injection .At ;
10
12
import org .spongepowered .asm .mixin .injection .Inject ;
25
27
26
28
@ Mixin (CraftingTreeNode .class )
27
29
public abstract class CraftingTreeNodeMixin {
30
+ @ Shadow
31
+ private ArrayList <CraftingTreeProcess > nodes ;
32
+
33
+ @ Shadow
34
+ @ Final
35
+ private CraftingCalculation job ;
36
+
28
37
@ Unique
29
38
private long appliede$requestedAmount ;
30
39
@@ -35,27 +44,26 @@ private void trackRequested(
35
44
}
36
45
37
46
// spotless:off
38
- @ WrapOperation (
47
+ @ Inject (
39
48
method = "buildChildPatterns" ,
40
49
at = @ At (
41
- value = "NEW" ,
42
- target = "(Lappeng/api/networking/crafting/ICraftingService;Lappeng/crafting/CraftingCalculation;Lappeng/api/crafting/IPatternDetails;Lappeng/crafting/CraftingTreeNode;)Lappeng/crafting/CraftingTreeProcess;" ))
50
+ value = "INVOKE" ,
51
+ target = "Ljava/util/ArrayList;add(Ljava/lang/Object;)Z" ),
52
+ cancellable = true )
43
53
// spotless:on
44
- private CraftingTreeProcess recalculatePattern (
45
- ICraftingService craftingService ,
46
- CraftingCalculation job ,
47
- IPatternDetails details ,
48
- CraftingTreeNode node ,
49
- Operation <CraftingTreeProcess > original ,
50
- @ Local IGridNode gridNode ) {
54
+ private void recalculatePattern (
55
+ CallbackInfo ci ,
56
+ @ Local IPatternDetails details ,
57
+ @ Local IGridNode gridNode ,
58
+ @ Local ICraftingService craftingService ) {
51
59
if (details instanceof TransmutationPattern ) {
52
60
if (details .getOutputs ().getFirst ().what () instanceof AEItemKey item ) {
61
+ ci .cancel ();
53
62
details = new TransmutationPattern (item , appliede$requestedAmount );
63
+ nodes .add (new CraftingTreeProcess (craftingService , job , details , (CraftingTreeNode ) (Object ) this ));
54
64
}
55
65
56
66
gridNode .getGrid ().getService (KnowledgeService .class ).addTemporaryPattern (details );
57
67
}
58
-
59
- return original .call (craftingService , job , details , node );
60
68
}
61
69
}
0 commit comments