mirror of
https://github.com/shansen/EggCatcher.git
synced 2024-11-26 03:55:44 +01:00
Horses will drop now their inventory when caught.
This commit is contained in:
parent
370304f1fa
commit
7aaadba6e3
@ -31,6 +31,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -269,6 +270,23 @@ public class EggCatcherEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if(entity instanceof Horse) {
|
||||
if(((Horse) entity).isCarryingChest()){
|
||||
entity.getWorld().dropItemNaturally(entity.getLocation(), new ItemStack(Material.CHEST));
|
||||
}
|
||||
}
|
||||
|
||||
if(entity instanceof InventoryHolder){
|
||||
|
||||
ItemStack[] items = ((InventoryHolder) entity).getInventory().getContents();
|
||||
|
||||
for(ItemStack itemStack : items) {
|
||||
if(itemStack!=null){
|
||||
entity.getWorld().dropItemNaturally(entity.getLocation(), itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.getWorld().dropItem(entity.getLocation(), eggStack);
|
||||
|
||||
if (!this.spawnChickenOnSuccess) {
|
||||
|
Loading…
Reference in New Issue
Block a user