Jump to content

Recommended Posts

Posted

I was wondering if it was possible to get a projectile to read NBT data from the player's currently equipped item, preferably when it is spawned.

I have had a look at a few vanilla projectiles but I couldn't see anything helpful (though it is late and I may have missed something in my fatigue), EntityPotion has a method for writing/reading entity NBT data though I am not sure how to use it to my advantage, and Google didn't turn up anything either.

Posted

Getting the thrower's held item and reading the NBT from there was what I thought I should do, but I was unsure where to put the code.

If I put it in onImpact it would create a slight bug, and I couldn't see an 'onSpawn' type event for EntityThrowable.

I have the code for handling the NBT and what to do for the result, just wondering where the most efficient place for it would be.

Would I perhaps need to get the item to write to the entityNBT in the method that spawns the entity?

Posted

To be fair, diesieben07, I am new to Minecraft modding and I still have things to learn - I am doing my best to get by, by looking for answers in vanilla code, but obviously I don't know the best methods, or even all of them.

That's why I was asking for the best way t do what I wanted to do. I am by no means an idiot just because I am uninformed, so I won't take your reaction personally. But thanks for the pointer in the right direction.

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.