use of org.bukkit.craftbukkit.v.inventory.CraftItemStack in project Arclight by IzzelAliz.
the class StonecuttingRecipeMixin method bridge$toBukkitRecipe.
@Override
public Recipe bridge$toBukkitRecipe() {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
CraftStonecuttingRecipe recipe = new CraftStonecuttingRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient));
recipe.setGroup(this.group);
return recipe;
}
use of org.bukkit.craftbukkit.v.inventory.CraftItemStack in project Arclight by IzzelAliz.
the class CampfireTileEntityMixin method cookAndDrop.
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
private void cookAndDrop() {
for (int i = 0; i < this.inventory.size(); ++i) {
ItemStack before = this.inventory.get(i);
if (!before.isEmpty()) {
++this.cookingTimes[i];
if (this.cookingTimes[i] >= this.cookingTotalTimes[i]) {
IInventory iinventory = new Inventory(before);
ItemStack after = this.world.getRecipeManager().getRecipe(IRecipeType.CAMPFIRE_COOKING, iinventory, this.world).map((cookingRecipe) -> cookingRecipe.getCraftingResult(iinventory)).orElse(before);
BlockPos blockpos = this.getPos();
CraftItemStack craftBefore = CraftItemStack.asCraftMirror(before);
org.bukkit.inventory.ItemStack bukkitAfter = CraftItemStack.asBukkitCopy(after);
BlockCookEvent event = new BlockCookEvent(CraftBlock.at(this.world, this.pos), craftBefore, bukkitAfter);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
ItemStack cookFinal = CraftItemStack.asNMSCopy(event.getResult());
InventoryHelper.spawnItemStack(this.world, blockpos.getX(), blockpos.getY(), blockpos.getZ(), cookFinal);
this.inventory.set(i, ItemStack.EMPTY);
this.inventoryChanged();
}
}
}
}
Aggregations