1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 02:34:30 +01:00

Add recipe to cook events

This commit is contained in:
Thonk 2021-01-06 12:05:29 -08:00
parent d3ff89b33b
commit c6ff2b9aee
2 changed files with 27 additions and 0 deletions
paper-api/src/main/java/org/bukkit/event

View file

@ -14,12 +14,21 @@ public class BlockCookEvent extends BlockEvent implements Cancellable {
private final ItemStack source;
private ItemStack result;
private boolean cancelled;
private final org.bukkit.inventory.CookingRecipe<?> recipe; // Paper
@Deprecated // Paper
public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) {
// Paper start
this(block, source, result, null);
}
public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
// Paper end
super(block);
this.source = source;
this.result = result;
this.cancelled = false;
this.recipe = recipe; // Paper
}
/**
@ -61,6 +70,18 @@ public class BlockCookEvent extends BlockEvent implements Cancellable {
this.cancelled = cancel;
}
// Paper start
/**
* Gets the cooking recipe associated with this event.
*
* @return the recipe
*/
@org.jetbrains.annotations.Nullable
public org.bukkit.inventory.CookingRecipe<?> getRecipe() {
return recipe;
}
// Paper end
@NotNull
@Override
public HandlerList getHandlers() {

View file

@ -12,7 +12,13 @@ import org.jetbrains.annotations.NotNull;
*/
public class FurnaceSmeltEvent extends BlockCookEvent {
@Deprecated // Paper
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) {
super(furnace, source, result);
}
// Paper start
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
super(furnace, source, result, recipe);
}
// Paper end
}