Solved Hit entity through the grass

Discussion in 'Spigot Plugin Development' started by chunza2542, Jun 1, 2017.

  1. I want to make some plugin that can hit entity like chicken or whatever through the grass. Could you give me some suggestion or idea to make it happen.
    Thank sorry for my English.
     
  2. I'll be honest with you, I don't think this is possible. The best way I could think of from off the top of my head would be to get the nearest entity in the direction that the player's facing when they hit. Sorry. :p
     
  3. Simplest way would be use get a BlockIterator from the players eye location and direction and check each block for an entity, for as far as you want to check (can be done with bukkit api).

    More accurate way would be you Ray trace the direction from eye location and check for first entity collision (requires nms).
     
    • Like Like x 1
  4. I think this could be possible, when you hit the grass, check if there's an entity's hitbox overlapping the amount of the player's reach (I think like 4 or 5 blocks) away from the direction they are looking. If the entity is close enough, do the damage that would have occurred.
     
    • Like Like x 1
    • Agree Agree x 1
    • Informative Informative x 1
  5. Wow! thank you. I find the way to do it!