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.

w1ll0311

Members
  • Joined

  • Last visited

  1. Ohhhh, okay ! I thought by cancelling the event, it would stop the whole thing, damage effect and all. Thank you for your reply ^^
  2. w1ll0311 joined the community
  3. Hello ! I'm trying to add a Water Resistance effect to the game. But, I must be missing something. I'm using an event handler (LivingHurtEntity) to check if the damage source is DROWN and that the entity's air supply is higher than 0 (I just want to protect against water damage, but can still drown if they run out of oxygen). Then, checks if the entity has the water resistance effect. If the entity does have it, I cancel the event. I've tested this by summoning an enderman, giving it the enchantment, then pushing/dropping him into water. I've checked, the event does get cancelled, but the enderman still takes damage on screen (turns red and teleports away). I was just hoping somebody might have an idea of where I'm going wrong, if I should be using a different event or doing something else entirely. Thank you for your time and help, it is very much appreciated. And here is my code. First is the event handler, then it's the water_resistance effect. @Mod.EventBusSubscriber(modid = Extras.MOD_ID) public class ModEvents { @SubscribeEvent public static void waterResistanceEffect(LivingHurtEvent event){ Extras.LOGGER.debug("Check water dmg"); Extras.LOGGER.debug("Entity: " + event.getEntity()); Extras.LOGGER.debug("DamageSource: " + event.getSource()); Extras.LOGGER.debug("AirSupply: " + event.getEntity().getAirSupply()); if(event.getSource() == DamageSource.DROWN && event.getEntity().getAirSupply() > 0){ Extras.LOGGER.debug("Entity is getting water damage"); if(event.getEntity().hasEffect(ModMobEffects.WATER_RESISTANCE.get())){ Extras.LOGGER.debug("Cancel event"); event.setCanceled(true); } } } } public class ModEffect extends MobEffect { public ModEffect(MobEffectCategory category, int color) { super(category, color); } @Override public void applyEffectTick(LivingEntity p_19467_, int p_19468_) { super.applyEffectTick(p_19467_, p_19468_); } @Override public boolean isDurationEffectTick(int p_19455_, int p_19456_) { return true; } }

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.