diff --git a/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java b/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java index 1aa40ca..f553136 100644 --- a/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java +++ b/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java @@ -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) {