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.

Imagine Engine

Members
  • Joined

  • Last visited

Everything posted by Imagine Engine

  1. Hey uh.. I think I'm a bit late to the topic. The way we would wanna do this as Draco18s mentions, is to look for a reference in the game files. Now there isn't a packet-type trigger that I found, but I got the code that @NullDev was trying out to work ServerPlayer serverplayer = (ServerPlayer)player; serverplayer.awardStat(Stats.ITEM_USED.get(Items.TOTEM_OF_UNDYING), 1); CriteriaTriggers.USED_TOTEM.trigger(serverplayer, Items.TOTEM_OF_UNDYING.getDefaultInstance()); You basically just have to set the ItemStack in the trigger method to the default ItemStack of a Totem Of Undying. And then you can add the other effects if you like. ServerPlayer serverplayer = (ServerPlayer)player; serverplayer.awardStat(Stats.ITEM_USED.get(Items.TOTEM_OF_UNDYING), 1); CriteriaTriggers.USED_TOTEM.trigger(serverplayer, Items.TOTEM_OF_UNDYING.getDefaultInstance()); player.setHealth(1.0F); player.removeAllEffects(); player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); player.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); player.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); player.level.broadcastEntityEvent(player, (byte)35); EDIT: Also fun fact! You CANNOT cancel or change the LivingDeathEvent in any way, so if you are trying to replace the death event by the totem trigger then I would suggest you have a check in the LivingDamageEvent... if(player.getHealth()-event.getAmount() <= 0){ event.setCanceled(true); ServerPlayer serverplayer = (ServerPlayer)player; serverplayer.awardStat(Stats.ITEM_USED.get(Items.TOTEM_OF_UNDYING), 1); CriteriaTriggers.USED_TOTEM.trigger(serverplayer, Items.TOTEM_OF_UNDYING.getDefaultInstance()); player.setHealth(1.0F); player.removeAllEffects(); player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); player.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); player.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); player.level.broadcastEntityEvent(player, (byte)35); } ..Like so Hope this helps!

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.