use of net.kaupenjoe.mccourse.recipe.OrichalcumBlasterRecipe in project Fabric-Course-118 by Kaupenjoe.
the class OrichalcumBlasterEntity method hasRecipe.
private static boolean hasRecipe(OrichalcumBlasterEntity entity) {
World world = entity.world;
SimpleInventory inventory = new SimpleInventory(entity.inventory.size());
for (int i = 0; i < entity.inventory.size(); i++) {
inventory.setStack(i, entity.getStack(i));
}
Optional<OrichalcumBlasterRecipe> match = world.getRecipeManager().getFirstMatch(OrichalcumBlasterRecipe.Type.INSTANCE, inventory, world);
return match.isPresent() && canInsertAmountIntoOutputSlot(inventory) && canInsertItemIntoOutputSlot(inventory, match.get().getOutput());
}
use of net.kaupenjoe.mccourse.recipe.OrichalcumBlasterRecipe in project Fabric-Course-118 by Kaupenjoe.
the class OrichalcumBlasterEntity method craftItem.
private static void craftItem(OrichalcumBlasterEntity entity) {
World world = entity.world;
SimpleInventory inventory = new SimpleInventory(entity.inventory.size());
for (int i = 0; i < entity.inventory.size(); i++) {
inventory.setStack(i, entity.getStack(i));
}
Optional<OrichalcumBlasterRecipe> match = world.getRecipeManager().getFirstMatch(OrichalcumBlasterRecipe.Type.INSTANCE, inventory, world);
if (match.isPresent()) {
entity.removeStack(1, 1);
entity.removeStack(2, 1);
entity.setStack(3, new ItemStack(match.get().getOutput().getItem(), entity.getStack(3).getCount() + 1));
entity.resetProgress();
}
}
Aggregations