Search in sources :

Example 1 with ChatMessageEvent

use of org.terasology.engine.logic.chat.ChatMessageEvent in project Terasology by MovingBlocks.

the class WorldCommands method simulate.

@Command(shortDescription = "Random", runOnServer = true)
public String simulate(@Sender EntityRef sender) {
    EntityRef simulatedEntity = entityManager.create("engine:multiWorldSim");
    DisplayNameComponent displayNameComponent = simulatedEntity.getComponent(DisplayNameComponent.class);
    displayNameComponent.name = "I-Travel-Worlds-" + simulatedEntity.getId();
    simulatedEntity.saveComponent(displayNameComponent);
    ColorComponent colorComponent = simulatedEntity.getComponent(ColorComponent.class);
    colorComponent.color = Color.RED;
    simulatedEntity.saveComponent(colorComponent);
    sender.send(new ChatMessageEvent("yay", simulatedEntity));
    return "done";
}
Also used : DisplayNameComponent(org.terasology.engine.logic.common.DisplayNameComponent) ChatMessageEvent(org.terasology.engine.logic.chat.ChatMessageEvent) ColorComponent(org.terasology.engine.network.ColorComponent) EntityRef(org.terasology.engine.entitySystem.entity.EntityRef) Command(org.terasology.engine.logic.console.commandSystem.annotations.Command)

Aggregations

EntityRef (org.terasology.engine.entitySystem.entity.EntityRef)1 ChatMessageEvent (org.terasology.engine.logic.chat.ChatMessageEvent)1 DisplayNameComponent (org.terasology.engine.logic.common.DisplayNameComponent)1 Command (org.terasology.engine.logic.console.commandSystem.annotations.Command)1 ColorComponent (org.terasology.engine.network.ColorComponent)1