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.

Featured Replies

Posted

Hello everyone, so currently my onArmorTick as of now works but not the way I want, basically it is on a constant, for example if I have absorption, lets say it is on always 0:10 seconds and when I do take damage, instantly the absorption regens (basically invincible). Here is my code:
ย 

      @Override
      public void onArmorTick(ItemStack stack, World world, PlayerEntity player)
      {
          if(!world.isClientSide)
          {
              boolean hasPlayerAbsorptionEffect = !Objects.equals(player.getEffect(Effects.ABSORPTION), null);
                  if(player.getItemBySlot(EquipmentSlotType.HEAD).getItem() == ModItems.OCLUTRIUM_HELMET.get()
                                         && player.getItemBySlot(EquipmentSlotType.CHEST).getItem() == ModItems.OCLUTRIUM_CHESTPLATE.get() &&
                          player.getItemBySlot(EquipmentSlotType.LEGS).getItem() == ModItems.OCLUTRIUM_LEGGINGS.get() &&
                          player.getItemBySlot(EquipmentSlotType.FEET).getItem() == ModItems.OCLUTRIUM_BOOTS.get()
                                 )
                      player.addEffect(new EffectInstance(Effects.ABSORPTION, 200, 2));
                  super.onArmorTick(stack, world, player);
          }
      }

Cheers!

Edited by Feroov

your code works how it should, since ArmorItem#onArmorTick is called every tick (20 times in a second)
what did you try to achieve?

  • Author
7 minutes ago, Luis_ST said:

your code works how it should, since ArmorItem#onArmorTick is called every tick (20 times in a second)
what did you try to achieve?

Yes everything works it's just that if i have absorption, it will insta heal the player back, which is game breaking you become lets say invincible, I wanted to make it in a way when you take damage, you still have the absorption effect but empty hearts if that makes sense, lets say you ate a golden apple and took damage, you know how the hearts still stay but blacked out, same logic here how I want hope that makes sense

again it works how it should, the absorption hearts are temporary, if the heart is "empty" it will be removed instantly

  • Author
1 minute ago, Luis_ST said:

again it works how it should, the absorption hearts are temporary, if the heart is "empty" it will be removed instantly

Ok then fair enough, but still thank you so much

23 hours ago, Feroov said:
Objects.equals(

The fuck? Why not just compare the return value to something useful? Like, I don't know, getEffect() == null?

23 hours ago, Feroov said:
boolean hasPlayerAbsorptionEffect

Cool you stored whether or not the player has the absorption effect in a local variable.

Which you then never use.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.ย  If you think this is the case, JUST REPORT ME.ย  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

ย 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

ย 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.