NMS Entity collision help

Discussion in 'Plugin Development' started by CullanP, Feb 2, 2015.

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

    CullanP

    So with the update to 1.8 the Height float from the entity class was removed and with that being said I have no idea what to use in place of it. I'm trying to make it so when someone shoots an arrow it will pass through the other player

    Code:
    Class c = Class.forName(currentVersion + ".Entity");
    Field field = c.getDeclaredField("width");
    Field field2 = c.getDeclaredField("length");
    field.setFloat(handle.invoke(p), (float) width);
    field2.setFloat(handle.invoke(p), (float) length);
     
    Last edited: Feb 5, 2015
  2. Offline

    ReadySetPawn

    What's your overall goal? Like what plugin are you coding this for?
     
  3. Offline

    CullanP

    I'm trying to make it so when someone shoots an arrow it will pass through the other player.
     
    Last edited: Feb 5, 2015
  4. Offline

    ReadySetPawn

    Isn't that the default behavior of an arrow?
     
    Konato_K likes this.
  5. Offline

    CullanP

    Oops lol. Wrong wording, I want arrows TO pass through players. I'm not sure what to use from the entity class, but there's definitely a method/float lying around in there.
     
  6. Offline

    ReadySetPawn

    When the player shoots the arrow, remove it and replace it with a custom arrow and then set the custom arrow's velocity to the original arrow's velocity.

    For the custom arrow, override it's collide(Entity entity) method and cancel the collision by returning the method after damaging the entity given in the parameter.
     
  7. Offline

    CullanP

    I could do that, but it wouldn't work well with other methods. I have custom abilities in this plugin. I need a working float/method from the entity class (or any class) so I can update the previous method of cancelling arrows when players are invisible. Before the height float was removed, The plugin was able to set height,length and width to 0 resulting in the arrow to passthrough them. I'm using libshungergames btw, so I'm trying to fix spectators in 1.8 from being hit with arrows. I've updated the plugins reflectionmanager entirely, but can't find a solution to this one issue.
     
  8. Offline

    ReadySetPawn

    Maybe you can add a custom event that fires when an arrow hits an entity. It'll make the coding a bit easier and cleaner.
     
  9. Offline

    CullanP

    I wish height float wasn't removed :(, Oddly enough, setting length and width to 0 does basically nothing
     
  10. Offline

    ReadySetPawn

    Maybe you can shrink the bounding box? I don't know, I've never messed around with bounding boxes.
     
  11. Offline

    xTigerRebornx

  12. Offline

    CullanP

    I'm going to try editing the bounding box and see where that gets me, I'll update this thread after trying
     
Thread Status:
Not open for further replies.

Share This Page