/
BasicRecipeTransferHelper.java
57 lines (48 loc) · 1.74 KB
/
BasicRecipeTransferHelper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package mezz.jei.transfer;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import mezz.jei.api.recipe.IRecipeTransferHelper;
public class BasicRecipeTransferHelper implements IRecipeTransferHelper {
private final Class<? extends Container> containerClass;
private final String recipeCategoryUid;
private final int recipeSlotStart;
private final int recipeSlotCount;
private final int inventorySlotStart;
private final int inventorySlotCount;
public BasicRecipeTransferHelper(Class<? extends Container> containerClass, String recipeCategoryUid, int recipeSlotStart, int recipeSlotCount, int inventorySlotStart, int inventorySlotCount) {
this.containerClass = containerClass;
this.recipeCategoryUid = recipeCategoryUid;
this.recipeSlotStart = recipeSlotStart;
this.recipeSlotCount = recipeSlotCount;
this.inventorySlotStart = inventorySlotStart;
this.inventorySlotCount = inventorySlotCount;
}
@Override
public Class<? extends Container> getContainerClass() {
return containerClass;
}
@Override
public String getRecipeCategoryUid() {
return recipeCategoryUid;
}
@Override
public List<Slot> getRecipeSlots(Container container) {
List<Slot> slots = new ArrayList<>();
for (int i = recipeSlotStart; i < recipeSlotStart + recipeSlotCount; i++) {
Slot slot = container.getSlot(i);
slots.add(slot);
}
return slots;
}
@Override
public List<Slot> getInventorySlots(Container container) {
List<Slot> slots = new ArrayList<>();
for (int i = inventorySlotStart; i < inventorySlotStart + inventorySlotCount; i++) {
Slot slot = container.getSlot(i);
slots.add(slot);
}
return slots;
}
}