Skip to content

Commit

Permalink
Update Upstream (Purpur), more patches
Browse files Browse the repository at this point in the history
  • Loading branch information
SoSeDiK committed Sep 26, 2024
1 parent 2581efe commit 04d8957
Show file tree
Hide file tree
Showing 11 changed files with 465 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1.21.1-R0.1-SNAPSHOT
mcVersion = 1.21.1

# Upstream commit
purpurCommit = be61a07bf60547c02657b39cb90ceb4c0dc68883
purpurCommit = d7a7c91a7fd28d77980ce3da06bdf69e8fef92af

# Gradle
org.gradle.caching = true
Expand Down
4 changes: 2 additions & 2 deletions patches/api/0007-ItemStack-helper-methods.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack helper methods


diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 9b8b958ce181b60eb5db89d4720380153152a2ac..c4686f06fd945c77a2813f1b2c31508e65f64ad2 100644
index b6389b82b4eae033e1e770ae3967c88e950926ab..152dccfc9b445e11fa646d070a762d97bd7fdcfb 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -1591,4 +1591,54 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -1678,4 +1678,54 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return random.nextInt(unbreaking + 1) > 0;
}
// Purpur end
Expand Down
25 changes: 25 additions & 0 deletions patches/api/0029-Extra-item-drop-method.patch
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
+
}
32 changes: 32 additions & 0 deletions patches/api/0030-Add-extra-MaterialTags.patch
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
}
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;
+ }
+}
4 changes: 2 additions & 2 deletions patches/server/0018-Data-driven-items.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Subject: [PATCH] Data-driven items


diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 98b096339fe48b2fc8169ae0376e05d59236fc9a..aac4192aa369ce5c1a59cdc01d1baec6034011e8 100644
index d59e77811e4090d0f8207e4fff3300d17b1753b2..b2b3d8013ba6bdbd30bf2441efd069e04705cba9 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -77,7 +77,7 @@ public final class PaperRegistries {
entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new),
- entry(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new),
+ writable(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new, me.sosedik.kiterino.registry.data.KiterinoItemRegistryEntity.KiterinoBuilder::new).delayed(), // Kiterino - Data-driven items
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0021-Data-driven-mob-effects.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Subject: [PATCH] Data-driven mob effects


diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index aac4192aa369ce5c1a59cdc01d1baec6034011e8..c1663ecd1fe46529e7e9ce50a52112ab16611d57 100644
index b2b3d8013ba6bdbd30bf2441efd069e04705cba9..469c8ce4b4ea0a9d2efc8237c7ce6c3c200dac69 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -74,7 +74,7 @@ public final class PaperRegistries {
// built-ins
@@ -75,7 +75,7 @@ public final class PaperRegistries {
writable(Registries.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new, PaperGameEventRegistryEntry.PaperBuilder::new),
entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
- entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new),
+ writable(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new, me.sosedik.kiterino.registry.data.KiterinoMobEffectRegistryEntity.KiterinoBuilder::new).delayed(), // Kiterino - Data-driven mob effects
entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new),
writable(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new, me.sosedik.kiterino.registry.data.KiterinoItemRegistryEntity.KiterinoBuilder::new).delayed(), // Kiterino - Data-driven items
entry(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, Cat.Type.class, CraftCat.CraftType::new),
diff --git a/src/main/java/io/papermc/paper/registry/data/util/Conversions.java b/src/main/java/io/papermc/paper/registry/data/util/Conversions.java
index 48de73884cdece86ff19e36d930e3990066de3bf..b5d6fe97a9a9a1c7e923ec37828fda2389895a7b 100644
--- a/src/main/java/io/papermc/paper/registry/data/util/Conversions.java
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0031-Keep-rider-when-teleporting.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Keep rider when teleporting


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d91aef1bb668e87998b4270ecf2a3e730cb9929f..fe897009d48193527db225138b02188babfc90e0 100644
index 4eb0032aa0481c8afe95a5246e63e05d6cb4f5ea..1ddf4d746fca0a69f63a69b68e589ebacc63f201 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5146,7 +5146,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5148,7 +5148,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper end - Expose entity id counter
// Purpur start
@Nullable
Expand Down
1 change: 0 additions & 1 deletion patches/server/0042-Less-limited-recipe-matcher.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Subject: [PATCH] Less limited recipe matcher
Adds the options to allow using damaged/enchanted/renamed items in the recipe matcher
used by e.g. the recipe book autofill or the crafter block.


diff --git a/src/main/java/me/sosedik/kiterino/KiterinoConfig.java b/src/main/java/me/sosedik/kiterino/KiterinoConfig.java
index c53d495beeda9c057efc5af1b06613be1b5fa9f4..665879a04af47617fe2007348dae94ee27f22fa3 100644
--- a/src/main/java/me/sosedik/kiterino/KiterinoConfig.java
Expand Down
26 changes: 26 additions & 0 deletions patches/server/0043-Extra-item-drop-method.patch
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
}
Loading

0 comments on commit 04d8957

Please sign in to comment.