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

As the title says, I am trying to detect if the player is wearing a piece of armor. This question has been asked quite frequently, but never (from what i could find) for 1.15.x

So I am trying to add effects based on what armor is being worn, but cannot figure out how to actually detect what the player is wearing.

If someone could just point me in the right direction that would be great :)

Depends on what you want to do, but you should be able to do things in onArmorTick in ur armour class

Edited by poopoodice

  • Author
1 hour ago, poopoodice said:

Depends on what you want to do, but you should be able to do things in onArmorTick in ur armour class

I've looked through the onArmorTick stuff, but can't get it to work. All the examples and tutorials I have found on it have been for older versions of Minecraft and no longer work (for me at least)

As an example for what I am trying to achieve, I need to give a player a level of haste based on how many pieces of an armor set they have equipped.

What I mean by this is that if a player has two of these pieces on, they will get 2 levels of haste. If they have three pieces, they get haste 3, etc.

The thing I am struggling to figure out is how to do the actual detection of what armor the player has equipped.

3 minutes ago, Boston54 said:

but can't get it to work

So what happened? Details!

The more details you provide, the better the chance you will receive a useful response.

"It doesn't work" doesn't tell anything about the problem whatsoever! You should always, *always* post your debug.log (preferably to an external site, such as a github gist, and link back here), as well as show your code (again, github is the *best* way to share your code, as a buildable repository. It's worth spending an hour googling git/github and how to use it, it will make a world of difference for you)

 

And if you don't feel confident with your Java skills, you should definitely do some java tutorials/practice. I would say at least a low intermediate level of skill with Java is *required* for modding, unless you wish to have a Bad Time waiting forever for answers, and being told that you need to learn Java. If you already do, then great! And if not, I'm not trying to be mean or discouraging, but it would be like trying to read a book, without knowing how to read. There's an order to these things that kinda need to be followed. :)

Make a class that extends ArmorItem
override onArmorItem to give the wearer effects
Make your armor using that class instead of ArmorItem

If it's a vanilla armor
Subscribe to PlayerTickEvent on the server side
check their armor, and give effects
 

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.