Ensure all interaction hooks are disabled when on cooldown
@@ -76,6 +76,7 @@ public class InteractionHandler {
return;
}
}
+ if (!player.getCooldowns().isOnCooldown(stack.getItem())) {
// actual interaction hook
ToolStack tool = ToolStack.from(stack);
Entity target = event.getTarget();
@@ -89,6 +90,7 @@ public class InteractionHandler {
}
}
}
+ }
/** Implements {@link EntityInteractionModifierHook#afterEntityUse(IToolStackView, ModifierEntry, Player, LivingEntity, InteractionHand, InteractionSource)} for chestplates */
@SubscribeEvent(priority = EventPriority.LOWEST)
@@ -96,7 +98,7 @@ public class InteractionHandler {
Player player = event.getPlayer();
if (event.getItemStack().isEmpty() && !player.isSpectator()) {
ItemStack chestplate = player.getItemBySlot(EquipmentSlot.CHEST);
- if (chestplate.is(TinkerTags.Items.INTERACTABLE_ARMOR)) {
+ if (chestplate.is(TinkerTags.Items.INTERACTABLE_ARMOR) && !player.getCooldowns().isOnCooldown(chestplate.getItem())) {
// from this point on, we are taking over interaction logic, to ensure chestplate hooks run in the right order
event.setCanceled(true);
@@ -162,7 +164,7 @@ public class InteractionHandler {
if (event.getItemStack().isEmpty() && !player.isSpectator()) {
// item must be a chestplate
ItemStack chestplate = player.getItemBySlot(EquipmentSlot.CHEST);
- if (chestplate.is(TinkerTags.Items.INTERACTABLE_ARMOR)) {
+ if (chestplate.is(TinkerTags.Items.INTERACTABLE_ARMOR) && !player.getCooldowns().isOnCooldown(chestplate.getItem())) {
// no turning back, from this point we are fully in charge of interaction logic (since we need to ensure order of the hooks)
// begin interaction
