HI EVERYBODY(guy from simpsons movie),I've tried to use this code to get my item to spawn an item on the ground(well actually it spawns it right on top of the player's head). And the problem is that it spawns the item, it falls to the ground and can be picked up, along with some other entity that is the exact same as what the item looks like on the ground but it can't be picked up.
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ par3EntityPlayer.dropItem(362, 1); return par1ItemStack;}
Also on a side note, how would one go about entering the item id of an item that has many variations, i.e the saplings that have ids like 6:1, 6:2. These item ids go where '362' goes in the above code but since it is an integer, I cant put a colon and neither can I put a comma because it the function only has two variables.Thanks for any help at all, even if its just a step towards solving my problem. Your response is greatly appreciated and thanks for reading.
EDIT: I would also like to know how to add default enchants to an item, i.e when I craft them, they already have enchants on them much like the orespawn mod weapons e.g Ultimate Sword. Thanks!
Well, I don't know about your metadata problem, since I've personally never used that method before, but I should be able to help you with your entity spawning problem. You're currently spawning a entity on both the client and server sides of Minecraft, but since the server-side keeps track of all entities' info (position, data, etc.), the entity that spawned on the client-side can't be picked up. Try adding this into your onItemRightClick() method:
Well, I don't know about your metadata problem, since I've personally never used that method before, but I should be able to help you with your entity spawning problem. You're currently spawning a entity on both the client and server sides of Minecraft, but since the server-side keeps track of all entities' info (position, data, etc.), the entity that spawned on the client-side can't be picked up. Try adding this into your onItemRightClick() method:
Thanks for searching but I actually saw that before I read your post and it wasn't working for some reason so I resorted to using the onUpdate method. Thanks anyways!
HI EVERYBODY(guy from simpsons movie),I've tried to use this code to get my item to spawn an item on the ground(well actually it spawns it right on top of the player's head). And the problem is that it spawns the item, it falls to the ground and can be picked up, along with some other entity that is the exact same as what the item looks like on the ground but it can't be picked up.Also on a side note, how would one go about entering the item id of an item that has many variations, i.e the saplings that have ids like 6:1, 6:2. These item ids go where '362' goes in the above code but since it is an integer, I cant put a colon and neither can I put a comma because it the function only has two variables.Thanks for any help at all, even if its just a step towards solving my problem. Your response is greatly appreciated and thanks for reading.
EDIT: I would also like to know how to add default enchants to an item, i.e when I craft them, they already have enchants on them much like the orespawn mod weapons e.g Ultimate Sword. Thanks!
This should stop the entity from being spawned twice. Hope this helps :)!
Mapping and Modding rules | Global rules
Wow that worked! Thanks man! I think I understand it now.
Hope I see you around the modding community more often :P.
Mapping and Modding rules | Global rules
Thanks for searching but I actually saw that before I read your post and it wasn't working for some reason so I resorted to using the onUpdate method. Thanks anyways!