Skip to content

Commit

Permalink
Fix equip from use behavior, closes #332
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIllusiveC4 committed Aug 23, 2023
1 parent a535fc1 commit 00aa122
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,18 @@ public void curioRightClick(PlayerInteractEvent.RightClickItem evt) {
evt.setCanceled(true);
return;
} else if (firstSlot == null) {
firstSlot = new Tuple<>(stackHandler, slotContext);
CurioEquipEvent unequipEvent = new CurioEquipEvent(present, slotContext);
MinecraftForge.EVENT_BUS.post(unequipEvent);
result = unequipEvent.getResult();

if (result == Event.Result.DENY) {
continue;
}

if (result == Event.Result.ALLOW || CuriosApi.getCuriosHelper().getCurio(present)
.map(c -> c.canUnequip(slotContext)).orElse(true)) {
firstSlot = new Tuple<>(stackHandler, slotContext);
}
}
}
}
Expand Down

0 comments on commit 00aa122

Please sign in to comment.