Skip to content

Commit

Permalink
feat(gestaltv7-eventsystem): Migration Event and @ReceiveEvent to ges…
Browse files Browse the repository at this point in the history
…talt's (#28)
  • Loading branch information
DarkWeird authored Dec 7, 2021
1 parent 1869c54 commit beb2e4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit beb2e4a

Please sign in to comment.