Jump to content

Recommended Posts

Posted

my mod is adding a plant. Plant-able from seeds and growing in a few steps from stem to the grown plant. For that I have added an event listener for the BonemealEvent and have it trigger the growing and decreasing of the current itemStack. The growing of the plant is working as before, but the decreasing of the current itemStack does not.

 

When asking the entityPlayer of the BonemealEvent for it's current item stack(1) the itemStack object is null. Even tho, the active item (the item visible in hand) is a stack of bonemeal.

 

Now I know, the behaviour of bonemeal has changed in 1.5, what I don't know is exactly how and how I get the bonemeal to be used ...

 

Edit:

even the EntityPlayer is very odd ... when I ask it for it's username I will receive "[Minecraft]" instead of the expected username ... is there a tutorial somewhere for bonemeal use in 1.5 already?

 

---

1) both event.entityPlayer.inventory.getCurrentItem() as event.entityPlayer.getCurrentEquippedItem() have the same outcome

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Posted
Don't decrease the stack size yourself. If trigger growing, call event.setResult(Result.ALLOWED). That will decrease the stack size.

 

thank you :) removed everything there was before for decreasing the stack size and added the above mentioned line after the fertilizing has taken place.

Now everything works perfectly, even with the green sparkles included :)

 

now rather unimportant for this problem, but still interesting:

why is the entityPlayer field of the event not pointing towards the player in question?

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.