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.

oconn399

Members
  • Joined

  • Last visited

  1. Turns out, both these things were necessary to fix the problem. I created a handler for LivingFallEvent, gave it access to some data from the client-side gliding checks I was performing in the onUpdate, and made sure it executed on the server side. No more hurt animation or sound!
  2. For context, I am trying to create an item that will allow the player to glide when held, and I want fall distance to reset to 0 if the player is gliding. I don't want to just cancel all fall damage because I will eventually create either a magic or stamina bar for the player which depletes as the player is gliding. If the bar reaches zero, the player should not be able to glide, and fall from that height. To accomplish this, I added code to the item's onUpdate to check if the item is equipped and space is held (so the item can act like a parachute), and to modify fall distance appropriately. I tried explicitly setting EntityPlayer's fallDistance property, but that didn't seem to do anything, so I instead saved the player's Y coordinate as lastGlidedYCoord, and created a handler for LivingFallEvent, which set the event.distance to be the difference between player.posY and lastGlidedYCoord. Still no luck. Finally, I created a LivingHurtEvent handler and, for DamageSource.fall, explicitly computed fallDamage based on my fallDistance, and set event.ammount (actual spelling, I verified) to the value, and that worked. However, even if the player glides all the way to the ground and takes no damage, the hurt sound and animation still play. To try to resolve this, I added a check in the LivingHurtEvent handler to see if the fallDamage was less than .5 hearts. If so, I canceled the event. No change. My current handler method looks like this: // this boolean tracks if the player has glided since jumping // so that don't recompute every time the player takes fall damage boolean alterFall; double lastGlidedYCoord; @SubscribeEvent public void onLivingHurtEvent(LivingHurtEvent event) { if (alterFall && event.entity instanceof EntityPlayer && event.source == DamageSource.fall) { EntityPlayer player = (EntityPlayer)event.entity; double recompFallDamage = Math.floor( (lastGlidedYCoord- player.posY - 3) / 2 ); if (recompFallDamage < 1) { event.setCanceled(true); } else { event.ammount = (float) recompFallDamage; } alterFall = false; } } Any help getting my mod to work as desired would be much appreciated, 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.