Jump to content

Recommended Posts

Posted (edited)

Hey,

So I have this armor set class and armor tick method. However, when I test for all pieces equipped the code runs 4 times. Now I fixed it by checking for one armor piece after checking for all. Nevertheless, I have a problem: whenever I take off the chestplate, the absorption amount does not decrease from what it was. When I remove all other armor pieces it does.

My Code:

[SOLVED]

 

Is there any solution? Thanks!

Edited by Differentiation
Posted
23 minutes ago, Differentiation said:

else if (this.flag == true) // doesn't reduce for chestplate :(

flag is only ever set to true for the chestplate, which when removed, this code is no longer run. Remove this conditional.

  • Like 1

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.

Posted
3 hours ago, diesieben07 said:

No, you cannot just store instance variables in Item and Block classes like that. Items and blocks are singleton-like. These variables will be shared across every occurrence of your item.

The variables act as flags for this specific class, to be used in the armortick method. Hence they are also private.

3 hours ago, diesieben07 said:

Or for f***s sake. Particles are not even server side. Don't tell me you are sending a packet to the server only to then send one back to the client. Please no.

Oh, then do you have a better solution to send particles for all the players to see? 'Cause this is the one I got, and I only send 1 packet for all the particles...

Posted
23 minutes ago, Differentiation said:

The variables act as flags for this specific class, to be used in the armortick method. Hence they are also private.

And common to all players.

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.

Posted

Ok, so, 1, that flag is literally useless

And 2, there's this thing called capabilities...

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.