Class Entity
java.lang.Object
dev.engine.core.scene.Entity
An entity in the scene — just an ID with component storage.
var entity = scene.createEntity(); entity.add(Transform.at(1, 0, 0)); entity.add(PrimitiveMeshes.cube()); // MeshData IS the component entity.add(myMaterial); // Material IS the component entity.get(Transform.class); // → Transform entity.has(MeshData.class); // → true entity.get(MaterialData.class).shaderHint(); // → "PBR"
-
Method Summary
Modifier and TypeMethodDescriptionadd(T component) Adds or replaces a component.voiddestroy()boolean<T extends Component>
TGets a component by slot type, or null.handle()booleanChecks if entity has a component in the given slot.inthashCode()Removes a component by slot type.toString()update(Class<T> type, UnaryOperator<T> fn) Updates a component in place: gets current, applies function, re-adds result.
-
Method Details
-
handle
-
add
Adds or replaces a component. UsesComponent.slotType()as the key — families like MaterialData share one slot. -
get
-
has
-
remove
-
update
Updates a component in place: gets current, applies function, re-adds result. Emits a transaction for the change.entity.update(Transform.class, t -> t.withPosition(new Vec3(1, 0, 0))); entity.update(Transform.class, t -> t.withRotation(myQuat));
-
setParent
-
addChild
-
destroy
public void destroy() -
equals
-
hashCode
-
toString
-