-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mob#clearLootTable has no effect #11849
Comments
This is due to the way Mob#getLootTable works in internals, it defaults to the entity type's default loot table if the Mob#lootTable field is an empty optional, which is what is set by the API. Though what you're trying to do is already possible in the API using the EntityDeathEvent, just clear the getDrops there and the entity won't drop anything |
Yeah, I just came to the same conclusion while reading through the code. Judging from the docs, it sounds like setting the loot table to null will not generate loot on death of a mob. I feel like adding a |
This is pretty much the joys of making loose promises in the API over existing implementations of behavior, if we want to enforce this API promise, most solutions here just introduce their own behavioral breakages, I think that the answer here is to just update the JDs to reflect the recentish changes and ensure that API exists for plugins to deal with whatever case they want |
In versions prior to 1.21.2, you could set the loot table to LootTables.EMPTY to create a mob that drops nothing. This loot table has been removed from Minecraft and Bukkit/Paper in 1.21.2. It would be best if Paper could restore the lost LootTables.EMPTY functionality with a built-in datapack which provides an empty loot table. This way, you could also access it with commands like /summon sheep ~ ~ ~ {DeathLootTable:"paper:empty"} or something like that. |
How about just add this to the LootTable interface? public static LootTable EMPTY = new LootTable() {
@Override
public @NotNull NamespacedKey getKey() {
return new NamespacedKey("paper", "empty_loot_table");
}
@Override
public @NotNull Collection<ItemStack> populateLoot(@Nullable final Random random, @NotNull final LootContext context) {
return List.of();
}
@Override
public void fillInventory(@NotNull final Inventory inventory, @Nullable final Random random, @NotNull final LootContext context) {
}
}; not fully like but not sure if just try to add in registry and empty work... NMS have a empty but its not registered then cannot be called in API unless mess with server side for make a thing like getEmptyLootTable for call this but the Craft implementation expect a loottable with key... |
Expected behavior
Mob#clearLootTable
(orsetLootTable(null)
) should prevent the mob from generating and dropping loot on deathObserved/Actual behavior
The mob still generates and drops its default loot
Steps/models to reproduce
Mob#clearLootTable
method (or set it to null)Plugin and Datapack List
irrelevant
Paper version
This server is running Paper version 1.21.4-61-main@e0abc5f (2024-12-28T14:03:42Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-34-d568e17 (MC: 1.21.4)
Other
No response
The text was updated successfully, but these errors were encountered: