Throw Stuff (MineZ)

Discussion in 'Plugin Development' started by JoeyDevs, Nov 23, 2014.

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

    JoeyDevs

    I know I can do a lot of stuff with the Fireball / Snowball class but my mind is on something else.
    In MineZ You can throw a brick but how I can make this, I tried to google and look into the javadoc that can give me notification but nothing helps.

    Does someone know how to do this?


    Like right click a brick and then you throw that.
     
  2. Offline

    Gater12

    JoeyDevs
    With ProtocolLib you can change the appearance of a snowball to a brick.
     
  3. Offline

    coasterman10

    Spawn an item drop entity, and then set its velocity to a multiple of the player's look direction. The EntityType corresponding is DROPPED_ITEM.
     
  4. Offline

    JoeyDevs


    Uhm oke Ill give it a try, I hope i can find this out also when it hits the ground it make a sound how is that done? A entityhit event or something
     
  5. Offline

    Skionz

    There is an EntityChangeBlockEvent which is called when a entity changes into a Block.
     
  6. Offline

    TGRHavoc

    I don't think that's what the OP is looking for, the EntityChangeBlockEvent is called when any Entity, excluding players, changes a block.Not when an entity hits the ground.
     
  7. Offline

    Skionz

    TGRHavoc Doesn't he want to throw a brick? Or does he mean like a brick Item and not a FallingBlock?
     
  8. Offline

    TGRHavoc

    Skionz
    I think he means the Brick item not the block ;)
     
  9. Offline

    Skionz

    TGRHavoc Oh thanks for clearing that up!
    JoeyDevs You would have to use a scheduler to constantly check the position of the Item. Basically you would save the Item to some kind of list and the scheduler would iterate through that list, check if the item is on the group, if it is remove the Item from the list and play your sound.
     
  10. Offline

    JoeyDevs


    Yeah I meant the Item brick sorry that I was not clear.

    So if Im write what I understand:

    Spawn an item drop entity, and then set its velocity to a multiple of the player's look direction. The EntityType corresponding is DROPPED_ITEM.

    Make a scheduler and a list for the item position.
    But I am not familiar with iterate and how this gonna be.

    Can you give a simple example or link me to some docs,etc
     
  11. Offline

    JordyPwner

    JoeyDevs

    this is what i used for my snowball event when hitting the ground :p (its not complete but i bet u can complete it by urself :p

    Code:java
    1. @EventHandler
    2. public void onProjectileHit(ProjectileHitEvent e) {
    3. if ((e.getEntity() instanceof Snowball)){
    4. Snowball s = (Snowball)e.getEntity();
    5. if ((s.getShooter() instanceof Player)){
    6. Player p = (Player)s.getShooter();
     
  12. Offline

    JoeyDevs


    This make it a bit more clear.
    But the real points is the iterator thing in the scheduler.
    But if I can change what you said the Snowball to a brick as example and then set the velocity that should be a bit easier.
     
  13. Offline

    JordyPwner

    JoeyDevs just look at the protocollib Api, i bet that there is your solution :p
     
  14. Offline

    JoeyDevs

    Ok Thanks! Ill take a look soon.
     
Thread Status:
Not open for further replies.

Share This Page