Skip to content

Commit

Permalink
Better right click vs food handling
Browse files Browse the repository at this point in the history
  • Loading branch information
btarg committed Dec 12, 2023
1 parent cd537e1 commit f337079
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onPlayerInteract(PlayerInteractEvent e) {
CustomItemDefinition itemDefinition = RegistryHelper.getDefinitionFromItemstack(e.getItem());
boolean noItem = itemDefinition == null;
if (noBlock && noItem) return;

e.setCancelled(true);
switch (e.getAction()) {
case RIGHT_CLICK_AIR:
if (!noItem) {
Expand All @@ -41,7 +41,6 @@ public void onPlayerInteract(PlayerInteractEvent e) {
case RIGHT_CLICK_BLOCK:
if (!noBlock) {
blockDefinition.executeEvent(EventNames.ON_RIGHT_CLICK.toString(), player);
e.setCancelled(true);
}

if (!noItem) {
Expand All @@ -68,7 +67,7 @@ public void onPlayerInteract(PlayerInteractEvent e) {
break;

default:
// Handle other cases if necessary
e.setCancelled(false);
break;
}
}
Expand Down

0 comments on commit f337079

Please sign in to comment.