PaperMC/patches/api/0457-Fix-SpawnerEntry-Equipment-API.patch

68 lines
3.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 26 Apr 2024 17:00:00 -0700
Subject: [PATCH] Fix SpawnerEntry$Equipment API
2024-10-22 18:23:19 +02:00
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index a52c8a0bd030265567b7c1aa80b04eced37fcbbf..c866613ee1fb47daf89179dd30d74489c90be96d 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -1536,12 +1536,11 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa
@MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.BUNDLE) // Paper - add missing annotation
@org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
ITEM_BUNDLE_INSERT("item.bundle.insert"),
-<<<<<<< HEAD
+ @MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.BUNDLE) // Paper - add missing annotation
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
ITEM_BUNDLE_INSERT_FAIL("item.bundle.insert_fail"),
-=======
@MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.BUNDLE) // Paper - add missing annotation
@org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
->>>>>>> Experimental annotations change
ITEM_BUNDLE_REMOVE_ONE("item.bundle.remove_one"),
ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"),
ITEM_CROP_PLANT("item.crop.plant"),
diff --git a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java
2024-10-22 18:23:19 +02:00
index fc1c0435dfea121923eb1fe0182880752f321143..4f00ebb78f7549aed0a250f494222b97b830d0f3 100644
--- a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java
+++ b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java
2024-10-22 18:23:19 +02:00
@@ -120,27 +120,33 @@ public class SpawnerEntry {
private final Map<EquipmentSlot, Float> dropChances;
public Equipment(@NotNull LootTable equipmentLootTable, @NotNull Map<EquipmentSlot, Float> dropChances) {
+ Preconditions.checkArgument(equipmentLootTable != null, "table cannot be null"); // Paper
this.equipmentLootTable = equipmentLootTable;
this.dropChances = dropChances;
}
/**
- * Set the loot table for the entity.
+ * Set the loot table for the spawned entity's equipment slots.
* <br>
2024-10-22 18:23:19 +02:00
+<<<<<<< HEAD
* To remove a loot table use null.
+=======
+ * To remove a loot table use {@link LootTables#EMPTY}.
2024-10-22 18:23:19 +02:00
+>>>>>>> Fix SpawnerEntry$Equipment API
*
* @param table this {@link org.bukkit.entity.Mob} will have.
*/
public void setEquipmentLootTable(@NotNull LootTable table) {
+ Preconditions.checkArgument(table != null, "table cannot be null"); // Paper
this.equipmentLootTable = table;
}
/**
- * Gets the loot table for the entity.
+ * Gets the loot table for the spawned entity's equipment.
* <br>
*
- * If an entity does not have a loot table, this will return null, NOT
- * an empty loot table.
+ * If an entity does not have a loot table, this will return an
+ * empty loot table.
*
* @return the loot table for this entity.
*/