geforkt von Mirrors/Paper
Add recipe to cook events
Dieser Commit ist enthalten in:
Ursprung
4ef1d13622
Commit
ddbf97839e
69
Spigot-API-Patches/Add-recipe-to-cook-events.patch
Normale Datei
69
Spigot-API-Patches/Add-recipe-to-cook-events.patch
Normale Datei
@ -0,0 +1,69 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
|
||||
Date: Wed, 6 Jan 2021 12:05:29 -0800
|
||||
Subject: [PATCH] Add recipe to cook events
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockCookEvent.java b/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ 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() {
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
44
Spigot-Server-Patches/Add-recipe-to-cook-events.patch
Normale Datei
44
Spigot-Server-Patches/Add-recipe-to-cook-events.patch
Normale Datei
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
|
||||
Date: Wed, 6 Jan 2021 12:04:03 -0800
|
||||
Subject: [PATCH] Add recipe to cook events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
|
||||
|
||||
if (this.cookingTimes[i] >= this.cookingTotalTimes[i]) {
|
||||
InventorySubcontainer inventorysubcontainer = new InventorySubcontainer(new ItemStack[]{itemstack});
|
||||
- ItemStack itemstack1 = (ItemStack) this.world.getCraftingManager().craft(Recipes.CAMPFIRE_COOKING, inventorysubcontainer, this.world).map((recipecampfire) -> {
|
||||
+ // Paper start
|
||||
+ Optional<RecipeCampfire> recipe = this.world.getCraftingManager().craft(Recipes.CAMPFIRE_COOKING, inventorysubcontainer, this.world);
|
||||
+ ItemStack itemstack1 = (ItemStack) recipe.map((recipecampfire) -> {
|
||||
+ // Paper end
|
||||
return recipecampfire.a(inventorysubcontainer);
|
||||
}).orElse(itemstack);
|
||||
BlockPosition blockposition = this.getPosition();
|
||||
@@ -0,0 +0,0 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
|
||||
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
|
||||
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
|
||||
- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(this.world, this.position), source, result);
|
||||
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(this.world, this.position), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipe.map(RecipeCampfire::toBukkitRecipe).orElse(null)); // Paper
|
||||
this.world.getServer().getPluginManager().callEvent(blockCookEvent);
|
||||
|
||||
if (blockCookEvent.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
|
||||
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
|
||||
- FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), source, result);
|
||||
+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), source, result, (org.bukkit.inventory.CookingRecipe<?>) irecipe.toBukkitRecipe()); // Paper
|
||||
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
|
||||
|
||||
if (furnaceSmeltEvent.isCancelled()) {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren