Jump to content

Spawning EntityItem


ZL123

Recommended Posts

Hello! Do you know how to spawn an EntityItem? Basically, I have this Scepter, and I want so that when I right-click it on a diamond block the diamond block disappears and transforms into another Scepter. Sort of like how you make a Thaumonomicon in Thaumcraft.

 

Thanks a lot!

Thanks...!

Link to comment
Share on other sites

it's just my helper class, you'll be fine with this piece of code to make spawning working:

        Entity entity = new EntityItem(world, x, y, z, itemStackToSpawn);
        world.spawnEntityInWorld(entity);

 

to handle right click you'll override in the scepter method

onItemUse

. from its parameters you have all the info needed for spawning an item into the world (don't forget to NOT spawn item on a client side), detecting if it's a diamond block (world.getBlockID) and destroying that block (world.setBlock, block #0 is air ~ nothing).

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.