Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Evo_Strange

Members
  • Joined

  • Last visited

  1. Evo_Strange joined the community
  2. 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!

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.