Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gestaltv7-eventsystem): Migration Event and @ReceiveEvent to gestalt's #27

Merged
merged 4 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -39,6 +39,7 @@
import org.terasology.engine.world.WorldComponent;
import org.terasology.fluid.component.FluidContainerItemComponent;
import org.terasology.fluid.system.FluidUtils;
import org.terasology.gestalt.entitysystem.event.ReceiveEvent;
import org.terasology.module.health.events.BeforeRegenEvent;
import org.terasology.module.health.events.DoDamageEvent;
import org.terasology.module.inventory.systems.InventoryManager;
Expand Down Expand Up @@ -169,7 +170,8 @@ private void resetThirst(EntityRef player, ThirstComponent thirst) {
* @param item the item that the player is drinking
* @param drink the drink component associated with the item being consumed
*/
@ReceiveEvent(priority = EventPriority.PRIORITY_LOW)
@Priority(EventPriority.PRIORITY_LOW)
@ReceiveEvent
public void drinkConsumed(ActivateEvent event, EntityRef item, DrinkComponent drink) {
float filling = drink.filling;
EntityRef instigator = event.getInstigator();
Expand All @@ -194,7 +196,8 @@ public void drinkConsumed(ActivateEvent event, EntityRef item, DrinkComponent dr
* @param event the event corresponding to the consumption of a drink
* @param item the item that the player is drinking
*/
@ReceiveEvent(components = ItemComponent.class, priority = EventPriority.PRIORITY_TRIVIAL)
@Priority(EventPriority.PRIORITY_TRIVIAL)
@ReceiveEvent(components = ItemComponent.class)
public void usedItem(DrinkConsumedEvent event, EntityRef item) {
if (item.hasComponent(FluidContainerItemComponent.class)) {
EntityRef owner = item.getOwner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package org.terasology.thirst.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 sent to an entity to indicate that it has drunk a drink. */
public class DrinkConsumedEvent implements Event {
Expand Down