SPIGOT-7014: getLootTable API should not persistently update loot table

This commit is contained in:
md_5 2022-05-09 18:13:06 +10:00
parent 7fdd7941f6
commit 2ac7fa7af6
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.EntityInsentient; import net.minecraft.world.entity.EntityInsentient;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
@ -61,11 +62,7 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@Override @Override
public LootTable getLootTable() { public LootTable getLootTable() {
if (getHandle().lootTable == null) { NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().getLootTable());
getHandle().lootTable = getHandle().getDefaultLootTable();
}
NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().lootTable);
return Bukkit.getLootTable(key); return Bukkit.getLootTable(key);
} }