From beb2e4aa52b8206366dd28f68f942a386c755554 Mon Sep 17 00:00:00 2001 From: Nail Khanipov Date: Tue, 7 Dec 2021 22:35:22 +0300 Subject: [PATCH] feat(gestaltv7-eventsystem): Migration Event and @ReceiveEvent to gestalt's (#28) --- .../java/org/terasology/hunger/HungerAuthoritySystem.java | 6 ++++-- .../java/org/terasology/hunger/event/FoodConsumedEvent.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/terasology/hunger/HungerAuthoritySystem.java b/src/main/java/org/terasology/hunger/HungerAuthoritySystem.java index 83d37d2..a2df863 100644 --- a/src/main/java/org/terasology/hunger/HungerAuthoritySystem.java +++ b/src/main/java/org/terasology/hunger/HungerAuthoritySystem.java @@ -21,7 +21,7 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.event.EventPriority; -import org.terasology.engine.entitySystem.event.ReceiveEvent; +import org.terasology.engine.entitySystem.event.Priority; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.engine.entitySystem.prefab.PrefabManager; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; @@ -36,6 +36,7 @@ import org.terasology.engine.logic.players.event.OnPlayerSpawnedEvent; import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.hunger.component.FoodComponent; import org.terasology.hunger.component.HungerComponent; import org.terasology.hunger.event.AffectHungerEvent; @@ -215,7 +216,8 @@ public void foodConsumed(ActivateEvent event, EntityRef item, FoodComponent food * @param event The FoodConsumedEvent called when an entity consumes food. * @param item The entity which is consuming the food. */ - @ReceiveEvent(components = ItemComponent.class, priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent(components = ItemComponent.class) public void usedItem(FoodConsumedEvent event, EntityRef item) { ItemComponent itemComp = item.getComponent(ItemComponent.class); if (itemComp.consumedOnUse) { diff --git a/src/main/java/org/terasology/hunger/event/FoodConsumedEvent.java b/src/main/java/org/terasology/hunger/event/FoodConsumedEvent.java index 64acc92..49ce5b1 100644 --- a/src/main/java/org/terasology/hunger/event/FoodConsumedEvent.java +++ b/src/main/java/org/terasology/hunger/event/FoodConsumedEvent.java @@ -16,8 +16,8 @@ package org.terasology.hunger.event; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.logic.common.ActivateEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** This event is triggered after the Activate event has been consumed upon eating of a food item */ public class FoodConsumedEvent implements Event {