Seeing if a minecart is in relative location of block place location

Discussion in 'Spigot Plugin Development' started by Fahlur, Jul 13, 2015.

  1. I hope I explain this well enough for anyone reading.

    I am having troubles figuring out how to check if an empty mine cart is in relative location of a BlockPlaceEvent.

    I have it so if you place a redstone block it would check, okay its a redstone block, is there a <specified Block> below it? If so continue. Is there an empty mine cart under this <specified Block>? If so then continue. Unfortunately I haven't quite figured out how to detect/check for the empty mine cart. If someone can lead me in the right direction that would be great!
     
  2. You can use World#getEntitesByClass to get the minecarts in the world and iterate over them to see if any of them are located within that specific block.
     
  3. Thank you much St3venAU! Got it working :)