/** * This component is added by the authority to temporary block entities so that they can persist for a bit while the block is being damaged. */ @ForceBlockActive public class BlockDamagedComponent implements Component { }
/** * @param uri The uri to identify the component with. * @param type The type to create the metadata for * @param factory A reflection library to provide class construction and field get/set functionality * @param copyStrategies A copy strategy library * @throws NoSuchMethodException If the component has no default constructor */ public ComponentMetadata(SimpleUri uri, Class<T> type, ReflectFactory factory, CopyStrategyLibrary copyStrategies) throws NoSuchMethodException { super(uri, type, factory, copyStrategies, Predicates.<Field>alwaysTrue()); replicated = type.getAnnotation(Replicate.class) != null; blockLifecycleEventsRequired = type.getAnnotation(RequiresBlockLifecycleEvents.class) != null; ForceBlockActive forceBlockActiveAnnotation = type.getAnnotation(ForceBlockActive.class); if (forceBlockActiveAnnotation != null) { forceBlockActive = true; retainUnalteredOnBlockChange = forceBlockActiveAnnotation.retainUnalteredOnBlockChange(); } for (ComponentFieldMetadata<T, ?> field : getFields()) { if (field.isReplicated()) { replicated = true; if (field.getReplicationInfo().value().isReplicateFromOwner()) { replicatedFromOwner = true; } } if (field.isOwnedReference()) { referenceOwner = true; } } annotations = Lists.newArrayList(type.getAnnotations()); }
/** */ @ForceBlockActive(retainUnalteredOnBlockChange = true) public class RetainedOnBlockChangeComponent implements Component { public int value; public RetainedOnBlockChangeComponent() { } public RetainedOnBlockChangeComponent(int value) { this.value = value; } }
/** */ @ForceBlockActive public class ForceBlockActiveComponent implements Component { }
@ForceBlockActive public class TimedExplosionComponent implements Component { public long fuseTimeMs; }
@ForceBlockActive public final class DelayedActionComponent implements Component { private Map<String, Long> actionIdsWakeUp = new HashMap<>();
@ForceBlockActive public final class PeriodicActionComponent implements Component { private Map<String, Long> actionIdsWakeUp = new HashMap<>();
/** */ @ForceBlockActive public class TriggerComponent implements Component { @Replicate public CollisionGroup collisionGroup = StandardCollisionGroup.SENSOR; @Replicate public List<CollisionGroup> detectGroups = Lists.<CollisionGroup>newArrayList(StandardCollisionGroup.DEFAULT); }
/** * Allows an entity to store items. * */ @ForceBlockActive public final class InventoryComponent implements Component, ReplicationCheck { public boolean privateToOwner = true; @Replicate @Owns public List<EntityRef> itemSlots = Lists.newArrayList(); public InventoryComponent() { } public InventoryComponent(int numSlots) { for (int i = 0; i < numSlots; ++i) { itemSlots.add(EntityRef.NULL); } } @Override public boolean shouldReplicate(FieldMetadata<?, ?> field, boolean initial, boolean toOwner) { return !privateToOwner || toOwner; } }
/** */ @ForceBlockActive public final class MeshComponent implements VisualComponent { @Replicate public Mesh mesh; @Replicate public Material material; // TODO: This should be a setting on the material @Replicate public boolean translucent; // Use this for the mesh to light itself. Useful for held lights where the point light is inside the mesh. @Replicate public float selfLuminance; public boolean hideFromOwner; // TODO: Some sort of Texture + Shader type? //public String material; // This should be elsewhere I think, probably in the material @Replicate public Color color = Color.WHITE; }
@ForceBlockActive public class SkeletalMeshComponent implements VisualComponent { public SkeletalMesh mesh;
@ForceBlockActive public class RigidBodyComponent implements Component { @Replicate