11package com .circulation .random_complement .mixin .jeiu ;
22
3+ import com .circulation .random_complement .mixin .jei .AccessorIngredientListBatchRenderer ;
34import com .github .vfyjxf .jeiutilities .gui .history .AdvancedIngredientGrid ;
45import mezz .jei .gui .ingredients .IIngredientListElement ;
56import mezz .jei .gui .overlay .GridAlignment ;
67import mezz .jei .gui .overlay .IngredientGrid ;
78import mezz .jei .input .MouseHelper ;
89import mezz .jei .render .IngredientListBatchRenderer ;
10+ import mezz .jei .render .IngredientListSlot ;
11+ import org .objectweb .asm .Opcodes ;
912import org .spongepowered .asm .mixin .Final ;
1013import org .spongepowered .asm .mixin .Mixin ;
1114import org .spongepowered .asm .mixin .Shadow ;
15+ import org .spongepowered .asm .mixin .injection .At ;
16+ import org .spongepowered .asm .mixin .injection .Redirect ;
17+
18+ import java .util .List ;
1219
1320@ Mixin (value = AdvancedIngredientGrid .class , remap = false )
1421public class MixinAdvancedIngredientGrid extends IngredientGrid {
@@ -17,6 +24,9 @@ public class MixinAdvancedIngredientGrid extends IngredientGrid {
1724 @ Final
1825 private IngredientListBatchRenderer guiHistoryIngredientSlots ;
1926
27+ @ Shadow
28+ private boolean showHistory ;
29+
2030 public MixinAdvancedIngredientGrid (IngredientListBatchRenderer guiIngredientSlots , GridAlignment alignment ) {
2131 super (guiIngredientSlots , alignment );
2232 }
@@ -29,4 +39,14 @@ public IIngredientListElement<?> getElementUnderMouse() {
2939 return r != null ? r .getElement () : null ;
3040 }
3141
42+ @ Redirect (method = "draw" , at = @ At (value = "INVOKE" , target = "Lmezz/jei/render/IngredientListBatchRenderer;getAllGuiIngredientSlots()Ljava/util/List;" ))
43+ public List <IngredientListSlot > draw (IngredientListBatchRenderer instance ) {
44+ return ((AccessorIngredientListBatchRenderer ) instance ).getSlots ().get (0 );
45+ }
46+
47+ @ Redirect (method = "draw" , at = @ At (value = "FIELD" , target = "Lcom/github/vfyjxf/jeiutilities/gui/history/AdvancedIngredientGrid;showHistory:Z" , ordinal = 0 , opcode = Opcodes .GETFIELD ))
48+ public boolean draw (AdvancedIngredientGrid instance ) {
49+ return this .showHistory && guiHistoryIngredientSlots .size () > 0 ;
50+ }
51+
3252}
0 commit comments