Search in sources :

Example 1 with DestroyEvent

use of org.terasology.logic.health.DestroyEvent in project Terasology by MovingBlocks.

the class SideBlockSupportRequired method checkForSupport.

@ReceiveEvent
public void checkForSupport(DelayedActionTriggeredEvent event, EntityRef entity, BlockComponent block, SideBlockSupportRequiredComponent supportRequired) {
    if (event.getActionId().equals(SUPPORT_CHECK_ACTION_ID)) {
        if (!isSufficientlySupported(block.getPosition(), null, Collections.<Vector3i, Block>emptyMap(), supportRequired)) {
            PrefabManager prefabManager = CoreRegistry.get(PrefabManager.class);
            entity.send(new DestroyEvent(entity, EntityRef.NULL, prefabManager.getPrefab("engine:supportRemovedDamage")));
        }
    }
}
Also used : DestroyEvent(org.terasology.logic.health.DestroyEvent) PrefabManager(org.terasology.entitySystem.prefab.PrefabManager) Vector3i(org.terasology.math.geom.Vector3i) Block(org.terasology.world.block.Block) ReceiveEvent(org.terasology.entitySystem.event.ReceiveEvent)

Aggregations

ReceiveEvent (org.terasology.entitySystem.event.ReceiveEvent)1 PrefabManager (org.terasology.entitySystem.prefab.PrefabManager)1 DestroyEvent (org.terasology.logic.health.DestroyEvent)1 Vector3i (org.terasology.math.geom.Vector3i)1 Block (org.terasology.world.block.Block)1