Alanvcd Posted February 11, 2013 Posted February 11, 2013 Hi, I need to know how to make an item play a song with noteblock sounds, when you use it (Right click). I also need to know how to make it select a song from a GUI, opened by shift+right clicking with the item. Could anyone help me please? Quote The flying banana ate my dog.
mnn Posted February 11, 2013 Posted February 11, 2013 Hi, I need to know how to make an item play a song with noteblock sounds, when you use it (Right click). playing one note: BlockNote.java, method "onBlockEventReceived". so something like par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "note.harp", 3.0F, var7); where par2-par4 you would use coordinates of a player (posX..posZ). when item is right-clicked method "onItemRightClick" is triggered, there will be probably part of your code. test for shift - "player.isSneaking()". the music playing would be probably handled in tick handler (of a server?), where it would remember how much ticks passed from start of a song and when it's next note's turn it would call playSoundEffect on a position of a saved player (!more players can play a song at the same time!). [basic item creation: http://www.minecraftforge.net/wiki/Basic_Items] I also need to know how to make it select a song from a GUI, opened by shift+right clicking with the item. you'll need to learn how to create GUI and how to use custom packets to keep it in sync with server: http://www.minecraftforge.net/wiki/Containers_and_GUIs http://www.minecraftforge.net/wiki/Packet_Handling selected song would be probably saved in ItemStack or just in item damage. this text may not be complete/exact, but it should show you a possible way of doing it (I hope ). Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
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.