parent
405ab6388e
commit
7fe98bd520
32 changed files with 369 additions and 463 deletions
|
@ -0,0 +1,51 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <mail@moep.tv>
|
||||
Date: Wed, 10 Jun 2020 23:55:16 +0100
|
||||
Subject: [PATCH] Inventory getHolder method without block snapshot
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/DoubleChest.java b/src/main/java/org/bukkit/block/DoubleChest.java
|
||||
index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09e55e9355 100644
|
||||
--- a/src/main/java/org/bukkit/block/DoubleChest.java
|
||||
+++ b/src/main/java/org/bukkit/block/DoubleChest.java
|
||||
@@ -34,6 +34,18 @@ public class DoubleChest implements InventoryHolder {
|
||||
return inventory.getRightSide().getHolder();
|
||||
}
|
||||
|
||||
+ // Paper start - getHolder without snapshot
|
||||
+ @Nullable
|
||||
+ public InventoryHolder getLeftSide(boolean useSnapshot) {
|
||||
+ return inventory.getLeftSide().getHolder(useSnapshot);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public InventoryHolder getRightSide(boolean useSnapshot) {
|
||||
+ return inventory.getRightSide().getHolder(useSnapshot);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
public Location getLocation() {
|
||||
return getInventory().getLocation();
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..6386206188e820206bb1a9f516b5e194fdc9d952 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
@@ -384,6 +384,17 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
@Nullable
|
||||
public InventoryHolder getHolder();
|
||||
|
||||
+ // Paper start - getHolder without snapshot
|
||||
+ /**
|
||||
+ * Gets the block or entity belonging to the open inventory
|
||||
+ *
|
||||
+ * @param useSnapshot Create a snapshot if the holder is a tile entity
|
||||
+ * @return The holder of the inventory; null if it has no holder.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryHolder getHolder(boolean useSnapshot);
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<ItemStack> iterator();
|
25
patches/api/0209-Expose-Arrow-getItemStack.patch
Normal file
25
patches/api/0209-Expose-Arrow-getItemStack.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nesaak <52047222+Nesaak@users.noreply.github.com>
|
||||
Date: Fri, 22 May 2020 13:35:21 -0400
|
||||
Subject: [PATCH] Expose Arrow getItemStack
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..b1d8007eed489aa061c1a6813bcdafc101231e56 100644
|
||||
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
@@ -143,6 +143,14 @@ public interface AbstractArrow extends Projectile {
|
||||
}
|
||||
|
||||
// Paper start
|
||||
+ /**
|
||||
+ * Gets the ItemStack for this arrow.
|
||||
+ *
|
||||
+ * @return The ItemStack, as if a player picked up the arrow
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.inventory.ItemStack getItemStack();
|
||||
+
|
||||
/**
|
||||
* Gets the {@link PickupRule} for this arrow.
|
||||
*
|
|
@ -0,0 +1,96 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LordKorea <lk97798@posteo.net>
|
||||
Date: Mon, 11 May 2020 22:38:10 -0400
|
||||
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6522eb262
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
@@ -0,0 +1,84 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player clicks a recipe in the recipe book
|
||||
+ */
|
||||
+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancel = false;
|
||||
+ @NotNull private NamespacedKey recipe;
|
||||
+ private boolean makeAll;
|
||||
+
|
||||
+ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) {
|
||||
+ super(player);
|
||||
+ this.recipe = recipe;
|
||||
+ this.makeAll = makeAll;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the namespaced key of the recipe that was clicked by the player
|
||||
+ *
|
||||
+ * @return The namespaced key of the recipe
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public NamespacedKey getRecipe() {
|
||||
+ return recipe;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Changes what recipe is requested. This sets the requested recipe to the recipe with the given key
|
||||
+ *
|
||||
+ * @param recipe The key of the recipe that should be requested
|
||||
+ */
|
||||
+ public void setRecipe(@NotNull NamespacedKey recipe) {
|
||||
+ this.recipe = recipe;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a boolean which indicates whether or not the player requested to make the maximum amount of results. This is
|
||||
+ * true if shift is pressed while the recipe is clicked in the recipe book
|
||||
+ *
|
||||
+ * @return {@code true} if shift is pressed while the recipe is clicked
|
||||
+ */
|
||||
+ public boolean isMakeAll() {
|
||||
+ return makeAll;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether or not the maximum amount of results should be made. If this is true, the request is handled as if
|
||||
+ * the player had pressed shift while clicking on the recipe
|
||||
+ *
|
||||
+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results
|
||||
+ */
|
||||
+ public void setMakeAll(boolean makeAll) {
|
||||
+ this.makeAll = makeAll;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
Loading…
Add table
Add a link
Reference in a new issue