Jump to content

Recommended Posts

Posted
Quote

    at io.github.withonetee.entities.DreamEntity.onLivingFall(DreamEntity.java:148) ~[?:?] {re:classloading}

Complain to the mod author.

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
18 minutes ago, diesieben07 said:
  1. Please learn what static means. None of those things should be static.
  2. Do not re-use ItemStack instances.
  3. Do not cache things like Blocks.WATER in your own fields.

That crash is impossible to get with the code you posted.

Why can't I re-use ItemStack instances?

Posted
59 minutes ago, diesieben07 said:

Because they hold state, like size, damage, etc. This will all be shared.

I'm confused 

What does that mean?

Posted
2 minutes ago, diesieben07 said:

You create an ItemStack and store it in a static field.

You then do something with that stack, e.g. give it to the player. This will cause this ItemStack reference to get modified (if the player splits the stack in their inventory, for example). Now your static field holds the same ItemStack instance still, but it has changed (now has a different count).

You now give this stack to a different player. The first player then changes the stack in their inventory and magically the stack in the 2nd player's inventory changes also.

oh right

How would I fix this?

 

Also I'm trying to add mlg features to the entity.. how would I do that?

 

Thank you!

Posted
Just now, diesieben07 said:

Don't re-use Itemstacks.

 

What?

Okay

 

Basically if an entity is falling, the entity would place a water bucket below them to counteract the fall damage

 

Posted
1 minute ago, diesieben07 said:

Probably need to check the Y motion for a negative value and check if there is ground below.

Uhm yes, I have problems though

 

1. How do I check if there's ground below an entity?

2. I'm registering the event handler in another class, so how would I set the item of the entity in the other class?

 

 

Posted
44 minutes ago, hypov said:

Uhm yes, I have problems though

 

1. How do I check if there's ground below an entity?

world#getBlockState

 

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.