Solved Ender Crystal Collision?

Discussion in 'Plugin Development' started by xxHell_Killerxx, Jul 17, 2015.

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

    xxHell_Killerxx

    Is it possible to detect collision between players and ender crystals? What I'm trying to do is to give players items when they collide into the crystals. I've think of getting nearby entities on player move, but I dont think that would be efficient.

    Thx :)
     
  2. Offline

    AcePilot10

    Check if the location of the player is the same as the location of the crystal?
     
  3. Offline

    xxHell_Killerxx

    That would be possible, but would it be laggy if i have 30 crystals and the server has to check it every time a player move?
     
  4. Offline

    Zombie_Striker

    @xxHell_Killerxx
    The lag would be quite minimal if you know what you're doing. And you don't need to use onPlayerMoveEvent, because it will only fire if the player looks around or moves. If they stay still, it won't work. Instead, use a runnable where after ___ seconds (I suggest 3*20L for naturally laggy servers)
     
  5. Offline

    xxHell_Killerxx

    Thx for your suggestion, however, players will run pass the crystals quickly, not sure if checking every 3 seconds will work. But i will try if using player move event is laggy or not.
     
  6. Offline

    xxHell_Killerxx

    Although it's not accurate (block location is not completely the same as the entity location), but i will try to fix that later.
    Thanks so much for your help :). Solved.
     
    Last edited: Jul 18, 2015
  7. Offline

    _Filip

    Lol por favor, please think, why wouldn't you do a check on PlayerMoveEvent to see if the player moved a full block, then check if a registry (hashset) containing elder crystal entity locations .contains() player.getBlockLocation()
     
  8. Offline

    xxHell_Killerxx

    Thx :3
     
Thread Status:
Not open for further replies.

Share This Page