Posted June 16, 20205 yr 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
June 16, 20205 yr Depends on what you want to do, but you should be able to do things in onArmorTick in ur armour class Edited June 16, 20205 yr by poopoodice
June 16, 20205 yr 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.
June 16, 20205 yr 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.
June 17, 20205 yr 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.