Posted August 18, 201312 yr This is my first Forge mod, basically it lets you craft ender eyes together with ores into these "Eyes of Prospecting" that when you right click, they fly towards the ore you crafted it with rather than a stronghold. I copied a lot of the code over from ItemEnderEye & EntityEnderEye since I wouldn't know how to do a lot of it. Everything works as expected, except when you right click, the onItemRightClick method is called twice. This creates two Eyes of Prospecting, where one eye just floats there and never goes away and the other eye acts as expected. However, this only happens sometimes. ItemEyeOfProspecting.java: http://paste.minecraftforge.net/view/44e4c778 In the Item file, if you remove lines 74-77, it happens every time, so I'm guessing that's the bit of code that ItemEnderEye uses to prevent this happening, but it doesn't seem to be working for me. EntityEyeOfProspecting.java: http://paste.minecraftforge.net/view/2112fa4c EnderProspecting.java (main mod class): http://paste.minecraftforge.net/view/022bc3cf Any help is appreciated, thanks in advance.
August 18, 201312 yr Always check for server side before spawning something. if(!world.isRemote) { world.spawnEntityInWorld(... }
August 18, 201312 yr It probably is being excecuted once on the server and once on the client, just like onBlockActivated does. Try checking for !world.isRemote : if its true (eg running on the server), run you code. I like to make mods, just like you. Here's one worth checking out
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.