-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Upstream (Purpur), more patches
- Loading branch information
Showing
11 changed files
with
465 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: SoSeDiK <[email protected]> | ||
Date: Wed, 25 Sep 2024 19:28:19 +0300 | ||
Subject: [PATCH] Extra item drop method | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java | ||
index 261475159221ddd528d13991c06be5eaf908030c..8ff204f95bf47c90c4015a5d7e82d4670597b39d 100644 | ||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java | ||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java | ||
@@ -812,4 +812,14 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder | ||
@Nullable | ||
public Firework fireworkBoost(@NotNull ItemStack fireworkItemStack); | ||
|
||
+ // Kiterino start - Extra item drop method | ||
+ /** | ||
+ * Drops an item at the location of the entity. | ||
+ * | ||
+ * @param item ItemStack to drop | ||
+ * @return ItemDrop entity created as a result of this method | ||
+ */ | ||
+ @NotNull Item dropItem(@NotNull org.bukkit.inventory.ItemStack item); | ||
+ // Kiterino end - Extra item drop method | ||
+ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: SoSeDiK <[email protected]> | ||
Date: Mon, 21 Feb 2022 11:44:15 +0200 | ||
Subject: [PATCH] Add extra MaterialTags | ||
|
||
|
||
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java | ||
index be212b4fbeabab32a4dab6ae554768c368efaa88..0552272771d1f5e1a4294a77bf266bcb7105676c 100644 | ||
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java | ||
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java | ||
@@ -714,4 +714,21 @@ public class MaterialTags { | ||
.add(Material.NETHERITE_AXE, Material.NETHERITE_HOE, Material.NETHERITE_PICKAXE, Material.NETHERITE_SHOVEL, Material.NETHERITE_SWORD) | ||
.ensureSize("NETHERITE_TOOLS", 5).lock(); | ||
|
||
+ // Kiterino start - Add extra MaterialTags | ||
+ /** | ||
+ * Covers the variants of items that can be equipped in any of the armor slots. | ||
+ */ | ||
+ public static final MaterialSetTag ALL_EQUIPPABLE = new MaterialSetTag(keyFor("all_equippable")) | ||
+ .add(HEAD_EQUIPPABLE) | ||
+ .add(CHEST_EQUIPPABLE) | ||
+ .add(LEGGINGS) | ||
+ .add(BOOTS) | ||
+ .lock(); | ||
+ | ||
+ /** | ||
+ * Covers the minecarts | ||
+ */ | ||
+ public static final MaterialSetTag MINECARTS = new MaterialSetTag(keyFor("minecarts")) | ||
+ .endsWith("MINECART").ensureSize("MINECARTS", 6).lock(); | ||
+ // Kiterino end - Add extra MaterialTags | ||
} |
194 changes: 194 additions & 0 deletions
194
patches/api/0031-Add-Paper-PR-FillBottleEvents-for-player-and-dispens.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jake Potrebic <[email protected]> | ||
Date: Sat, 26 Feb 2022 16:43:33 -0800 | ||
Subject: [PATCH] Add Paper PR - FillBottleEvents for player and dispenser | ||
|
||
Adds 2 events, PlayerFillBottleEvent and BlockFillBottleEvent. These | ||
events do not have a common superclass due to needing to extend | ||
PlayerEvent and BlockEvent respectively. | ||
|
||
TODO: Add a common interface between Block and AreaEffectCloud, | ||
something like BottleSource to add a "source" field to each event to get | ||
the source of the bottle fill, water block, cauldron, beehive, or | ||
AreaEffectCloud. | ||
|
||
Co-authored-by: Dmitry Sidorov <[email protected]> | ||
|
||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..4d939e1d936dcb59807b1f39db7197f41426b700 | ||
--- /dev/null | ||
+++ b/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java | ||
@@ -0,0 +1,79 @@ | ||
+package io.papermc.paper.event.block; | ||
+ | ||
+import org.bukkit.block.Block; | ||
+import org.bukkit.event.Cancellable; | ||
+import org.bukkit.event.HandlerList; | ||
+import org.bukkit.event.block.BlockEvent; | ||
+import org.bukkit.inventory.ItemStack; | ||
+import org.jetbrains.annotations.NotNull; | ||
+ | ||
+/** | ||
+ * Called when a {@link org.bukkit.block.Dispenser} fills up a bottle. | ||
+ */ | ||
+public class BlockFillBottleEvent extends BlockEvent implements Cancellable { | ||
+ | ||
+ private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
+ | ||
+ private final ItemStack bottle; | ||
+ private ItemStack resultItem; | ||
+ private boolean cancelled; | ||
+ | ||
+ | ||
+ public BlockFillBottleEvent(@NotNull Block block, @NotNull ItemStack bottle, @NotNull ItemStack resultItem) { | ||
+ super(block); | ||
+ this.bottle = bottle; | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the bottle item that's being filled. | ||
+ * | ||
+ * @return the bottle item | ||
+ */ | ||
+ public @NotNull ItemStack getBottle() { | ||
+ return this.bottle; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the result of the glass bottle that's being filled. | ||
+ * | ||
+ * @return the result of the filling | ||
+ */ | ||
+ public @NotNull ItemStack getResultItem() { | ||
+ return this.resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Sets the result of the glass bottle being filled. | ||
+ * | ||
+ * @param resultItem the result of the filling | ||
+ */ | ||
+ public void setResultItem(@NotNull ItemStack resultItem) { | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean isCancelled() { | ||
+ return this.cancelled; | ||
+ } | ||
+ | ||
+ /** | ||
+ * {@inheritDoc} | ||
+ * <p> | ||
+ * Cancelling this event will prevent {@link #getBottle()} from being | ||
+ * replaced/consumed. | ||
+ */ | ||
+ @Override | ||
+ public void setCancelled(boolean cancel) { | ||
+ this.cancelled = cancel; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public @NotNull HandlerList getHandlers() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+ | ||
+ public static @NotNull HandlerList getHandlerList() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+} | ||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..22f3f867e8ff5041816926ddd599e3758387ea03 | ||
--- /dev/null | ||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java | ||
@@ -0,0 +1,87 @@ | ||
+package io.papermc.paper.event.player; | ||
+ | ||
+import org.bukkit.entity.Player; | ||
+import org.bukkit.event.Cancellable; | ||
+import org.bukkit.event.HandlerList; | ||
+import org.bukkit.event.player.PlayerEvent; | ||
+import org.bukkit.inventory.EquipmentSlot; | ||
+import org.bukkit.inventory.ItemStack; | ||
+import org.jetbrains.annotations.NotNull; | ||
+ | ||
+public class PlayerFillBottleEvent extends PlayerEvent implements Cancellable { | ||
+ | ||
+ private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
+ | ||
+ private final EquipmentSlot hand; | ||
+ private final ItemStack bottle; | ||
+ private ItemStack resultItem; | ||
+ private boolean cancelled; | ||
+ | ||
+ public PlayerFillBottleEvent(@NotNull Player player, @NotNull EquipmentSlot hand, @NotNull ItemStack bottle, @NotNull ItemStack resultItem) { | ||
+ super(player); | ||
+ this.hand = hand; | ||
+ this.bottle = bottle; | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * The hand used to fill the bottle. | ||
+ * | ||
+ * @return the hand | ||
+ */ | ||
+ public @NotNull EquipmentSlot getHand() { | ||
+ return this.hand; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the bottle item that's being filled. | ||
+ * | ||
+ * @return the bottle item | ||
+ */ | ||
+ public @NotNull ItemStack getBottle() { | ||
+ return this.bottle; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the result of the bottle that's being filled. | ||
+ * | ||
+ * @return the result of the filling | ||
+ */ | ||
+ public @NotNull ItemStack getResultItem() { | ||
+ return this.resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Sets the result of the bottle being filled. | ||
+ * | ||
+ * @param resultItem the result of the filling | ||
+ */ | ||
+ public void setResultItem(@NotNull ItemStack resultItem) { | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean isCancelled() { | ||
+ return this.cancelled; | ||
+ } | ||
+ | ||
+ /** | ||
+ * {@inheritDoc} | ||
+ * <p> | ||
+ * Cancelling this event will prevent {@link #getBottle()} from being | ||
+ * replaced/consumed. | ||
+ */ | ||
+ @Override | ||
+ public void setCancelled(boolean cancel) { | ||
+ this.cancelled = cancel; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public @NotNull HandlerList getHandlers() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+ | ||
+ public static @NotNull HandlerList getHandlerList() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: SoSeDiK <[email protected]> | ||
Date: Wed, 25 Sep 2024 19:28:18 +0300 | ||
Subject: [PATCH] Extra item drop method | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | ||
index 46856d2b7e24c5d223b7b1627ccb451749b183e7..25e5f70d5558720280fe05c8ba2a0ad6d90a0c8d 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | ||
@@ -872,4 +872,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { | ||
public org.bukkit.entity.Entity copy(Location location) { | ||
throw new UnsupportedOperationException("Cannot copy human entities"); | ||
} | ||
+ | ||
+ // Kiterino start - Extra item drop method | ||
+ @Override | ||
+ public org.bukkit.entity.Item dropItem(ItemStack item) { | ||
+ if (!(getHandle() instanceof ServerPlayer player)) { | ||
+ return getWorld().dropItemNaturally(getLocation(), item); | ||
+ } | ||
+ var drop = player.drop(CraftItemStack.asNMSCopy(item), false, true); | ||
+ return drop != null && drop.getBukkitEntity() instanceof org.bukkit.entity.Item droppedItem ? droppedItem : null; | ||
+ } | ||
+ // Kiterino end - Extra item drop method | ||
} |
Oops, something went wrong.