Fire UseEntityEvent for InventoryOpenEvent for entities.

This commit is contained in:
sk89q 2015-01-11 00:10:52 -08:00
parent 04214a96eb
commit 223d22e79f

View File

@ -690,6 +690,8 @@ public void onInventoryOpen(InventoryOpenEvent event) {
InventoryHolder holder = event.getInventory().getHolder();
if (holder instanceof BlockState) {
Events.fireToCancel(event, new UseBlockEvent(event, create(event.getPlayer()), ((BlockState) holder).getBlock()));
} else if (holder instanceof Entity) {
Events.fireToCancel(event, new UseEntityEvent(event, create(event.getPlayer()), (Entity) holder));
}
}