Annnd, back again with an Item velocity question.

Discussion in 'Plugin Development' started by dxwarlock, Jun 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    dxwarlock

    Im attempting to spawn an item on block break to make wheat have a chance to double drop at certain times of the day..

    Ive gotten all that worked out, the one thing I wanted to add was some flair to the wheat. but cant seem to get it working once I drop the item.

    instead of it just dropping boringly down like the other wheat, give it a visual cue you got extra drops, having it 'pop' up using a low velocity setting on the Y axis 2-3 blocks..

    but it seems for the life of me I cant figure out how to apply a velocity to an Item or ItemStack.
    No matter what I try I get "velocity is undefined for object Item/ItemStack.

    anyone know how this could be done?
     
  2. Offline

    Njol

    item.setVelocity()?
     
  3. Offline

    dxwarlock

    I tried that by dropping them item, assigned the Item on the ground to "item" and I get:
    "The method setVelocity is undefined for the type Item"
     
  4. Offline

    Njol

    I guess you're importing net.minecraft.server.Item instead of org.bukkit.entity.Item?
     
  5. Offline

    dxwarlock

    ahhh....yes I am!
    "import net.minecraft.server.Item;"

    sometimes I want to hit myself in the face with a hammer for missing the simple things...

    perhaps I was wrong..well on the import type I know i was..
    but don't think I'm getting the item to spawn correctly for use with vel...

    I resorted to just dropping it with
    "b.getWorld().dropItem(loc, new ItemStack(Material.WHEAT, 1));'
    to get it to actually drop all the time

    but then I cant call that with set velocity.
    How would I define 'wheat' as an item, drop it, AND add velocity it?

    cant seem to find an example of the right way to define a 'Item item = (something);"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  6. I think its Item item = b.getWorld().dropItem(loc, new ItemStack(Material.WHEAT, 1)); because that sounds logical to my
     
  7. Offline

    dxwarlock

    Thanks again ferry!
    I'm going to have to start paying you a salary I think, you spend 1/2 your day replying to my inane questions on here :)

    edit: that works perfectly! with randoms for vel it looks like the normal wheat drop but with a bit more "omph" to it shooting out.
     
Thread Status:
Not open for further replies.

Share This Page