Chicken Wing Posted September 11, 2015 Posted September 11, 2015 (edited) How do I check if there is an entity at a certain position? EDIT: I mean get a reference to an entity using a position oopsy Edited September 11, 2015 by Chicken Wing
Precise Posted September 11, 2015 Posted September 11, 2015 How do I check if there is an entity at a certain position? #ENTITY HERE#getPosition().equals(the position); 1
Chicken Wing Posted September 11, 2015 Author Posted September 11, 2015 #ENTITY HERE#getPosition().equals(the position); Is there a way to get a reference to an entity other than using objects.closest()?
Flamezzz Posted September 11, 2015 Posted September 11, 2015 EntityAPI.get(x,y) returns a list of entities on pos x,y,z with z = myPlayer.getZ()!EntityAPI.get(x,y).isEmpty() --> there is something at position x,yEntityAPI is one of npcs, objects, grounditems
Chicken Wing Posted September 11, 2015 Author Posted September 11, 2015 (edited) EntityAPI.get(x,y) returns a list of entities on pos x,y,z with z = myPlayer.getZ() !EntityAPI.get(x,y).isEmpty() --> there is something at position x,y EntityAPI is one of npcs, objects, grounditems This is exactly what I was looking for, thank you EDIT: EntityAPI is an abstract class? So I have to make those methods myself? I think I've found a solution to my problem so its ok now anyway. Edited September 11, 2015 by Chicken Wing
Flamezzz Posted September 11, 2015 Posted September 11, 2015 This is exactly what I was looking for, thank you EDIT: EntityAPI is an abstract class? So I have to make those methods myself? I think I've found a solution to my problem so its ok now anyway. Yes it is an abstract class, subclassed by concrete classes Objects, NPCS and GroundItems. So you could do objects.get(x,y) or npcs.get(x,y) or groundItems.get(x,y)
Chicken Wing Posted September 11, 2015 Author Posted September 11, 2015 Yes it is an abstract class, subclassed by concrete classes Objects, NPCS and GroundItems. So you could do objects.get(x,y) or npcs.get(x,y) or groundItems.get(x,y) Oh I didn't realise it was the parent class (/facepalm), TY!