public override void deactivateForStorage(EntityRef entity) { if (entity.exists()) { int entityId = entity.Id; if (eventSystem != null) { eventSystem.send(entity, BeforeDeactivateComponent.newInstance()); } loadedIds.remove(entityId); store.remove(entityId); } }
public override EntityRef copy(EntityRef other) { if (!other.exists()) { return(EntityRef.NULL); } IList <Component> newEntityComponents = Lists.newArrayList(); foreach (Component c in other.iterateComponents()) { newEntityComponents.Add(componentLibrary.copy(c)); } return(create(newEntityComponents)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private void addOwnedEntitiesFor(org.terasology.entitySystem.Component comp, org.terasology.entitySystem.metadata.ComponentMetadata<?> componentMetadata, java.util.Collection<org.terasology.entitySystem.entity.EntityRef> outEntityList) private void addOwnedEntitiesFor <T1>(Component comp, ComponentMetadata <T1> componentMetadata, ICollection <EntityRef> outEntityList) { foreach (ComponentFieldMetadata field in componentMetadata.Fields) { if (field.OwnedReference) { object value = field.getValue(comp); if (value is ICollection) { foreach (EntityRef @ref in ((ICollection <EntityRef>)value)) { if (@ref.exists()) { outEntityList.Add(@ref); } } } else if (value is IDictionary) { foreach (EntityRef @ref in ((IDictionary <object, EntityRef>)value).Values) { if (@ref.exists()) { outEntityList.Add(@ref); } } } else if (value is EntityRef) { EntityRef @ref = (EntityRef)value; if (@ref.exists()) { outEntityList.Add(@ref); } } } } }