bl4ckscor3 Posted August 10, 2013 Posted August 10, 2013 Hello guys! I'd like to make a new mob and I want it so that you have to put some blocks down in a specific shape and the mob spawns when placing the Pumpkin (Yes, my mob has a pumpkin as a head ). I already looked at several source codes and I searched the vanilla one for solutions but I couldn't find anything. Can you please help me out? Quote http://i.imgur.com/kPfhwnJ.png[/img] ↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑
Mew Posted August 10, 2013 Posted August 10, 2013 I believe that the code for that is in the pumpkin block. So to do what you wanted. You would need to have your block detect the shape you want via onNeighbourBlock method. Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
bl4ckscor3 Posted August 10, 2013 Author Posted August 10, 2013 Thank you so far. But how can I add my Golems to the "Awake-List" without editing BlockPumpkin.java? Quote http://i.imgur.com/kPfhwnJ.png[/img] ↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑
Mew Posted August 10, 2013 Posted August 10, 2013 "Awake-List"? What do you mean by that? Do you mean how to actually spawn it into the world? Because that's the only thing I can make out of that Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
bl4ckscor3 Posted August 10, 2013 Author Posted August 10, 2013 Exactly. Quote http://i.imgur.com/kPfhwnJ.png[/img] ↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑
Mew Posted August 11, 2013 Posted August 11, 2013 Well that is fairly easy. public void onNeighbourBlockChange(parameters....) { boolean isShape = world.getBlockID(x, y, z); // check all the blocks that you want to be in your shape. if (isShape) { EntityToSpawn entity = new EntityToSpawn(world); entity.setPosition(x, y, z); // something like that world.spawnEntity(entity); } } Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
bl4ckscor3 Posted August 11, 2013 Author Posted August 11, 2013 But that is for a custom Block - I'd like it for the vanilla pumpkin. And without editing the base class... Quote http://i.imgur.com/kPfhwnJ.png[/img] ↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑
GotoLink Posted August 11, 2013 Posted August 11, 2013 Use PlayerInteractEvent to catch the right click action. Check if player has a block in hand which is a pumpkin... Quote
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.