Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
SPIGOT-5249: Do not add data to empty loot table
Dieser Commit ist enthalten in:
Ursprung
54f4e7f958
Commit
660b6d19a7
@ -74,20 +74,22 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
|||||||
WorldServer handle = ((CraftWorld) loc.getWorld()).getHandle();
|
WorldServer handle = ((CraftWorld) loc.getWorld()).getHandle();
|
||||||
|
|
||||||
LootTableInfo.Builder builder = new LootTableInfo.Builder(handle);
|
LootTableInfo.Builder builder = new LootTableInfo.Builder(handle);
|
||||||
// builder.luck(context.getLuck());
|
if (getHandle() != LootTable.a) { // PAIL - empty
|
||||||
|
// builder.luck(context.getLuck());
|
||||||
|
|
||||||
if (context.getLootedEntity() != null) {
|
if (context.getLootedEntity() != null) {
|
||||||
Entity nmsLootedEntity = ((CraftEntity) context.getLootedEntity()).getHandle();
|
Entity nmsLootedEntity = ((CraftEntity) context.getLootedEntity()).getHandle();
|
||||||
builder.set(LootContextParameters.THIS_ENTITY, nmsLootedEntity);
|
builder.set(LootContextParameters.THIS_ENTITY, nmsLootedEntity);
|
||||||
builder.set(LootContextParameters.DAMAGE_SOURCE, DamageSource.GENERIC);
|
builder.set(LootContextParameters.DAMAGE_SOURCE, DamageSource.GENERIC);
|
||||||
builder.set(LootContextParameters.POSITION, new BlockPosition(nmsLootedEntity));
|
builder.set(LootContextParameters.POSITION, new BlockPosition(nmsLootedEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.getKiller() != null) {
|
if (context.getKiller() != null) {
|
||||||
EntityHuman nmsKiller = ((CraftHumanEntity) context.getKiller()).getHandle();
|
EntityHuman nmsKiller = ((CraftHumanEntity) context.getKiller()).getHandle();
|
||||||
builder.set(LootContextParameters.KILLER_ENTITY, nmsKiller);
|
builder.set(LootContextParameters.KILLER_ENTITY, nmsKiller);
|
||||||
// If there is a player killer, damage source should reflect that in case loot tables use that information
|
// If there is a player killer, damage source should reflect that in case loot tables use that information
|
||||||
builder.set(LootContextParameters.DAMAGE_SOURCE, DamageSource.playerAttack(nmsKiller));
|
builder.set(LootContextParameters.DAMAGE_SOURCE, DamageSource.playerAttack(nmsKiller));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.build(getHandle().getLootContextParameterSet());
|
return builder.build(getHandle().getLootContextParameterSet());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren