use of mod.azure.doom.mixin.IngredientAccess in project MCDoom by AzureDoom.
the class GunTableScreenHandler method switchTo.
public void switchTo(int recipeIndex) {
// index out of bounds
if (this.getRecipes().size() > recipeIndex) {
GunTableRecipe gunTableRecipe = getRecipes().get(recipeIndex);
for (int i = 0; i < 5; i++) {
ItemStack slotStack = gunTableInventory.getStack(i);
if (!slotStack.isEmpty()) {
// if all positions can't be filled, transfer nothing
if (!this.insertItem(slotStack, 6, 39, false)) {
return;
}
gunTableInventory.setStack(i, slotStack);
}
}
for (int i = 0; i < 5; i++) {
Ingredient ingredient = gunTableRecipe.getIngredientForSlot(i);
if (!ingredient.isEmpty()) {
ItemStack[] possibleItems = ((IngredientAccess) (Object) ingredient).getMatchingStacksMod();
if (possibleItems != null) {
ItemStack first = new ItemStack(possibleItems[0].getItem(), gunTableRecipe.countRequired(i));
autofill(i, first);
}
}
}
}
}
Aggregations