Torojima Posted April 3, 2013 Posted April 3, 2013 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 Quote running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है! http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]
Torojima Posted April 3, 2013 Author Posted April 3, 2013 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? Quote running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है! http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]
Torojima Posted April 3, 2013 Author Posted April 3, 2013 that explains that good bug tho, had me simplify my code in the process Quote running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है! http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]
Recommended Posts
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.