Hi there,
This is my first time posting on these forums, so apologies in advance if I miss anything.
I am attempting to make a dagger weapon in a new mod I am making that will have the ability to block melee attacks, but not projectiles. In my attempts to do this, I've ran into a few issues. If I make use of the EnumAction.BLOCK in the method below, it will do the blocking animation I have specified, but it will block projectiles as well rather than using the custom behaviour I have put in a LivingAttackEvent method, which ignores projectiles.
@Override
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.BLOCK;
}
As an alternative, I made a custom EnumAction known as MELEE_BLOCK using the method EnumHelper.addAction(), and by doing that, while it makes the blocking behaviour work properly, it doesn't make the weapon appear to visually block the attack, both in first and third person. In first person, the weapon disappears entirely, while in third person, the player just wields it as normal.
Here's the Item class, and the LivingAttackEvent method that is called for reference. The following code is based on my alternative custom EnumAction solution I have taken.
ItemParryingDagger:
Snippet of my mod's EventHandler class:
Is there any way to use the EnumAction.BLOCK action to make the weapon only block specific types of damage sources? Or if there is not, how would I go about adding the player animations for blocking for both first- and third-person to account for my custom EnumAction?
Any help would be greatly appreciated.