Hi,
I am still new to minecraft modding, and am at the beginner level. I am right now trying to figure out how to test if the player has been attacked.
I am trying to implement a parry on a sword. Right now I am just using default shield code, but when their block is active, I want to test if the player has been attacked, and if they have, then I want to reset their active hand (Lower their shield), and give the sword a short cooldown similar to a shield, before they can parry again. I have already figured out how to disable their block, and how to set the cooldown, all I need now is to fire the code when they have been attacked.
Here is my current code:
@Nonnull
@Override
public EnumAction getItemUseAction(ItemStack stack) {
return EnumAction.BLOCK;
}
public int getMaxItemUseDuration(ItemStack stack)
{
return 10000;
}
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
playerIn.setActiveHand(handIn);
//Code to disable parry with cooldown, works.
//playerIn.getCooldownTracker().setCooldown(playerIn.getActiveItemStack().getItem(), 100);
//playerIn.resetActiveHand();
//playerIn.world.setEntityState(playerIn, (byte)30);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
}
I am an experienced python user, and am what you might call conversational with java, but am still very new to minecraft modding.
Thanks!