Skip to content

Commit

Permalink
check for refill when interacting with entities (e.g. feeding animals)
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
RoboMWM committed Oct 19, 2019
1 parent d0d390f commit cc05d1c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/me/ryanhamshire/AutomaticInventory/AIEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ public void onProjectileLaunch(ProjectileLaunchEvent event)
tryRefillStackInHand(player, EquipmentSlot.HAND, false);
}

@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onFeedAnimal(PlayerInteractEntityEvent event)
{
Player player = event.getPlayer();
tryRefillStackInHand(player, event.getHand(), true);
}

private void tryRefillStackInHand(Player player, EquipmentSlot slot, boolean dataValueMatters)
{
if(slot == null) return;
Expand Down

0 comments on commit cc05d1c

Please sign in to comment.