diff options
author | Jake Potrebic <[email protected]> | 2024-05-26 12:51:15 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-26 12:51:15 -0700 |
commit | 9774a52d110f29e4be956d1aad7bb4c99b50d21d (patch) | |
tree | 87b4d46a37670e8fadfae8bc4924fcf633616457 /patches/api | |
parent | ca50b87947e0aca6017a7d4b242d892b930ae2c2 (diff) | |
download | Paper-9774a52d110f29e4be956d1aad7bb4c99b50d21d.tar.gz Paper-9774a52d110f29e4be956d1aad7bb4c99b50d21d.zip |
fix and cleanup loot table patches (#10100)
* fix and cleanup loot table patches
* fixes
Diffstat (limited to 'patches/api')
-rw-r--r-- | patches/api/0041-LootTable-API.patch | 60 | ||||
-rw-r--r-- | patches/api/0056-Fix-upstream-javadocs.patch | 2 | ||||
-rw-r--r-- | patches/api/0147-Mob-Pathfinding-API.patch | 2 | ||||
-rw-r--r-- | patches/api/0155-Add-sun-related-API.patch | 2 | ||||
-rw-r--r-- | patches/api/0279-Add-Mob-lookAt-API.patch | 2 | ||||
-rw-r--r-- | patches/api/0292-Missing-Entity-API.patch | 14 | ||||
-rw-r--r-- | patches/api/0310-Left-handed-API.patch | 10 | ||||
-rw-r--r-- | patches/api/0400-Add-Mob-Experience-reward-API.patch | 10 |
8 files changed, 64 insertions, 38 deletions
diff --git a/patches/api/0041-LootTable-API.patch b/patches/api/0041-LootTable-API.patch index ced8fe4885..d500927ae8 100644 --- a/patches/api/0041-LootTable-API.patch +++ b/patches/api/0041-LootTable-API.patch @@ -58,10 +58,10 @@ index 0000000000000000000000000000000000000000..b387894fe8001edb41ad2ad2b70ebabe +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..2b01a50b6e18856f4c9e28340a7a111cae646a0a +index 0000000000000000000000000000000000000000..b18a0b50c12fe8d8c954e5c070f2ecd1854a2583 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java -@@ -0,0 +1,125 @@ +@@ -0,0 +1,124 @@ +package com.destroystokyo.paper.loottable; + +import org.bukkit.entity.Player; @@ -101,8 +101,8 @@ index 0000000000000000000000000000000000000000..2b01a50b6e18856f4c9e28340a7a111c + * @param player The player to check + * @return Whether or not this player has looted this block + */ -+ default boolean hasPlayerLooted(@NotNull Player player) { -+ return hasPlayerLooted(player.getUniqueId()); ++ default boolean hasPlayerLooted(final @NotNull Player player) { ++ return this.hasPlayerLooted(player.getUniqueId()); + } + + /** @@ -127,9 +127,8 @@ index 0000000000000000000000000000000000000000..2b01a50b6e18856f4c9e28340a7a111c + * @param player The player to check + * @return Timestamp last looted, or null if player has not looted this object + */ -+ @Nullable -+ default Long getLastLooted(@NotNull Player player) { -+ return getLastLooted(player.getUniqueId()); ++ default @Nullable Long getLastLooted(final @NotNull Player player) { ++ return this.getLastLooted(player.getUniqueId()); + } + + /** @@ -147,8 +146,8 @@ index 0000000000000000000000000000000000000000..2b01a50b6e18856f4c9e28340a7a111c + * @param looted true to add player to looted list, false to remove + * @return The previous state of whether the player had looted this or not + */ -+ default boolean setHasPlayerLooted(@NotNull Player player, boolean looted) { -+ return setHasPlayerLooted(player.getUniqueId(), looted); ++ default boolean setHasPlayerLooted(final @NotNull Player player, final boolean looted) { ++ return this.setHasPlayerLooted(player.getUniqueId(), looted); + } + + /** @@ -271,6 +270,19 @@ index b451191312e4fb19f2131c2d0a0c0337953f6c7c..db6affbc78106b2d93b41953b624a0bc /** * Gets the inventory of the chest block represented by this block state. +diff --git a/src/main/java/org/bukkit/block/Crafter.java b/src/main/java/org/bukkit/block/Crafter.java +index 05d6af1681351844a6673a6d0dfca2038dafa7b6..8b2a315ed5dd1c57ce60fc41fd5e83a6495028e6 100644 +--- a/src/main/java/org/bukkit/block/Crafter.java ++++ b/src/main/java/org/bukkit/block/Crafter.java +@@ -10,7 +10,7 @@ import org.jetbrains.annotations.ApiStatus; + */ + @ApiStatus.Experimental + @MinecraftExperimental(Requires.UPDATE_1_21) +-public interface Crafter extends Container, Lootable { ++public interface Crafter extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory { // Paper - LootTable API + + /** + * Gets the number of ticks which this block will remain in the crafting diff --git a/src/main/java/org/bukkit/block/Dispenser.java b/src/main/java/org/bukkit/block/Dispenser.java index 74cd194c9a98245dc52e7e352d7d6c046e1e5cf3..07af1a3f011d4b96275f919d302ac367198e923e 100644 --- a/src/main/java/org/bukkit/block/Dispenser.java @@ -355,6 +367,23 @@ index 5b5c3be107fdaa6c55ceb1bca2c223ebc6ab7f43..4ebe1033c55dbd58d0794809435c9352 -public interface ChestBoat extends Boat, InventoryHolder, Lootable { +public interface ChestBoat extends Boat, InventoryHolder, com.destroystokyo.paper.loottable.LootableEntityInventory { // Paper } +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 2926fa6071bc7640cc10280b5c3962b0ce7686f1..f3f62e13cc1b6172808c52f2d5f520f1f584e6db 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -61,4 +61,12 @@ public interface Mob extends LivingEntity, Lootable { + */ + @Nullable + public Sound getAmbientSound(); ++ ++ // Paper start - LootTable API ++ @Override ++ default void setLootTable(final @Nullable org.bukkit.loot.LootTable table, final long seed) { ++ this.setLootTable(table); ++ this.setSeed(seed); ++ } ++ // Paper end - LootTable API + } diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java index 937b99f8734d71b2ad33af142afbc251b81d9745..db69687a7ad4b18d17ab1677cae5d8dd4dcd3678 100644 --- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java @@ -394,10 +423,10 @@ index 9ea403e6fd8e960d017660e0aec118abeda2c42b..238d118f7788b13cd86b7e9ea3a0fc38 +public interface StorageMinecart extends Minecart, InventoryHolder, LootableEntityInventory { // Paper } diff --git a/src/main/java/org/bukkit/loot/Lootable.java b/src/main/java/org/bukkit/loot/Lootable.java -index 24a3d989db3bc67e7afe8459a3d4bb132f448ea7..901db852498e0658c79a57582508dab29bf0a798 100644 +index 24a3d989db3bc67e7afe8459a3d4bb132f448ea7..ad4b0fb7f55ed44dc74fb5a4bd36be6004231116 100644 --- a/src/main/java/org/bukkit/loot/Lootable.java +++ b/src/main/java/org/bukkit/loot/Lootable.java -@@ -36,6 +36,34 @@ public interface Lootable { +@@ -36,6 +36,31 @@ public interface Lootable { @Nullable LootTable getLootTable(); @@ -408,24 +437,21 @@ index 24a3d989db3bc67e7afe8459a3d4bb132f448ea7..901db852498e0658c79a57582508dab2 + * @param table the Loot Table this {@link org.bukkit.block.Container} or {@link org.bukkit.entity.Mob} will have. + * @param seed the seed to used to generate loot. Default is 0. + */ -+ default void setLootTable(@Nullable LootTable table, long seed) { -+ setLootTable(table); -+ setSeed(seed); -+ } ++ void setLootTable(final @Nullable LootTable table, final long seed); + + /** + * Returns whether or not this object has a Loot Table + * @return Has a loot table + */ + default boolean hasLootTable() { -+ return getLootTable() != null; ++ return this.getLootTable() != null; + } + + /** + * Clears the associated Loot Table to this object + */ + default void clearLootTable() { -+ setLootTable(null); ++ this.setLootTable(null); + } + // Paper end + diff --git a/patches/api/0056-Fix-upstream-javadocs.patch b/patches/api/0056-Fix-upstream-javadocs.patch index d25bff0a4b..c88af4e8bf 100644 --- a/patches/api/0056-Fix-upstream-javadocs.patch +++ b/patches/api/0056-Fix-upstream-javadocs.patch @@ -411,7 +411,7 @@ index b688b3856cb3068a539fcecfbfa113f8ab4160a9..c275b881cbd11307a6dcc7190d7a7d40 * @return whether the item frame is visible or not */ diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 2926fa6071bc7640cc10280b5c3962b0ce7686f1..4f63988848443aff55619bc12ef12c925642a3f9 100644 +index f3f62e13cc1b6172808c52f2d5f520f1f584e6db..ad5dbf310fe7b34c997bb339f09697222f862005 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java @@ -9,6 +9,10 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0147-Mob-Pathfinding-API.patch b/patches/api/0147-Mob-Pathfinding-API.patch index 83fb575817..1c0b6088a4 100644 --- a/patches/api/0147-Mob-Pathfinding-API.patch +++ b/patches/api/0147-Mob-Pathfinding-API.patch @@ -238,7 +238,7 @@ index 0000000000000000000000000000000000000000..3c1e2c93d923a683cc0455af77c43784 + } +} diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 4f63988848443aff55619bc12ef12c925642a3f9..6de4344931b2e3d570346b800186c44a0d5782cc 100644 +index ad5dbf310fe7b34c997bb339f09697222f862005..63a14bec00d0b23431d1d002139f48a7d0bc2a88 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java @@ -2,6 +2,7 @@ package org.bukkit.entity; diff --git a/patches/api/0155-Add-sun-related-API.patch b/patches/api/0155-Add-sun-related-API.patch index 7132b29be0..6b6e2476a0 100644 --- a/patches/api/0155-Add-sun-related-API.patch +++ b/patches/api/0155-Add-sun-related-API.patch @@ -26,7 +26,7 @@ index 5efe33cef4d9c153d760fc71606721ff8abafbfc..b6ca63afb74b345e381d35646cc8faf5 * Gets the full in-game time on this world since the world generation * diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 6de4344931b2e3d570346b800186c44a0d5782cc..7eee2e561346ac1d672f9652edb78e76c910fc9d 100644 +index 63a14bec00d0b23431d1d002139f48a7d0bc2a88..ef89a82669a6c5bf911827b90facf36a2ff26e91 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java @@ -20,6 +20,13 @@ public interface Mob extends LivingEntity, Lootable { diff --git a/patches/api/0279-Add-Mob-lookAt-API.patch b/patches/api/0279-Add-Mob-lookAt-API.patch index 0dd5126905..e1164a0f3e 100644 --- a/patches/api/0279-Add-Mob-lookAt-API.patch +++ b/patches/api/0279-Add-Mob-lookAt-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Mob#lookAt API diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 7eee2e561346ac1d672f9652edb78e76c910fc9d..11b6d1aba7d1f6ae1f3c822193486f5a1478e105 100644 +index ef89a82669a6c5bf911827b90facf36a2ff26e91..5fd723c9fdda81595db8b150d967ff3bd5cea608 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java @@ -27,6 +27,88 @@ public interface Mob extends LivingEntity, Lootable { diff --git a/patches/api/0292-Missing-Entity-API.patch b/patches/api/0292-Missing-Entity-API.patch index 26800f488d..4dcfc5d27a 100644 --- a/patches/api/0292-Missing-Entity-API.patch +++ b/patches/api/0292-Missing-Entity-API.patch @@ -738,15 +738,15 @@ index d23226ccb0f6c25028f000ce31346cd0a8898e6a..bc84b892cae5fe7019a3ad481e9da799 + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 11b6d1aba7d1f6ae1f3c822193486f5a1478e105..709c8fc3dde786f45ff13d6ee6c405ffdc765282 100644 +index 5fd723c9fdda81595db8b150d967ff3bd5cea608..91d31e5418a5ab7cefd7c02a41bbec8464fe7ab1 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -162,4 +162,38 @@ public interface Mob extends LivingEntity, Lootable { - */ - @Nullable - public Sound getAmbientSound(); +@@ -170,4 +170,38 @@ public interface Mob extends LivingEntity, Lootable { + this.setSeed(seed); + } + // Paper end - LootTable API + -+ // Paper start ++ // Paper start - Missing Entity API + /** + * Some mobs will raise their arm(s) when aggressive: + * <ul> @@ -778,7 +778,7 @@ index 11b6d1aba7d1f6ae1f3c822193486f5a1478e105..709c8fc3dde786f45ff13d6ee6c405ff + * @see #isAggressive() + */ + void setAggressive(boolean aggressive); -+ // Paper end ++ // Paper end - Missing Entity API } diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java index 1f027927a1194f4f8e86c1375a2772e6e261c151..aa5686df134185334a74429576ff0709a604dbfd 100644 diff --git a/patches/api/0310-Left-handed-API.patch b/patches/api/0310-Left-handed-API.patch index cae17a697b..ea746f73d4 100644 --- a/patches/api/0310-Left-handed-API.patch +++ b/patches/api/0310-Left-handed-API.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Left handed API diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 709c8fc3dde786f45ff13d6ee6c405ffdc765282..0c511b64672f9bafb92be3aea6bab8c1c12a7041 100644 +index 91d31e5418a5ab7cefd7c02a41bbec8464fe7ab1..d55250d820b02f3a23b99a59e68d3361698baddf 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -196,4 +196,20 @@ public interface Mob extends LivingEntity, Lootable { +@@ -204,4 +204,20 @@ public interface Mob extends LivingEntity, Lootable { */ void setAggressive(boolean aggressive); - // Paper end + // Paper end - Missing Entity API + -+ // Paper start ++ // Paper start - left-handed API + /** + * Check if Mob is left-handed + * @@ -27,5 +27,5 @@ index 709c8fc3dde786f45ff13d6ee6c405ffdc765282..0c511b64672f9bafb92be3aea6bab8c1 + * @param leftHanded True if left-handed + */ + public void setLeftHanded(boolean leftHanded); -+ // Paper end ++ // Paper end - left-handed API } diff --git a/patches/api/0400-Add-Mob-Experience-reward-API.patch b/patches/api/0400-Add-Mob-Experience-reward-API.patch index 2e3a09921e..354d6d1eb4 100644 --- a/patches/api/0400-Add-Mob-Experience-reward-API.patch +++ b/patches/api/0400-Add-Mob-Experience-reward-API.patch @@ -5,20 +5,20 @@ Subject: [PATCH] Add Mob Experience reward API diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 0c511b64672f9bafb92be3aea6bab8c1c12a7041..30ef0c20df8ff2ed56adb40fea103265dd3e886c 100644 +index d55250d820b02f3a23b99a59e68d3361698baddf..256e5645bcfa76e7ede58ae365e69b4a4bed6204 100644 --- a/src/main/java/org/bukkit/entity/Mob.java +++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -212,4 +212,13 @@ public interface Mob extends LivingEntity, Lootable { +@@ -220,4 +220,13 @@ public interface Mob extends LivingEntity, Lootable { */ public void setLeftHanded(boolean leftHanded); - // Paper end + // Paper end - left-handed API + -+ // Paper start ++ // Paper start - mob xp reward API + /** + * Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results + * + * @return the amount of experience the mob will possibly drop + */ + public int getPossibleExperienceReward(); -+ // Paper end ++ // Paper end - mob xp reward API } |