Jump to content

Recommended Posts

Posted

I'd like to know how to drop an item into the world at a certain spot that has a damage value

 

The item i am trying to drop is a spawn egg

the code is being fired in the EntityInteractEvent handler

 

I have figured out how to make an item drop, and I know how to make an itemstack that has a damage value but I don't know of any way to drop an itemstack into the world at a desired location

 

ok got it working with the following, but if someone knows of a better way please do post

 

 

public static void DropItem(ItemStack i, double posX, double posY, double posZ, World w){

if(i.stackSize>0 && i.getItem() != null){

EntityItem ei = new EntityItem(w,posX,posY,posZ,i);

ei.delayBeforeCanPickup=10;

w.spawnEntityInWorld(ei);

}

 

 

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.