geforkt von Mirrors/Paper
Preserve data if possible when dropping Items from entities. Partial solution for BUKKIT-15
By: Tahg <tahgtahv@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
02109efbfc
Commit
14196c7d71
@ -288,7 +288,15 @@ 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()) {
|
||||||
world.dropItemNaturally(entity.getLocation(), stack);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
@ -310,7 +318,13 @@ 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;
|
||||||
|
|
||||||
world.dropItemNaturally(entity.getLocation(), stack);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren