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()voidfixedUpdate(int targetFps) CallsfixedUpdate(int, int)with a maximum of 10 updates per frame.voidfixedUpdate(int targetUps, int maxUpdatesPerFrame) Updates this entity group at a fixed rate and delta time, regardless of framerate.getByID(int id) index(int i) arc.struct.Seq<T>intersect(float x, float y, float width, float height) booleanvoidbooleanisEmpty()iterator()booleanstatic intnextId()arc.struct.Seq<T>rawSeq()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) toString()arc.math.geom.QuadTreetree()voidupdate()voidvoidbooleanuseTree()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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() -
update
-
fixedUpdate
public void fixedUpdate(int targetFps) CallsfixedUpdate(int, int)with a maximum of 10 updates per frame. -
fixedUpdate
public void fixedUpdate(int targetUps, int maxUpdatesPerFrame) Updates this entity group at a fixed rate and delta time, regardless of framerate. If updates per frame exceed , they will be skipped - visually, the game will look like it is slowing down. For example, a value of 60 targetUps and 10 maxUpdatesPerFrame will mean that the game only starts slowing down below (60 / 10) = 6 FPS. -
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() -
rawSeq
-
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
-
toString
-