Package mindustry.entities
Class EntityGroup<T extends mindustry.gen.Entityc>
java.lang.Object
mindustry.entities.EntityGroup<T>
- All Implemented Interfaces:
Iterable<T>
Represents a group of a certain type of entity.
-
Constructor Summary
ConstructorsConstructorDescriptionEntityGroup(Class<T> type, boolean spatial, boolean mapping) EntityGroup(Class<T> type, boolean spatial, boolean mapping, EntityIndexer indexer) -
Method Summary
Modifier and TypeMethodDescriptionvoidintarc.struct.Seq<T>static voidcheckNextId(int id) Makes sure the next ID counter is higher than this number, so future entities cannot possibly use this ID.voidclear()voidcollide()booleanarc.struct.Seq<T>copy()arc.struct.Seq<T>intvoidvoidvoidfirst()getByID(int id) index(int i) arc.struct.Seq<T>intersect(float x, float y, float width, float height) booleanvoidbooleanisEmpty()iterator()booleanstatic intnextId()voidvoidremoveByID(int id) voidremoveIndex(T type, int position) voidresize(float x, float y, float w, float h) Resizes the internal quadtree, if it is enabled.intsize()voidsort(Comparator<? super T> comp) arc.math.geom.QuadTreetree()voidupdate()voidbooleanuseTree()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
EntityGroup
-
EntityGroup
-
-
Method Details
-
nextId
public static int nextId() -
checkNextId
public static void checkNextId(int id) Makes sure the next ID counter is higher than this number, so future entities cannot possibly use this ID. -
checkIDCollisions
- Returns:
- entities with colliding IDs, or an empty array.
-
sort
-
collide
public void collide() -
updatePhysics
public void updatePhysics() -
update
public void update() -
copy
-
copy
-
each
-
each
-
draw
-
useTree
public boolean useTree() -
mappingEnabled
public boolean mappingEnabled() -
getByID
-
removeByID
public void removeByID(int id) -
intersect
-
intersect
public boolean intersect(float x, float y, float width, float height, arc.func.Boolf<? super T> out) -
intersect
-
tree
public arc.math.geom.QuadTree tree() -
resize
public void resize(float x, float y, float w, float h) Resizes the internal quadtree, if it is enabled. -
isEmpty
public boolean isEmpty() -
index
-
size
public int size() -
contains
-
count
-
add
-
addIndex
-
remove
-
removeIndex
-
clear
public void clear() -
find
-
first
-
iterator
-