Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 05:20:05 +01:00
Preserve data if possible when dropping Items from entities. Partial solution for BUKKIT-15
Dieser Commit ist enthalten in:
Ursprung
bcf979b2a6
Commit
eddefa6c50
@ -288,8 +288,16 @@ public class CraftEventFactory {
|
|||||||
victim.expToDrop = event.getDroppedExp();
|
victim.expToDrop = event.getDroppedExp();
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||||
|
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||||
|
|
||||||
|
if (stack instanceof CraftItemStack) {
|
||||||
|
// Use the internal item to preserve possible data.
|
||||||
|
victim.a(((CraftItemStack) stack).getHandle(), 0.0f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
world.dropItemNaturally(entity.getLocation(), stack);
|
world.dropItemNaturally(entity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
@ -310,8 +318,14 @@ public class CraftEventFactory {
|
|||||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||||
if (stack == null || stack.getType() == Material.AIR) continue;
|
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||||
|
|
||||||
|
if (stack instanceof CraftItemStack) {
|
||||||
|
// Use the internal item to preserve possible data.
|
||||||
|
victim.a(((CraftItemStack) stack).getHandle(), 0.0f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
world.dropItemNaturally(entity.getLocation(), stack);
|
world.dropItemNaturally(entity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren