From 7ef8973c289246e4541b5f59f7e4a424e02a0b8d Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Sat, 4 Dec 2021 12:14:47 -0800 Subject: [PATCH 1/4] chore: remove usage of Tesselator for BlockSelectionRenderer (#4964) Co-authored-by: Tobias Nett --- .../selection/BlockSelectionRenderer.java | 130 ++++++++++++++++-- 1 file changed, 116 insertions(+), 14 deletions(-) diff --git a/engine/src/main/java/org/terasology/engine/rendering/world/selection/BlockSelectionRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/world/selection/BlockSelectionRenderer.java index 0d393d8b0ae..8df42a2f3f5 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/world/selection/BlockSelectionRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/world/selection/BlockSelectionRenderer.java @@ -6,21 +6,21 @@ import org.joml.Vector2f; import org.joml.Vector3f; import org.joml.Vector3ic; -import org.joml.Vector4f; import org.lwjgl.opengl.GL11; import org.terasology.engine.registry.CoreRegistry; import org.terasology.engine.rendering.assets.material.Material; import org.terasology.engine.rendering.assets.mesh.Mesh; +import org.terasology.engine.rendering.assets.mesh.StandardMeshData; import org.terasology.engine.rendering.assets.shader.ShaderProgramFeature; import org.terasology.engine.rendering.assets.texture.Texture; import org.terasology.engine.rendering.assets.texture.TextureRegionAsset; import org.terasology.engine.rendering.cameras.Camera; -import org.terasology.engine.rendering.primitives.Tessellator; -import org.terasology.engine.rendering.primitives.TessellatorHelper; import org.terasology.engine.rendering.world.WorldRenderer; import org.terasology.engine.utilities.Assets; import org.terasology.gestalt.module.sandbox.API; import org.terasology.joml.geom.Rectanglef; +import org.terasology.nui.Color; +import org.terasology.nui.Colorc; import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; @@ -50,18 +50,120 @@ public BlockSelectionRenderer(Texture effectsTexture) { initialize(); } + + private static void buildBlockMesh(StandardMeshData mesh, float size, Rectanglef texRect, Colorc c) { + Vector3f pos = new Vector3f(); + Vector3f norm = new Vector3f(); + Vector2f texCoord = new Vector2f(); + final float sizeHalf = size / 2; + + int firstIndex = mesh.position.getPosition(); + + // top + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, -sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(0, 1.0f, 0)); + mesh.color0.put(c); + } + + // left + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, -sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.minY, texRect.minY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(-1.0f, 0, 0)); + mesh.color0.put(c); + } + + // right + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, -sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(1.0f, 0, 0)); + mesh.color0.put(c); + } + + // back + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, -sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(0, 0, -1.0f)); + mesh.color0.put(c); + } + + // front + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, sizeHalf, sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.minY, texRect.minY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(0, 0, 1.0f)); + mesh.color0.put(c); + } + + // bottom + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, -sizeHalf)); + mesh.position.put(pos.zero().add(sizeHalf, -sizeHalf, sizeHalf)); + mesh.position.put(pos.zero().add(-sizeHalf, -sizeHalf, sizeHalf)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY)); + mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY)); + mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY)); + for (int i = 0; i < 4; i++) { + mesh.normal.put(norm.set(0, -1, 0f)); + mesh.color0.put(c); + } + + + int lastIndex = mesh.position.getPosition(); + for (int i = firstIndex; i < lastIndex - 2; i += 4) { + mesh.indices.put(i); + mesh.indices.put(i + 1); + mesh.indices.put(i + 2); + + mesh.indices.put(i + 2); + mesh.indices.put(i + 3); + mesh.indices.put(i); + } + } + private void initialize() { - Vector2f min = new Vector2f(textureRegion.minX(), textureRegion.minY()); - Tessellator tessellator = new Tessellator(); - TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, 1f), - min, textureRegion.getSize(new Vector2f()), - 1.001f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f); - overlayMesh = tessellator.generateMesh(); - tessellator = new Tessellator(); - TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, .2f), - min, textureRegion.getSize(new Vector2f()), 1.001f, 1.0f, 1.0f, 0.0f, - 0.0f, 0.0f); - overlayMesh2 = tessellator.generateMesh(); + StandardMeshData overlayMeshData = new StandardMeshData(); + buildBlockMesh(overlayMeshData, 1.0f, textureRegion, Color.white); + overlayMesh = Assets.generateAsset(overlayMeshData, Mesh.class); + + StandardMeshData overlayMeshData2 = new StandardMeshData(); + buildBlockMesh(overlayMeshData2, 1.0f, textureRegion, new Color(1.0f, 1.0f, 1.0f, .2f)); + overlayMesh2 = Assets.generateAsset(overlayMeshData2, Mesh.class); blockSelectionMat = Assets.getMaterial("engine:prog.blockSelection").get(); } From 7d9367757a445897b362ecc0adafb16e9cdf522e Mon Sep 17 00:00:00 2001 From: Josephine Rueckert Date: Sat, 4 Dec 2021 22:39:36 +0100 Subject: [PATCH 2/4] chore: prepare release 5.2.0 --- .../src/main/resources/org/terasology/unittest/module.txt | 2 +- engine/src/main/resources/org/terasology/engine/module.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine-tests/src/main/resources/org/terasology/unittest/module.txt b/engine-tests/src/main/resources/org/terasology/unittest/module.txt index 9ce6f00fec6..7525f19dd58 100644 --- a/engine-tests/src/main/resources/org/terasology/unittest/module.txt +++ b/engine-tests/src/main/resources/org/terasology/unittest/module.txt @@ -1,6 +1,6 @@ { "id" : "unittest", - "version" : "5.2.0-SNAPSHOT", + "version" : "5.2.0", "displayName" : "Terasology Engine Test", "description" : "Engine unit test content" } diff --git a/engine/src/main/resources/org/terasology/engine/module.txt b/engine/src/main/resources/org/terasology/engine/module.txt index 6ed6f8a2ac3..64b0b0ccec0 100644 --- a/engine/src/main/resources/org/terasology/engine/module.txt +++ b/engine/src/main/resources/org/terasology/engine/module.txt @@ -1,6 +1,6 @@ { "id" : "engine", - "version" : "5.2.0-SNAPSHOT", + "version" : "5.2.0", "displayName" : "Terasology Engine", "description" : "Core engine content" } From 502985ef9de69d8dd9208bc1e22d3d6e126e5602 Mon Sep 17 00:00:00 2001 From: Josephine Rueckert Date: Sat, 4 Dec 2021 23:02:15 +0100 Subject: [PATCH 3/4] chore: prepare snapshot builds for 5.3.0 --- .../src/main/resources/org/terasology/unittest/module.txt | 2 +- engine/src/main/resources/org/terasology/engine/module.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine-tests/src/main/resources/org/terasology/unittest/module.txt b/engine-tests/src/main/resources/org/terasology/unittest/module.txt index 7525f19dd58..1a5f8d6bdd2 100644 --- a/engine-tests/src/main/resources/org/terasology/unittest/module.txt +++ b/engine-tests/src/main/resources/org/terasology/unittest/module.txt @@ -1,6 +1,6 @@ { "id" : "unittest", - "version" : "5.2.0", + "version" : "5.3.0-SNAPSHOT", "displayName" : "Terasology Engine Test", "description" : "Engine unit test content" } diff --git a/engine/src/main/resources/org/terasology/engine/module.txt b/engine/src/main/resources/org/terasology/engine/module.txt index 64b0b0ccec0..72816ed0df8 100644 --- a/engine/src/main/resources/org/terasology/engine/module.txt +++ b/engine/src/main/resources/org/terasology/engine/module.txt @@ -1,6 +1,6 @@ { "id" : "engine", - "version" : "5.2.0", + "version" : "5.3.0-SNAPSHOT", "displayName" : "Terasology Engine", "description" : "Core engine content" } From 1f0349f4d6464cd4a831b70fb19a67ed41ad8ce1 Mon Sep 17 00:00:00 2001 From: Nail Khanipov Date: Sun, 5 Dec 2021 16:19:57 +0300 Subject: [PATCH 4/4] feat(gestaltv7-eventsystem): Migration Event and @ReceiveEvent to gestalt's (#4898) --- .../entitySystem/PojoEventSystemTests.java | 17 +++++---- .../characters/VisualCharacterSystemTest.java | 2 +- .../logic/delay/DelayedActionSystemTest.java | 2 +- .../event/VectorEventSerializer.java | 8 ++-- .../recording/EventSystemReplayImplTest.java | 4 +- .../world/EntityAwareWorldProviderTest.java | 4 +- .../LocalChunkProviderTest.java | 2 +- .../terasology/input/InputSystemTests.java | 2 +- .../engine/audio/system/AudioSystem.java | 2 +- .../core/bootstrap/EntitySystemSetupUtil.java | 2 +- .../AbstractEventSystemDecorator.java | 2 +- .../AwaitedLocalCharacterSpawnEvent.java | 2 +- .../LoadingChunkEventSystem.java | 2 +- .../core/module/ExternalApiWhitelist.java | 1 + .../engine/entitySystem/entity/EntityRef.java | 2 +- .../entity/internal/BaseEntityRef.java | 2 +- .../entity/internal/NullEntityRef.java | 2 +- .../BeforeDeactivateComponent.java | 2 +- .../lifecycleEvents/BeforeEntityCreated.java | 2 +- .../BeforeRemoveComponent.java | 2 +- .../lifecycleEvents/OnActivatedComponent.java | 2 +- .../lifecycleEvents/OnAddedComponent.java | 2 +- .../lifecycleEvents/OnChangedComponent.java | 2 +- .../event/AbstractValueModifiableEvent.java | 1 + .../engine/entitySystem/event/Activity.java | 14 +++++++ .../entitySystem/event/BeforeAfterEvent.java | 2 + .../entitySystem/event/ConsumableEvent.java | 2 + .../engine/entitySystem/event/Event.java | 10 ----- .../entitySystem/event/PendingEvent.java | 1 + .../engine/entitySystem/event/Priority.java | 20 ++++++++++ .../entitySystem/event/ReceiveEvent.java | 33 ---------------- .../event/internal/EventReceiver.java | 2 +- .../event/internal/EventSystem.java | 4 +- .../event/internal/EventSystemImpl.java | 38 ++++++++++++++----- .../entitySystem/metadata/EventLibrary.java | 2 +- .../entitySystem/metadata/EventMetadata.java | 10 ++--- .../sectors/LoadedSectorUpdateEvent.java | 2 +- .../sectors/SectorEntityLoad.java | 2 +- .../sectors/SectorEntityUnload.java | 2 +- .../sectors/SectorSimulationEvent.java | 2 +- .../sectors/SectorSimulationSystem.java | 2 +- .../entitySystem/systems/NetFilterEvent.java | 20 ++++++++++ .../systems/UpdateSubscriberSystem.java | 4 +- .../input/cameraTarget/CameraOutEvent.java | 2 +- .../input/cameraTarget/CameraOverEvent.java | 2 +- .../CameraTargetChangedEvent.java | 2 +- .../engine/logic/actions/PlaySoundAction.java | 4 +- .../logic/actions/SpawnPrefabAction.java | 2 +- .../engine/logic/afk/AfkAuthoritySystem.java | 2 +- .../engine/logic/afk/AfkClientSystem.java | 6 ++- .../engine/logic/behavior/BehaviorSystem.java | 2 +- .../behavior/CollectiveBehaviorSystem.java | 2 +- .../nui/BehaviorTreeClientSystem.java | 4 +- .../nui/BehaviorTreeEditorSystem.java | 4 +- .../CharacterHeldItemAuthoritySystem.java | 2 +- .../characters/CharacterImpulseEvent.java | 2 +- .../characters/CharacterScalingSystem.java | 9 +++-- .../characters/CharacterSoundSystem.java | 2 +- .../logic/characters/CharacterSystem.java | 21 +++++++--- .../characters/CharacterTeleportEvent.java | 2 +- .../ClientCharacterPredictionSystem.java | 2 +- .../logic/characters/GazeAuthoritySystem.java | 6 ++- .../ServerCharacterPredictionSystem.java | 2 +- .../characters/VisualCharacterSystem.java | 6 ++- .../events/ActivationRequestDenied.java | 2 +- .../events/ChangeHeldItemRequest.java | 2 +- .../characters/events/CollisionEvent.java | 2 +- .../logic/characters/events/DeathEvent.java | 2 +- .../characters/events/FootstepEvent.java | 2 +- .../logic/characters/events/JumpEvent.java | 2 +- .../characters/events/OnEnterBlockEvent.java | 2 +- .../logic/characters/events/OnScaleEvent.java | 2 +- .../characters/events/PlayerDeathEvent.java | 2 +- .../events/SetMovementModeEvent.java | 2 +- .../characters/events/SwimStrokeEvent.java | 2 +- .../interactions/InteractionEndEvent.java | 2 +- .../interactions/InteractionEndPredicted.java | 2 +- .../interactions/InteractionEndRequest.java | 2 +- .../InteractionStartPredicted.java | 2 +- .../interactions/InteractionSystem.java | 16 +++++--- .../engine/logic/chat/ChatSystem.java | 2 +- .../logic/common/lifespan/LifespanSystem.java | 2 +- .../engine/logic/console/CommandEvent.java | 4 +- .../engine/logic/console/ConsoleSystem.java | 10 +++-- .../engine/logic/console/MessageEvent.java | 2 +- .../logic/debug/ChunkEventErrorLogger.java | 2 +- .../logic/delay/DelayedActionSystem.java | 2 +- .../delay/DelayedActionTriggeredEvent.java | 2 +- .../delay/PeriodicActionTriggeredEvent.java | 2 +- .../engine/logic/health/DestroyEvent.java | 2 +- .../engine/logic/health/DoDestroyEvent.java | 2 +- .../EntityDestructionAuthoritySystem.java | 2 +- .../logic/inventory/ItemCommonSystem.java | 2 +- .../inventory/ItemPickupAuthoritySystem.java | 2 +- .../logic/inventory/events/DropItemEvent.java | 2 +- .../logic/inventory/events/GiveItemEvent.java | 2 +- .../engine/logic/location/Location.java | 6 ++- .../logic/location/LocationChangedEvent.java | 2 +- .../logic/location/LocationChangedSystem.java | 2 +- .../logic/location/LocationResynchEvent.java | 2 +- .../logic/nameTags/NameTagClientSystem.java | 2 +- .../logic/nameTags/PlayerNameTagSystem.java | 6 +-- .../notifications/NotificationSystem.java | 2 +- .../logic/players/CameraClientSystem.java | 2 +- .../logic/players/DebugControlSystem.java | 6 ++- .../players/FirstPersonClientSystem.java | 2 +- .../logic/players/LocalPlayerSystem.java | 2 +- .../logic/players/MenuControlSystem.java | 6 +-- .../engine/logic/players/PlayerSystem.java | 11 ++++-- .../players/PlayerTargetChangedEvent.java | 2 +- .../logic/players/SetDirectionEvent.java | 2 +- .../ThirdPersonRemoteClientSystem.java | 2 +- .../logic/players/WorldtimeResyncSystem.java | 2 +- .../event/LocalPlayerInitializedEvent.java | 2 +- .../players/event/OnPlayerRespawnedEvent.java | 2 +- .../players/event/OnPlayerSpawnedEvent.java | 2 +- .../logic/players/event/ResetCameraEvent.java | 2 +- .../players/event/RespawnRequestEvent.java | 2 +- .../event/SynchronizeClientTimeSystem.java | 2 +- .../players/event/WorldtimeResetEvent.java | 2 +- .../selection/ApplyBlockSelectionEvent.java | 4 +- ...LocalPlayerBlockSelectionByItemSystem.java | 2 +- .../selection/MovableSelectionEndEvent.java | 4 +- .../selection/MovableSelectionStartEvent.java | 2 +- .../engine/logic/time/TimeClientSystem.java | 6 ++- .../engine/logic/time/TimeResynchEvent.java | 2 +- .../logic/time/WorldtimeResyncEvent.java | 2 +- .../org/terasology/engine/network/Client.java | 4 +- .../engine/network/ClientPingSystem.java | 2 +- .../engine/network/NetworkEvent.java | 2 +- .../network/NetworkEventSystemDecorator.java | 4 +- .../org/terasology/engine/network/Server.java | 2 +- .../engine/network/ServerPingSystem.java | 2 +- .../engine/network/events/ConnectedEvent.java | 2 +- .../network/events/DisconnectedEvent.java | 2 +- .../network/events/PingFromClientEvent.java | 2 +- .../network/events/PingFromServerEvent.java | 2 +- .../network/events/SubscribePingEvent.java | 2 +- .../network/events/UnSubscribePingEvent.java | 2 +- .../engine/network/internal/LocalClient.java | 4 +- .../engine/network/internal/NetClient.java | 2 +- .../network/internal/NetworkEntitySystem.java | 8 +++- .../network/internal/NetworkSystemImpl.java | 2 +- .../engine/network/internal/ServerImpl.java | 2 +- .../particles/ParticleSystemManagerImpl.java | 2 +- .../events/ParticleSystemUpdateEvent.java | 2 +- .../internal/DelayedEntityRef.java | 2 +- .../serializers/EventSerializer.java | 2 +- .../physics/bullet/VoxelWorldSystem.java | 2 +- .../engine/physics/engine/PhysicsSystem.java | 13 +++++-- .../physics/events/ChangeVelocityEvent.java | 2 +- .../engine/physics/events/ForceEvent.java | 2 +- .../engine/physics/events/ImpulseEvent.java | 2 +- .../engine/physics/events/MovedEvent.java | 2 +- .../physics/events/PhysicsResynchEvent.java | 2 +- .../engine/recording/EventCatcher.java | 2 +- .../engine/recording/EventCopier.java | 6 +-- .../recording/EventSystemReplayImpl.java | 36 ++++++++++++++---- .../engine/recording/RecordedEntityRef.java | 2 +- .../engine/recording/RecordedEvent.java | 2 +- .../RecordingEventSystemDecorator.java | 2 +- .../engine/rendering/logic/AnimEndEvent.java | 2 +- .../rendering/logic/ChunkMeshRenderer.java | 2 +- .../rendering/logic/FloatingTextRenderer.java | 2 +- .../rendering/logic/LightFadeSystem.java | 2 +- .../engine/rendering/logic/MeshRenderer.java | 2 +- .../logic/RegionOutlineRenderer.java | 2 +- .../rendering/logic/SkeletonRenderer.java | 2 +- .../rendering/nui/FocusChangedEvent.java | 2 +- .../rendering/nui/ScreenLayerClosedEvent.java | 4 +- .../engine/rendering/nui/SortOrderSystem.java | 4 +- .../nui/editor/systems/NUIEditorSystem.java | 9 +++-- .../editor/systems/NUISkinEditorSystem.java | 9 +++-- .../nui/internal/NUIManagerInternal.java | 21 ++++++---- .../rendering/world/WorldRendererSystem.java | 2 +- .../ClientViewDistanceSystem.java | 2 +- .../ServerViewDistanceSystem.java | 2 +- .../ViewDistanceChangedEvent.java | 2 +- .../engine/world/OnChangedBlock.java | 2 +- .../world/block/BlockLifecycleEvent.java | 2 +- .../world/block/entity/BlockEntitySystem.java | 23 ++++++----- .../LargeBlockUpdateFinished.java | 2 +- .../LargeBlockUpdateStarting.java | 2 +- .../NeighbourBlockFamilyUpdateSystem.java | 6 +-- .../entity/placement/BlockPlacingSystem.java | 6 ++- .../world/block/items/BlockItemSystem.java | 10 ++--- .../world/block/items/OnBlockItemPlaced.java | 2 +- .../world/block/items/OnBlockToItem.java | 2 +- .../block/regions/BlockRegionSystem.java | 6 ++- .../BlockStructuralSupportSystem.java | 2 +- .../structure/SideBlockSupportRequired.java | 2 +- .../typeEntity/BlockTypeClientSystem.java | 2 +- .../world/chunks/event/BeforeChunkUnload.java | 2 +- .../world/chunks/event/OnChunkGenerated.java | 2 +- .../world/chunks/event/OnChunkLoaded.java | 2 +- .../world/chunks/event/PurgeWorldEvent.java | 2 +- .../localChunkProvider/RelevanceSystem.java | 2 +- .../internal/EntityAwareWorldProvider.java | 2 +- .../world/selection/BlockSelectionSystem.java | 4 +- .../engine/world/time/TimeEventBase.java | 2 +- .../discordrpc/DiscordRPCSystem.java | 2 +- 201 files changed, 462 insertions(+), 339 deletions(-) create mode 100644 engine/src/main/java/org/terasology/engine/entitySystem/event/Activity.java delete mode 100644 engine/src/main/java/org/terasology/engine/entitySystem/event/Event.java create mode 100644 engine/src/main/java/org/terasology/engine/entitySystem/event/Priority.java delete mode 100644 engine/src/main/java/org/terasology/engine/entitySystem/event/ReceiveEvent.java create mode 100644 engine/src/main/java/org/terasology/engine/entitySystem/systems/NetFilterEvent.java diff --git a/engine-tests/src/test/java/org/terasology/engine/entitySystem/PojoEventSystemTests.java b/engine-tests/src/test/java/org/terasology/engine/entitySystem/PojoEventSystemTests.java index e26a406816b..d854ce4b426 100644 --- a/engine-tests/src/test/java/org/terasology/engine/entitySystem/PojoEventSystemTests.java +++ b/engine-tests/src/test/java/org/terasology/engine/entitySystem/PojoEventSystemTests.java @@ -7,24 +7,25 @@ import org.junit.jupiter.api.Test; import org.reflections.Reflections; import org.terasology.engine.context.internal.ContextImpl; -import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.internal.PojoEntityManager; import org.terasology.engine.entitySystem.event.AbstractConsumableEvent; -import org.terasology.engine.entitySystem.event.Event; 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.event.internal.EventReceiver; import org.terasology.engine.entitySystem.event.internal.EventSystemImpl; import org.terasology.engine.entitySystem.metadata.ComponentLibrary; import org.terasology.engine.entitySystem.metadata.EntitySystemLibrary; import org.terasology.engine.entitySystem.prefab.internal.PojoPrefabManager; -import org.terasology.unittest.stubs.IntegerComponent; -import org.terasology.unittest.stubs.StringComponent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl; import org.terasology.engine.registry.CoreRegistry; +import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.persistence.typeHandling.TypeHandlerLibrary; +import org.terasology.unittest.stubs.IntegerComponent; +import org.terasology.unittest.stubs.StringComponent; import java.util.List; @@ -250,7 +251,8 @@ public static class TestHighPriorityEventHandler extends BaseComponentSystem { List receivedList = Lists.newArrayList(); - @ReceiveEvent(components = StringComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = StringComponent.class) public void handleStringEvent(TestEvent event, EntityRef entity) { receivedList.add(new Received(event, entity)); if (cancel) { @@ -258,7 +260,8 @@ public void handleStringEvent(TestEvent event, EntityRef entity) { } } - @ReceiveEvent(components = IntegerComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = IntegerComponent.class) public void handleIntegerEvent(TestEvent event, EntityRef entity) { receivedList.add(new Received(event, entity)); } diff --git a/engine-tests/src/test/java/org/terasology/engine/logic/characters/VisualCharacterSystemTest.java b/engine-tests/src/test/java/org/terasology/engine/logic/characters/VisualCharacterSystemTest.java index 07b5d236f97..70a6cad4842 100644 --- a/engine-tests/src/test/java/org/terasology/engine/logic/characters/VisualCharacterSystemTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/logic/characters/VisualCharacterSystemTest.java @@ -14,10 +14,10 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.logic.characters.events.CreateVisualCharacterEvent; import org.terasology.engine.logic.players.LocalPlayer; import org.terasology.engine.registry.InjectionHelper; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.ArrayList; import java.util.Arrays; diff --git a/engine-tests/src/test/java/org/terasology/engine/logic/delay/DelayedActionSystemTest.java b/engine-tests/src/test/java/org/terasology/engine/logic/delay/DelayedActionSystemTest.java index 5549512fa5c..f445cc0ea46 100644 --- a/engine-tests/src/test/java/org/terasology/engine/logic/delay/DelayedActionSystemTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/logic/delay/DelayedActionSystemTest.java @@ -8,7 +8,7 @@ import org.terasology.engine.TerasologyTestingEnvironment; import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.ArrayList; import java.util.Arrays; diff --git a/engine-tests/src/test/java/org/terasology/engine/persistence/typeHandling/event/VectorEventSerializer.java b/engine-tests/src/test/java/org/terasology/engine/persistence/typeHandling/event/VectorEventSerializer.java index bbad6c8a408..0225cf41c3f 100644 --- a/engine-tests/src/test/java/org/terasology/engine/persistence/typeHandling/event/VectorEventSerializer.java +++ b/engine-tests/src/test/java/org/terasology/engine/persistence/typeHandling/event/VectorEventSerializer.java @@ -11,15 +11,16 @@ import org.joml.Vector4fc; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.terasology.engine.core.module.ModuleManager; -import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.engine.context.internal.ContextImpl; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.engine.core.module.ModuleManager; import org.terasology.engine.entitySystem.metadata.EntitySystemLibrary; import org.terasology.engine.entitySystem.metadata.EventMetadata; import org.terasology.engine.persistence.serializers.EventSerializer; import org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl; import org.terasology.engine.registry.CoreRegistry; +import org.terasology.engine.testUtil.ModuleManagerFactory; +import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.persistence.typeHandling.TypeHandlerLibrary; import org.terasology.protobuf.EntityData; import org.terasology.reflection.ModuleTypeRegistry; @@ -27,7 +28,6 @@ import org.terasology.reflection.metadata.FieldMetadata; import org.terasology.reflection.reflect.ReflectFactory; import org.terasology.reflection.reflect.ReflectionReflectFactory; -import org.terasology.engine.testUtil.ModuleManagerFactory; import java.io.IOException; import java.util.HashMap; diff --git a/engine-tests/src/test/java/org/terasology/engine/recording/EventSystemReplayImplTest.java b/engine-tests/src/test/java/org/terasology/engine/recording/EventSystemReplayImplTest.java index b976690a33b..8dac97f01dc 100644 --- a/engine-tests/src/test/java/org/terasology/engine/recording/EventSystemReplayImplTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/recording/EventSystemReplayImplTest.java @@ -13,8 +13,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.internal.PojoEntityManager; import org.terasology.engine.entitySystem.event.AbstractConsumableEvent; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.metadata.EntitySystemLibrary; import org.terasology.engine.entitySystem.prefab.internal.PojoPrefabManager; @@ -25,6 +23,8 @@ import org.terasology.engine.network.NetworkSystem; import org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl; import org.terasology.engine.registry.CoreRegistry; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.gestalt.module.ModuleEnvironment; import org.terasology.persistence.typeHandling.TypeHandlerLibrary; import org.terasology.reflection.TypeRegistry; diff --git a/engine-tests/src/test/java/org/terasology/engine/world/EntityAwareWorldProviderTest.java b/engine-tests/src/test/java/org/terasology/engine/world/EntityAwareWorldProviderTest.java index 6a451ab4cc1..f80edb8dccc 100644 --- a/engine-tests/src/test/java/org/terasology/engine/world/EntityAwareWorldProviderTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/world/EntityAwareWorldProviderTest.java @@ -18,8 +18,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.event.internal.EventReceiver; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.prefab.Prefab; @@ -39,6 +37,8 @@ import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.assets.management.AssetManager; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.unittest.stubs.ForceBlockActiveComponent; import org.terasology.unittest.stubs.IntegerComponent; import org.terasology.unittest.stubs.RetainedOnBlockChangeComponent; diff --git a/engine-tests/src/test/java/org/terasology/engine/world/chunks/localChunkProvider/LocalChunkProviderTest.java b/engine-tests/src/test/java/org/terasology/engine/world/chunks/localChunkProvider/LocalChunkProviderTest.java index d56a25328aa..5a73af0b3c3 100644 --- a/engine-tests/src/test/java/org/terasology/engine/world/chunks/localChunkProvider/LocalChunkProviderTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/world/chunks/localChunkProvider/LocalChunkProviderTest.java @@ -12,7 +12,6 @@ import org.mockito.ArgumentCaptor; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.BlockEntityRegistry; import org.terasology.engine.world.block.BeforeDeactivateBlocks; import org.terasology.engine.world.block.Block; @@ -30,6 +29,7 @@ import org.terasology.fixtures.TestChunkStore; import org.terasology.fixtures.TestStorageManager; import org.terasology.fixtures.TestWorldGenerator; +import org.terasology.gestalt.entitysystem.event.Event; import java.time.Duration; import java.time.temporal.ChronoUnit; diff --git a/engine-tests/src/test/java/org/terasology/input/InputSystemTests.java b/engine-tests/src/test/java/org/terasology/input/InputSystemTests.java index fe30e1c0fb9..89a8a870631 100644 --- a/engine-tests/src/test/java/org/terasology/input/InputSystemTests.java +++ b/engine-tests/src/test/java/org/terasology/input/InputSystemTests.java @@ -15,7 +15,6 @@ import org.terasology.engine.core.subsystem.config.BindsManager; import org.terasology.engine.core.subsystem.headless.device.TimeSystem; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.systems.internal.DoNotAutoRegister; import org.terasology.engine.input.BindButtonEvent; import org.terasology.engine.input.BindableButton; @@ -30,6 +29,7 @@ import org.terasology.engine.recording.DirectionAndOriginPosRecorderList; import org.terasology.engine.recording.RecordAndReplayCurrentStatus; import org.terasology.engine.registry.InjectionHelper; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.input.Keyboard.Key; import org.terasology.input.Keyboard.KeyId; import org.terasology.input.device.CharKeyboardAction; diff --git a/engine/src/main/java/org/terasology/engine/audio/system/AudioSystem.java b/engine/src/main/java/org/terasology/engine/audio/system/AudioSystem.java index 09ce2fc4422..d0e60ea6b5c 100644 --- a/engine/src/main/java/org/terasology/engine/audio/system/AudioSystem.java +++ b/engine/src/main/java/org/terasology/engine/audio/system/AudioSystem.java @@ -11,7 +11,6 @@ import org.terasology.engine.audio.events.PlaySoundEvent; import org.terasology.engine.audio.events.PlaySoundForOwnerEvent; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; @@ -25,6 +24,7 @@ import org.terasology.engine.network.NetworkSystem; import org.terasology.engine.registry.In; import org.terasology.engine.utilities.Assets; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system handles receiving the PlaySound events and activating the AudioManager to play them diff --git a/engine/src/main/java/org/terasology/engine/core/bootstrap/EntitySystemSetupUtil.java b/engine/src/main/java/org/terasology/engine/core/bootstrap/EntitySystemSetupUtil.java index 781b8c9a928..ac906357e4c 100644 --- a/engine/src/main/java/org/terasology/engine/core/bootstrap/EntitySystemSetupUtil.java +++ b/engine/src/main/java/org/terasology/engine/core/bootstrap/EntitySystemSetupUtil.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.internal.EngineEntityManager; import org.terasology.engine.entitySystem.entity.internal.PojoEntityManager; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.event.internal.EventSystemImpl; import org.terasology.engine.entitySystem.metadata.ComponentLibrary; @@ -39,6 +38,7 @@ import org.terasology.engine.recording.RecordingEventSystemDecorator; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.ModuleEnvironment; import org.terasology.gestalt.naming.Name; import org.terasology.nui.properties.OneOfProviderFactory; diff --git a/engine/src/main/java/org/terasology/engine/core/bootstrap/eventSystem/AbstractEventSystemDecorator.java b/engine/src/main/java/org/terasology/engine/core/bootstrap/eventSystem/AbstractEventSystemDecorator.java index a5214a8f37e..8b14075c11f 100644 --- a/engine/src/main/java/org/terasology/engine/core/bootstrap/eventSystem/AbstractEventSystemDecorator.java +++ b/engine/src/main/java/org/terasology/engine/core/bootstrap/eventSystem/AbstractEventSystemDecorator.java @@ -4,12 +4,12 @@ package org.terasology.engine.core.bootstrap.eventSystem; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.internal.EventReceiver; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.systems.ComponentSystem; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; public abstract class AbstractEventSystemDecorator implements EventSystem { private final EventSystem eventSystem; diff --git a/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/AwaitedLocalCharacterSpawnEvent.java b/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/AwaitedLocalCharacterSpawnEvent.java index 21cf3d990a6..68b80c024ba 100644 --- a/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/AwaitedLocalCharacterSpawnEvent.java +++ b/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/AwaitedLocalCharacterSpawnEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.core.modes.loadProcesses; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; /** diff --git a/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/LoadingChunkEventSystem.java b/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/LoadingChunkEventSystem.java index 9feb6f987db..b72f1cc5d1b 100644 --- a/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/LoadingChunkEventSystem.java +++ b/engine/src/main/java/org/terasology/engine/core/modes/loadProcesses/LoadingChunkEventSystem.java @@ -6,12 +6,12 @@ import org.terasology.engine.core.GameEngine; import org.terasology.engine.core.modes.GameState; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldComponent; import org.terasology.engine.world.chunks.event.OnChunkLoaded; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * A system to send new chunk events to the current game state, which can be diff --git a/engine/src/main/java/org/terasology/engine/core/module/ExternalApiWhitelist.java b/engine/src/main/java/org/terasology/engine/core/module/ExternalApiWhitelist.java index f2feb864355..e93d9ab45e8 100644 --- a/engine/src/main/java/org/terasology/engine/core/module/ExternalApiWhitelist.java +++ b/engine/src/main/java/org/terasology/engine/core/module/ExternalApiWhitelist.java @@ -50,6 +50,7 @@ public final class ExternalApiWhitelist { private static final Set GESTALT_ECS_PACKAGES = new ImmutableSet.Builder() .add("org.terasology.gestalt.entitysystem.component") + .add("org.terasology.gestalt.entitysystem.event") .build(); public static final Set PACKAGES = new ImmutableSet.Builder() diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/EntityRef.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/EntityRef.java index f4c64b918a4..1e5d577b699 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/EntityRef.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/EntityRef.java @@ -6,9 +6,9 @@ import org.terasology.engine.entitySystem.MutableComponentContainer; import org.terasology.engine.entitySystem.entity.internal.EntityScope; import org.terasology.engine.entitySystem.entity.internal.NullEntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.engine.entitySystem.sectors.SectorSimulationComponent; +import org.terasology.gestalt.entitysystem.event.Event; /** * A wrapper around an entity id providing access to common functionality diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/BaseEntityRef.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/BaseEntityRef.java index a0d08befd56..bfb2ea3377c 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/BaseEntityRef.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/BaseEntityRef.java @@ -6,13 +6,13 @@ import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.LowLevelEntityManager; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.engine.entitySystem.sectors.SectorSimulationComponent; import org.terasology.engine.network.NetworkComponent; import org.terasology.engine.persistence.serializers.EntityDataJSONFormat; import org.terasology.engine.persistence.serializers.EntitySerializer; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/NullEntityRef.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/NullEntityRef.java index e5644fc7620..0d3d375a1cf 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/NullEntityRef.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/NullEntityRef.java @@ -3,9 +3,9 @@ package org.terasology.engine.entitySystem.entity.internal; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.Collections; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeDeactivateComponent.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeDeactivateComponent.java index 627d12b6798..600bf1d0b03 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeDeactivateComponent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeDeactivateComponent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.entity.lifecycleEvents; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * When a component is about to leave the active state, either due to being removed, the entity it is attached to being destroyed, diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeEntityCreated.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeEntityCreated.java index 38a98ab3c64..40f8ad6d749 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeEntityCreated.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeEntityCreated.java @@ -4,9 +4,9 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.Iterator; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeRemoveComponent.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeRemoveComponent.java index fcb40e8baae..4bf26a89603 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeRemoveComponent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/BeforeRemoveComponent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.entity.lifecycleEvents; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * When a component is about to be removed from an entity, or an entity is about to be destroyed, this event is sent. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnActivatedComponent.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnActivatedComponent.java index be370490420..f4da8e6557a 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnActivatedComponent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnActivatedComponent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.entity.lifecycleEvents; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event occurs after an entity is created, an entity is loaded or a component is added to an entity. This occurs diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnAddedComponent.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnAddedComponent.java index f1c7642a04e..043880019c7 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnAddedComponent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnAddedComponent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.entity.lifecycleEvents; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent when an entity is created or a component added to an existing entity. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnChangedComponent.java b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnChangedComponent.java index 8eb63bb7426..98911ffc5e7 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnChangedComponent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/entity/lifecycleEvents/OnChangedComponent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.entity.lifecycleEvents; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event occurs whenever a component is changed and saved. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/AbstractValueModifiableEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/AbstractValueModifiableEvent.java index 6a0a5ce2346..fd146a2aed2 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/AbstractValueModifiableEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/AbstractValueModifiableEvent.java @@ -5,6 +5,7 @@ import gnu.trove.iterator.TFloatIterator; import gnu.trove.list.TFloatList; import gnu.trove.list.array.TFloatArrayList; +import org.terasology.gestalt.entitysystem.event.Event; /** * A generic event for getting a value for a property. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/Activity.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/Activity.java new file mode 100644 index 00000000000..1992324e9df --- /dev/null +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/Activity.java @@ -0,0 +1,14 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.terasology.engine.entitySystem.event; + +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; + +/** + * Additional for {@link ReceiveEvent}. + * Activate performance monitoring for Event Handler. + */ +public @interface Activity { + String value(); +} diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/BeforeAfterEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/BeforeAfterEvent.java index e15525230ee..3d9ae875ff3 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/BeforeAfterEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/BeforeAfterEvent.java @@ -3,6 +3,8 @@ package org.terasology.engine.entitySystem.event; +import org.terasology.gestalt.entitysystem.event.Event; + /** * Immutable event to notify a change in a certain value. *

diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/ConsumableEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/ConsumableEvent.java index 1d57ab88dfd..d51dae216a7 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/ConsumableEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/ConsumableEvent.java @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.entitySystem.event; +import org.terasology.gestalt.entitysystem.event.Event; + /** * A consumable event is an event that can be prevented from continuing through remaining event receivers. This is * primarily useful for input event. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/Event.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/Event.java deleted file mode 100644 index 2981525854b..00000000000 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/Event.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2021 The Terasology Foundation -// SPDX-License-Identifier: Apache-2.0 -package org.terasology.engine.entitySystem.event; - -/** - * Marker interface for classes that can be sent to entities as events - * - */ -public interface Event { -} diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/PendingEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/PendingEvent.java index b95b0d5edf2..937dfb2986b 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/PendingEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/PendingEvent.java @@ -5,6 +5,7 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; public class PendingEvent { private EntityRef entity; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/Priority.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/Priority.java new file mode 100644 index 00000000000..4613156f8bf --- /dev/null +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/Priority.java @@ -0,0 +1,20 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.terasology.engine.entitySystem.event; + +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Provide priority possible for events. use with {@link ReceiveEvent} + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Priority { + int value(); +} diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/ReceiveEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/ReceiveEvent.java deleted file mode 100644 index 7b6e8cdfa76..00000000000 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/ReceiveEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 The Terasology Foundation -// SPDX-License-Identifier: Apache-2.0 -package org.terasology.engine.entitySystem.event; - -import org.terasology.engine.entitySystem.systems.RegisterMode; -import org.terasology.gestalt.entitysystem.component.Component; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation is used to mark up methods that can be registered to receive events through the EventSystem - *

- * These methods should have the form - * public void handlerMethod(EventType event, EntityRef entity) - * - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface ReceiveEvent { - /** - * What components that the entity must have for this method to be invoked - */ - Class[] components() default {}; - - RegisterMode netFilter() default RegisterMode.ALWAYS; - - int priority() default EventPriority.PRIORITY_NORMAL; - - String activity() default ""; -} diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventReceiver.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventReceiver.java index 1cca11746ec..2d2348b41b8 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventReceiver.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventReceiver.java @@ -4,7 +4,7 @@ package org.terasology.engine.entitySystem.event.internal; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Interface for a single event receiver diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystem.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystem.java index 9d07b5f2425..4ddfaa55ebf 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystem.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystem.java @@ -3,10 +3,10 @@ package org.terasology.engine.entitySystem.event.internal; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.systems.ComponentSystem; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event system propagates events to registered handlers @@ -28,7 +28,7 @@ public interface EventSystem { void registerEvent(ResourceUrn uri, Class eventType); /** - * Registers an object as an event handler - all methods with the {@link org.terasology.engine.entitySystem.event.ReceiveEvent} + * Registers an object as an event handler - all methods with the {@link org.terasology.gestalt.entitysystem.event.ReceiveEvent} * annotation will be registered * * @param handler diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystemImpl.java b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystemImpl.java index f1ca75223f7..6fccd116dc4 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystemImpl.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/event/internal/EventSystemImpl.java @@ -19,16 +19,20 @@ import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.event.AbstractConsumableEvent; +import org.terasology.engine.entitySystem.event.Activity; import org.terasology.engine.entitySystem.event.ConsumableEvent; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.EventPriority; import org.terasology.engine.entitySystem.event.PendingEvent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; +import org.terasology.engine.entitySystem.event.Priority; import org.terasology.engine.entitySystem.systems.ComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.monitoring.PerformanceMonitor; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import javax.annotation.Nullable; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; @@ -99,9 +103,26 @@ public void registerEventHandler(ComponentSystem handler) { for (Method method : handlerClass.getMethods()) { ReceiveEvent receiveEventAnnotation = method.getAnnotation(ReceiveEvent.class); if (receiveEventAnnotation != null) { - if (!receiveEventAnnotation.netFilter().isValidFor(isAutority, false)) { + + NetFilterEvent netFilterAnnotation = method.getAnnotation(NetFilterEvent.class); + if (netFilterAnnotation != null && !netFilterAnnotation.netFilter().isValidFor(isAutority, false)) { continue; } + + int priority; + Priority priorityAnnotation = method.getAnnotation(Priority.class); + if (priorityAnnotation != null) { + priority = priorityAnnotation.value(); + } else { + priority = EventPriority.PRIORITY_NORMAL; + } + + String activity = null; + Activity activityAnnotation = method.getAnnotation(Activity.class); + if (activityAnnotation != null) { + activity = activityAnnotation.value(); + } + Set> requiredComponents = Sets.newLinkedHashSet(); method.setAccessible(true); Class[] types = method.getParameterTypes(); @@ -123,10 +144,9 @@ public void registerEventHandler(ComponentSystem handler) { requiredComponents.add((Class) types[i]); componentParams.add((Class) types[i]); } - ByteCodeEventHandlerInfo handlerInfo = new ByteCodeEventHandlerInfo(handler, method, - receiveEventAnnotation.priority(), - receiveEventAnnotation.activity(), requiredComponents, componentParams); + priority, + activity, requiredComponents, componentParams); addEventHandler((Class) types[0], handlerInfo, requiredComponents); } } @@ -333,7 +353,7 @@ private static class ByteCodeEventHandlerInfo implements EventHandlerInfo { ByteCodeEventHandlerInfo(ComponentSystem handler, Method method, int priority, - String activity, + @Nullable String activity, Collection> filterComponents, Collection> componentParams) { @@ -372,13 +392,13 @@ public void invoke(EntityRef entity, Event event) { } - if (!activity.isEmpty()) { + if (activity != null) { PerformanceMonitor.startActivity(activity); } try { methodAccess.invoke(handler, methodIndex, params); } finally { - if (!activity.isEmpty()) { + if (activity != null) { PerformanceMonitor.endActivity(); } } diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventLibrary.java b/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventLibrary.java index d65a6d49b49..2b90088af09 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventLibrary.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventLibrary.java @@ -5,7 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.gestalt.assets.ResourceUrn; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.ModuleEnvironment; import org.terasology.reflection.copy.CopyStrategyLibrary; import org.terasology.reflection.metadata.ClassMetadata; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventMetadata.java b/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventMetadata.java index 3395bd13d9a..2a73a84f75d 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventMetadata.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/metadata/EventMetadata.java @@ -5,15 +5,15 @@ import com.google.common.base.Predicates; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.terasology.engine.network.BroadcastEvent; +import org.terasology.engine.network.OwnerEvent; +import org.terasology.engine.network.ServerEvent; import org.terasology.gestalt.assets.ResourceUrn; -import org.terasology.reflection.metadata.ClassMetadata; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.reflection.copy.CopyStrategyLibrary; +import org.terasology.reflection.metadata.ClassMetadata; import org.terasology.reflection.reflect.InaccessibleFieldException; import org.terasology.reflection.reflect.ReflectFactory; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.engine.network.BroadcastEvent; -import org.terasology.engine.network.OwnerEvent; -import org.terasology.engine.network.ServerEvent; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/LoadedSectorUpdateEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/LoadedSectorUpdateEvent.java index f9fa8df4983..008a9d7267c 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/LoadedSectorUpdateEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/LoadedSectorUpdateEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.sectors; import org.joml.Vector3i; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityLoad.java b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityLoad.java index e78cb9935d2..3ca0f233f9e 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityLoad.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityLoad.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.entitySystem.sectors; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event sent to sector-scope entities when the first of its watched chunks load. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityUnload.java b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityUnload.java index ac550590ee7..3674a914c88 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityUnload.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorEntityUnload.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.entitySystem.sectors; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event sent to sector-scope entities when all of its watched chunks unload. diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationEvent.java index caf69c51f71..005bda9000d 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationEvent.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.entitySystem.sectors; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; /** diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationSystem.java b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationSystem.java index 40501d80fda..3ffaeb312ad 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationSystem.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/sectors/SectorSimulationSystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeRemoveComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.delay.DelayManager; @@ -20,6 +19,7 @@ import org.terasology.engine.world.chunks.ChunkProvider; import org.terasology.engine.world.chunks.event.BeforeChunkUnload; import org.terasology.engine.world.chunks.event.OnChunkLoaded; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.stream.Collectors; diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/systems/NetFilterEvent.java b/engine/src/main/java/org/terasology/engine/entitySystem/systems/NetFilterEvent.java new file mode 100644 index 00000000000..4b0ba248ed3 --- /dev/null +++ b/engine/src/main/java/org/terasology/engine/entitySystem/systems/NetFilterEvent.java @@ -0,0 +1,20 @@ +// Copyright 2021 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.terasology.engine.entitySystem.systems; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks event handlers condition. when should be registered. {@link RegisterMode} + * Using with {@link org.terasology.gestalt.entitysystem.event.ReceiveEvent} + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface NetFilterEvent { + + RegisterMode netFilter(); +} diff --git a/engine/src/main/java/org/terasology/engine/entitySystem/systems/UpdateSubscriberSystem.java b/engine/src/main/java/org/terasology/engine/entitySystem/systems/UpdateSubscriberSystem.java index a26713afc57..60593025c4f 100644 --- a/engine/src/main/java/org/terasology/engine/entitySystem/systems/UpdateSubscriberSystem.java +++ b/engine/src/main/java/org/terasology/engine/entitySystem/systems/UpdateSubscriberSystem.java @@ -12,8 +12,8 @@ * In most cases it will be sufficient to: *

    *
  • - * use {@link org.terasology.engine.entitySystem.event.ReceiveEvent} - * to update the system on specific events ({@link org.terasology.engine.entitySystem.event.Event}), + * use {@link org.terasology.gestalt.entitysystem.event.ReceiveEvent} + * to update the system on specific events ({@link org.terasology.gestalt.entitysystem.event.Event}), *
  • *
  • * use {@link DelayManager} to update entities or to call a diff --git a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOutEvent.java b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOutEvent.java index 8ef4bf8dc33..e6ba561e946 100644 --- a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOutEvent.java +++ b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOutEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.input.cameraTarget; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event when the camera ceases to be over an entity - sent to the involved entity diff --git a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOverEvent.java b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOverEvent.java index fbd28a39e1f..48a2d1779f7 100644 --- a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOverEvent.java +++ b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraOverEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.input.cameraTarget; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent when the camera starts pointing at a target, to the target diff --git a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraTargetChangedEvent.java b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraTargetChangedEvent.java index 7b39d9c3b8a..e0b4379fed0 100644 --- a/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraTargetChangedEvent.java +++ b/engine/src/main/java/org/terasology/engine/input/cameraTarget/CameraTargetChangedEvent.java @@ -4,7 +4,7 @@ package org.terasology.engine.input.cameraTarget; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class CameraTargetChangedEvent implements Event { private EntityRef oldTarget; diff --git a/engine/src/main/java/org/terasology/engine/logic/actions/PlaySoundAction.java b/engine/src/main/java/org/terasology/engine/logic/actions/PlaySoundAction.java index 7d7b9eaf323..95bb6a06d46 100644 --- a/engine/src/main/java/org/terasology/engine/logic/actions/PlaySoundAction.java +++ b/engine/src/main/java/org/terasology/engine/logic/actions/PlaySoundAction.java @@ -6,16 +6,16 @@ import org.terasology.engine.audio.AudioManager; import org.terasology.engine.audio.StaticSound; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; -import org.terasology.engine.logic.players.LocalPlayer; import org.terasology.engine.logic.characters.events.ActivationPredicted; import org.terasology.engine.logic.common.ActivateEvent; +import org.terasology.engine.logic.players.LocalPlayer; import org.terasology.engine.registry.In; import org.terasology.engine.utilities.random.FastRandom; import org.terasology.engine.utilities.random.Random; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This systems handles the playing of sounds in response to events, on both server and client, diff --git a/engine/src/main/java/org/terasology/engine/logic/actions/SpawnPrefabAction.java b/engine/src/main/java/org/terasology/engine/logic/actions/SpawnPrefabAction.java index ec089ef7cd2..8caf43a7311 100644 --- a/engine/src/main/java/org/terasology/engine/logic/actions/SpawnPrefabAction.java +++ b/engine/src/main/java/org/terasology/engine/logic/actions/SpawnPrefabAction.java @@ -6,12 +6,12 @@ import org.joml.Vector3f; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.common.ActivateEvent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class SpawnPrefabAction extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/afk/AfkAuthoritySystem.java b/engine/src/main/java/org/terasology/engine/logic/afk/AfkAuthoritySystem.java index 4613df7338d..b0a8e12dc62 100644 --- a/engine/src/main/java/org/terasology/engine/logic/afk/AfkAuthoritySystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/afk/AfkAuthoritySystem.java @@ -4,7 +4,6 @@ import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -16,6 +15,7 @@ import org.terasology.engine.network.events.ConnectedEvent; import org.terasology.engine.network.events.DisconnectedEvent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class AfkAuthoritySystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/afk/AfkClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/afk/AfkClientSystem.java index fe1a1fb1367..cbfcd91b3f2 100644 --- a/engine/src/main/java/org/terasology/engine/logic/afk/AfkClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/afk/AfkClientSystem.java @@ -7,7 +7,7 @@ import org.terasology.engine.core.Time; 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -22,6 +22,7 @@ import org.terasology.engine.physics.events.MovedEvent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.nui.NUIManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.input.Keyboard; @RegisterSystem(RegisterMode.CLIENT) @@ -125,7 +126,8 @@ public void onMove(MovedEvent movedEvent, EntityRef entity) { } } - @ReceiveEvent(priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent public void onKeyDown(KeyDownEvent event, EntityRef entity) { if (requireConnection()) { return; diff --git a/engine/src/main/java/org/terasology/engine/logic/behavior/BehaviorSystem.java b/engine/src/main/java/org/terasology/engine/logic/behavior/BehaviorSystem.java index d71cde4b189..3b8c033bdff 100644 --- a/engine/src/main/java/org/terasology/engine/logic/behavior/BehaviorSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/behavior/BehaviorSystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.prefab.PrefabManager; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; @@ -25,6 +24,7 @@ import org.terasology.engine.registry.Share; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.gestalt.naming.Name; import java.io.FileOutputStream; diff --git a/engine/src/main/java/org/terasology/engine/logic/behavior/CollectiveBehaviorSystem.java b/engine/src/main/java/org/terasology/engine/logic/behavior/CollectiveBehaviorSystem.java index 5e7b0f8b5e2..2cd55e01cac 100644 --- a/engine/src/main/java/org/terasology/engine/logic/behavior/CollectiveBehaviorSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/behavior/CollectiveBehaviorSystem.java @@ -11,7 +11,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.prefab.PrefabManager; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; @@ -26,6 +25,7 @@ import org.terasology.engine.registry.Share; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.gestalt.naming.Name; import java.io.FileOutputStream; diff --git a/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeClientSystem.java index 53cf06df633..e949307bee8 100644 --- a/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeClientSystem.java @@ -4,15 +4,15 @@ package org.terasology.engine.logic.behavior.nui; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; -import org.terasology.input.ButtonState; import org.terasology.engine.logic.console.Console; import org.terasology.engine.logic.console.CoreMessageType; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.ButtonState; @RegisterSystem(RegisterMode.REMOTE_CLIENT) public class BehaviorTreeClientSystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeEditorSystem.java b/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeEditorSystem.java index 9842909ad2b..96aff859fec 100644 --- a/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeEditorSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/behavior/nui/BehaviorTreeEditorSystem.java @@ -3,14 +3,14 @@ package org.terasology.engine.logic.behavior.nui; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; -import org.terasology.input.ButtonState; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.nui.NUIManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.ButtonState; /** * Opens the bt editor screen. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterHeldItemAuthoritySystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterHeldItemAuthoritySystem.java index 4b8b3dce858..6a2543a6d50 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterHeldItemAuthoritySystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterHeldItemAuthoritySystem.java @@ -3,11 +3,11 @@ package org.terasology.engine.logic.characters; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.characters.events.ChangeHeldItemRequest; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class CharacterHeldItemAuthoritySystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterImpulseEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterImpulseEvent.java index f1834096bed..79de023da37 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterImpulseEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterImpulseEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.characters; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class CharacterImpulseEvent implements Event { Vector3f direction; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterScalingSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterScalingSystem.java index 845eaab9c61..96f0447796d 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterScalingSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterScalingSystem.java @@ -4,13 +4,14 @@ 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.characters.events.OnScaleEvent; import org.terasology.engine.logic.characters.events.ScaleByRequest; import org.terasology.engine.logic.characters.events.ScaleToRequest; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * Authority system to finally "accept" scaling requests. @@ -26,14 +27,16 @@ @RegisterSystem(RegisterMode.AUTHORITY) public class CharacterScalingSystem extends BaseComponentSystem { - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onScaleByRequest(ScaleByRequest request, EntityRef entity, CharacterMovementComponent movementComponent) { OnScaleEvent scaleEvent = new OnScaleEvent(movementComponent.height, movementComponent.height * request.getFactor()); entity.send(scaleEvent); request.consume(); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onScaleToRequest(ScaleToRequest request, EntityRef entity, CharacterMovementComponent movementComponent) { OnScaleEvent scaleEvent = new OnScaleEvent(movementComponent.height, request.getTargetValue()); entity.send(scaleEvent); diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSoundSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSoundSystem.java index 68ce0a95602..7a370b141a7 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSoundSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSoundSystem.java @@ -11,7 +11,6 @@ import org.terasology.engine.audio.events.PlaySoundEvent; import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -29,6 +28,7 @@ import org.terasology.engine.utilities.random.Random; import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.Block; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSystem.java index f5b07827dc7..d2378ce332c 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterSystem.java @@ -11,9 +11,10 @@ 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.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; @@ -49,6 +50,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.world.block.BlockComponent; import org.terasology.engine.world.block.regions.ActAsBlockComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Optional; @@ -168,7 +170,8 @@ public String getDamageTypeName(Prefab damageType) { } } - @ReceiveEvent(components = CharacterComponent.class, netFilter = RegisterMode.CLIENT) + @NetFilterEvent(netFilter = RegisterMode.CLIENT) + @ReceiveEvent(components = CharacterComponent.class) public void onAttackRequest(AttackButton event, EntityRef entity, CharacterHeldItemComponent characterHeldItemComponent) { if (!event.isDown()) { return; @@ -191,7 +194,8 @@ public void onAttackRequest(AttackButton event, EntityRef entity, CharacterHeldI } } - @ReceiveEvent(components = LocationComponent.class, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent(components = LocationComponent.class) public void onAttackRequest(AttackRequest event, EntityRef character, CharacterComponent characterComponent) { // if an item is used, make sure this entity is allowed to attack with it if (event.getItem().exists()) { @@ -254,17 +258,22 @@ public void onItemUse(OnItemUseEvent event, EntityRef entity, CharacterHeldItemC entity.saveComponent(characterHeldItemComponent); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onAttackBlock(AttackEvent event, EntityRef entityRef, BlockComponent blockComponent) { entityRef.send(new DestroyEvent(event.getInstigator(), event.getDirectCause(), EngineDamageTypes.PHYSICAL.get())); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onAttackBlock(AttackEvent event, EntityRef entityRef, ActAsBlockComponent actAsBlockComponent) { entityRef.send(new DestroyEvent(event.getInstigator(), event.getDirectCause(), EngineDamageTypes.PHYSICAL.get())); } - @ReceiveEvent(components = {CharacterComponent.class, LocationComponent.class}, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent(components = {CharacterComponent.class, LocationComponent.class}) public void onActivationRequest(ActivationRequest event, EntityRef character) { if (isPredictionOfEventCorrect(character, event)) { OnItemUseEvent onItemUseEvent = new OnItemUseEvent(); diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterTeleportEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterTeleportEvent.java index 0cc580e4eeb..d8aec3bf417 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/CharacterTeleportEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/CharacterTeleportEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.characters; import org.joml.Vector3fc; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Used within the server to trigger a teleport of a character. Just chaining the position is not possible due to diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/ClientCharacterPredictionSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/ClientCharacterPredictionSystem.java index 1f9c27bc09e..62baef30dc1 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/ClientCharacterPredictionSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/ClientCharacterPredictionSystem.java @@ -13,7 +13,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -25,6 +24,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.utilities.collection.CircularBuffer; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Deque; import java.util.Iterator; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/GazeAuthoritySystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/GazeAuthoritySystem.java index b444543aa87..68f5c1703c5 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/GazeAuthoritySystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/GazeAuthoritySystem.java @@ -11,7 +11,7 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -19,6 +19,7 @@ import org.terasology.engine.logic.location.Location; import org.terasology.engine.logic.location.LocationComponent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * Gaze describes where the character is looking. @@ -51,7 +52,8 @@ private EntityRef createGazeEntity() { return gazeEntity; } - @ReceiveEvent(priority = EventPriority.PRIORITY_LOW) + @Priority(EventPriority.PRIORITY_LOW) + @ReceiveEvent public void onScaleCharacter(OnScaleEvent event, EntityRef entity, GazeMountPointComponent gazeMountPoint) { // adjust character eye level // set eye level based on "average" body decomposition for human-like figures into 7.5 "heads". diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/ServerCharacterPredictionSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/ServerCharacterPredictionSystem.java index f6e1bc2a48f..f3b9032343f 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/ServerCharacterPredictionSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/ServerCharacterPredictionSystem.java @@ -14,7 +14,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -32,6 +31,7 @@ import org.terasology.engine.registry.Share; import org.terasology.engine.utilities.collection.CircularBuffer; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.List; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/VisualCharacterSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/VisualCharacterSystem.java index ea1e078c9a1..17cc0b1c0df 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/VisualCharacterSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/VisualCharacterSystem.java @@ -11,7 +11,7 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; @@ -22,6 +22,7 @@ import org.terasology.engine.logic.players.LocalPlayer; import org.terasology.engine.registry.In; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system is responsible for sending a {@link CreateVisualCharacterEvent} according to how it is specified in @@ -104,7 +105,8 @@ public void onAwaitedLocalCharacterSpawnEvent(AwaitedLocalCharacterSpawnEvent ev } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onCreateDefaultVisualCharacter(CreateVisualCharacterEvent event, EntityRef characterEntity) { Prefab prefab = assetManager.getAsset("engine:defaultVisualCharacter", Prefab.class).get(); EntityBuilder entityBuilder = event.getVisualCharacterBuilder(); diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/ActivationRequestDenied.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/ActivationRequestDenied.java index 948acce084a..50bb193651c 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/ActivationRequestDenied.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/ActivationRequestDenied.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is attached to the character. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/ChangeHeldItemRequest.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/ChangeHeldItemRequest.java index 7d976925111..3e8d9b5ef75 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/ChangeHeldItemRequest.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/ChangeHeldItemRequest.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.characters.events; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; @ServerEvent public class ChangeHeldItemRequest implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/CollisionEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/CollisionEvent.java index 6d7d6f24e21..5325a85ec6b 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/CollisionEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/CollisionEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.characters.events; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class CollisionEvent implements Event { private Vector3f velocity; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/DeathEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/DeathEvent.java index 1d7da24302c..64b9cb4cd7f 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/DeathEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/DeathEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent to the client entity when the character dies. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/FootstepEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/FootstepEvent.java index 8e8836ba1a8..1416f15db7d 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/FootstepEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/FootstepEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class FootstepEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/JumpEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/JumpEvent.java index f594b3244d2..ab44c5b7aaa 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/JumpEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/JumpEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class JumpEvent implements Event { } diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/OnEnterBlockEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/OnEnterBlockEvent.java index 9852efd29c7..d7030386c5a 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/OnEnterBlockEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/OnEnterBlockEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.characters.events; import org.joml.Vector3i; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.block.Block; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event gets sent to the player entity when it enters a new block. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/OnScaleEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/OnScaleEvent.java index 25be0751674..3c312184be1 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/OnScaleEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/OnScaleEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Immutable event to notify that a character entity is scaled. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/PlayerDeathEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/PlayerDeathEvent.java index 2a07ae9f6a7..eb6b56b7cc7 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/PlayerDeathEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/PlayerDeathEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent to the player entity when the player dies. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/SetMovementModeEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/SetMovementModeEvent.java index b4b1265ece7..c40e0f1de8c 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/SetMovementModeEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/SetMovementModeEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.logic.characters.MovementMode; +import org.terasology.gestalt.entitysystem.event.Event; public class SetMovementModeEvent implements Event { private MovementMode mode; diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/events/SwimStrokeEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/events/SwimStrokeEvent.java index 1e08af8459a..e475f164bc7 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/events/SwimStrokeEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/events/SwimStrokeEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.block.Block; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent when a character moves far enough to trigger a swim stroke (similar to a footstep on land) diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndEvent.java b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndEvent.java index 3e3abb60977..9b71317ba6b 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.interactions; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Represents the end of an interaction between for example a character and a container. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndPredicted.java b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndPredicted.java index 1969229ea66..6d4bd1c89aa 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndPredicted.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndPredicted.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.characters.interactions; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; /** diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndRequest.java b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndRequest.java index db6ff98c846..b9d51ec4c28 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndRequest.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionEndRequest.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.characters.interactions; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Request the server to cancel the current interaction. diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionStartPredicted.java b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionStartPredicted.java index 60a2c8002e7..c70845f5e90 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionStartPredicted.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionStartPredicted.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.characters.interactions; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; /** diff --git a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionSystem.java b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionSystem.java index 062a4cdd960..7cf6f584197 100644 --- a/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/characters/interactions/InteractionSystem.java @@ -4,20 +4,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.characters.CharacterComponent; -import org.terasology.engine.logic.common.ActivateEvent; import org.terasology.engine.logic.characters.events.ActivationPredicted; import org.terasology.engine.logic.characters.events.ActivationRequestDenied; +import org.terasology.engine.logic.common.ActivateEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.nui.NUIManager; import org.terasology.engine.rendering.nui.ScreenLayerClosedEvent; +import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.ALWAYS) public class InteractionSystem extends BaseComponentSystem { @@ -26,7 +27,8 @@ public class InteractionSystem extends BaseComponentSystem { @In private NUIManager nuiManager; - @ReceiveEvent(components = InteractionTargetComponent.class, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent(components = InteractionTargetComponent.class) public void onActivate(ActivateEvent event, EntityRef target) { EntityRef instigator = event.getInstigator(); @@ -64,12 +66,14 @@ public void onActivationPredicted(ActivationPredicted event, EntityRef target) { } } - @ReceiveEvent(components = CharacterComponent.class, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent(components = CharacterComponent.class) public void onActivationRequestDenied(ActivationRequestDenied event, EntityRef character) { character.send(new InteractionEndEvent(event.getActivationId())); } - @ReceiveEvent(netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent public void onInteractionEndRequest(InteractionEndRequest request, EntityRef instigator) { InteractionUtil.cancelInteractionAsServer(instigator); } diff --git a/engine/src/main/java/org/terasology/engine/logic/chat/ChatSystem.java b/engine/src/main/java/org/terasology/engine/logic/chat/ChatSystem.java index fc0ea85081b..8d82d4be69f 100644 --- a/engine/src/main/java/org/terasology/engine/logic/chat/ChatSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/chat/ChatSystem.java @@ -7,7 +7,6 @@ import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.input.binds.general.ChatButton; @@ -26,6 +25,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.rendering.nui.NUIManager; import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.input.ButtonState; import org.terasology.nui.FontColor; diff --git a/engine/src/main/java/org/terasology/engine/logic/common/lifespan/LifespanSystem.java b/engine/src/main/java/org/terasology/engine/logic/common/lifespan/LifespanSystem.java index 0ab4f61d5b1..2d0dfd68f95 100644 --- a/engine/src/main/java/org/terasology/engine/logic/common/lifespan/LifespanSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/common/lifespan/LifespanSystem.java @@ -7,12 +7,12 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class LifespanSystem extends BaseComponentSystem implements UpdateSubscriberSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/console/CommandEvent.java b/engine/src/main/java/org/terasology/engine/logic/console/CommandEvent.java index 091bdc6d809..b6810fdcd36 100644 --- a/engine/src/main/java/org/terasology/engine/logic/console/CommandEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/console/CommandEvent.java @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.console; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.gestalt.naming.Name; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.naming.Name; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/logic/console/ConsoleSystem.java b/engine/src/main/java/org/terasology/engine/logic/console/ConsoleSystem.java index 99e6f701266..eb2a5e7794e 100644 --- a/engine/src/main/java/org/terasology/engine/logic/console/ConsoleSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/console/ConsoleSystem.java @@ -4,8 +4,9 @@ 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.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.input.binds.general.ConsoleButton; @@ -14,6 +15,7 @@ import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.nui.NUIManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.input.ButtonState; @RegisterSystem @@ -43,7 +45,8 @@ public void initialise() { } } - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_CRITICAL) + @Priority(EventPriority.PRIORITY_CRITICAL) + @ReceiveEvent(components = ClientComponent.class) public void onToggleConsole(ConsoleButton event, EntityRef entity) { if (event.getState() == ButtonState.UP) { nuiManager.toggleScreen("engine:console"); @@ -60,7 +63,8 @@ public void onMessage(MessageEvent event, EntityRef entity) { } } - @ReceiveEvent(components = ClientComponent.class, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @ReceiveEvent(components = ClientComponent.class) public void onCommand(CommandEvent event, EntityRef entity) { ConsoleCommand cmd = console.getCommand(event.getCommandName()); diff --git a/engine/src/main/java/org/terasology/engine/logic/console/MessageEvent.java b/engine/src/main/java/org/terasology/engine/logic/console/MessageEvent.java index 1bede4ceb2d..64f0c48d840 100644 --- a/engine/src/main/java/org/terasology/engine/logic/console/MessageEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/console/MessageEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.logic.console; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; @FunctionalInterface public interface MessageEvent extends Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/debug/ChunkEventErrorLogger.java b/engine/src/main/java/org/terasology/engine/logic/debug/ChunkEventErrorLogger.java index 99cc9319ce9..7345a4d25c8 100644 --- a/engine/src/main/java/org/terasology/engine/logic/debug/ChunkEventErrorLogger.java +++ b/engine/src/main/java/org/terasology/engine/logic/debug/ChunkEventErrorLogger.java @@ -7,12 +7,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.world.WorldComponent; import org.terasology.engine.world.chunks.event.BeforeChunkUnload; import org.terasology.engine.world.chunks.event.OnChunkLoaded; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionSystem.java b/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionSystem.java index 5408a6ab510..e7cfb9b9b7e 100644 --- a/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionSystem.java @@ -11,13 +11,13 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.engine.registry.In; import org.terasology.engine.registry.Share; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Iterator; import java.util.LinkedList; diff --git a/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionTriggeredEvent.java b/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionTriggeredEvent.java index 4112e3b45b9..0bdca1e41af 100644 --- a/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionTriggeredEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/delay/DelayedActionTriggeredEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.delay; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class DelayedActionTriggeredEvent implements Event { private String actionId; diff --git a/engine/src/main/java/org/terasology/engine/logic/delay/PeriodicActionTriggeredEvent.java b/engine/src/main/java/org/terasology/engine/logic/delay/PeriodicActionTriggeredEvent.java index 261efc26b3b..f89ef2caabf 100644 --- a/engine/src/main/java/org/terasology/engine/logic/delay/PeriodicActionTriggeredEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/delay/PeriodicActionTriggeredEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.delay; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class PeriodicActionTriggeredEvent implements Event { private String actionId; diff --git a/engine/src/main/java/org/terasology/engine/logic/health/DestroyEvent.java b/engine/src/main/java/org/terasology/engine/logic/health/DestroyEvent.java index f96eace9483..dbcdda996d1 100644 --- a/engine/src/main/java/org/terasology/engine/logic/health/DestroyEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/health/DestroyEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.health; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; +import org.terasology.gestalt.entitysystem.event.Event; /** * Sent to request the destruction of an entity. diff --git a/engine/src/main/java/org/terasology/engine/logic/health/DoDestroyEvent.java b/engine/src/main/java/org/terasology/engine/logic/health/DoDestroyEvent.java index 2a777581a33..707df3d7a83 100644 --- a/engine/src/main/java/org/terasology/engine/logic/health/DoDestroyEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/health/DoDestroyEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.health; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; +import org.terasology.gestalt.entitysystem.event.Event; /** * Sent when the entity is destroyed. diff --git a/engine/src/main/java/org/terasology/engine/logic/health/EntityDestructionAuthoritySystem.java b/engine/src/main/java/org/terasology/engine/logic/health/EntityDestructionAuthoritySystem.java index c00b9387761..84b503ca96d 100644 --- a/engine/src/main/java/org/terasology/engine/logic/health/EntityDestructionAuthoritySystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/health/EntityDestructionAuthoritySystem.java @@ -3,13 +3,13 @@ package org.terasology.engine.logic.health; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.characters.CharacterComponent; import org.terasology.engine.telemetry.GamePlayStatsComponent; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/logic/inventory/ItemCommonSystem.java b/engine/src/main/java/org/terasology/engine/logic/inventory/ItemCommonSystem.java index 56972e05024..38951c4da69 100644 --- a/engine/src/main/java/org/terasology/engine/logic/inventory/ItemCommonSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/inventory/ItemCommonSystem.java @@ -7,7 +7,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.rendering.iconmesh.IconMeshFactory; @@ -18,6 +17,7 @@ import org.terasology.engine.utilities.random.Random; import org.terasology.engine.world.block.family.BlockFamily; import org.terasology.engine.world.block.items.BlockItemComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system adds meshes to items that have RenderItemBlockMeshComponent or RenderItemIconMeshComponent diff --git a/engine/src/main/java/org/terasology/engine/logic/inventory/ItemPickupAuthoritySystem.java b/engine/src/main/java/org/terasology/engine/logic/inventory/ItemPickupAuthoritySystem.java index 8850ae2c2d3..832ee1b0d38 100644 --- a/engine/src/main/java/org/terasology/engine/logic/inventory/ItemPickupAuthoritySystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/inventory/ItemPickupAuthoritySystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.metadata.EntitySystemLibrary; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; @@ -25,6 +24,7 @@ import org.terasology.engine.world.block.family.BlockFamily; import org.terasology.engine.world.block.items.BlockItemComponent; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system uses the pickup prefab on an item component to add on extra components needed for the item to display in the world. diff --git a/engine/src/main/java/org/terasology/engine/logic/inventory/events/DropItemEvent.java b/engine/src/main/java/org/terasology/engine/logic/inventory/events/DropItemEvent.java index 9a6b4eafae3..c92f0564cff 100644 --- a/engine/src/main/java/org/terasology/engine/logic/inventory/events/DropItemEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/inventory/events/DropItemEvent.java @@ -4,8 +4,8 @@ import org.joml.Vector3f; import org.joml.Vector3fc; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Fire this event on an item in order for the authority to add the necessary components to put it in the world. diff --git a/engine/src/main/java/org/terasology/engine/logic/inventory/events/GiveItemEvent.java b/engine/src/main/java/org/terasology/engine/logic/inventory/events/GiveItemEvent.java index 1775bcfaed8..ce5bbac8be7 100644 --- a/engine/src/main/java/org/terasology/engine/logic/inventory/events/GiveItemEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/inventory/events/GiveItemEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.inventory.events; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Gives the entity to the target entity diff --git a/engine/src/main/java/org/terasology/engine/logic/location/Location.java b/engine/src/main/java/org/terasology/engine/logic/location/Location.java index 9513616acdc..ca000bd16dc 100644 --- a/engine/src/main/java/org/terasology/engine/logic/location/Location.java +++ b/engine/src/main/java/org/terasology/engine/logic/location/Location.java @@ -8,10 +8,11 @@ import org.joml.Vector3fc; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeRemoveComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Iterator; @@ -117,7 +118,8 @@ public void onDestroyed(BeforeRemoveComponent event, EntityRef entity, LocationC } } - @ReceiveEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @NetFilterEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @ReceiveEvent public void onResyncLocation(LocationResynchEvent event, EntityRef entityRef, LocationComponent locationComponent) { locationComponent.setWorldPosition(event.getPosition()); locationComponent.setWorldRotation(event.getRotation()); diff --git a/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedEvent.java b/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedEvent.java index 23f44147f69..20208df433e 100644 --- a/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedEvent.java @@ -7,7 +7,7 @@ import org.joml.Quaternionfc; import org.joml.Vector3f; import org.joml.Vector3fc; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * A notification event that the location and/or rotation of the associated entity has changed. diff --git a/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedSystem.java b/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedSystem.java index ef669c152ff..be0cd00c193 100644 --- a/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/location/LocationChangedSystem.java @@ -6,11 +6,11 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/logic/location/LocationResynchEvent.java b/engine/src/main/java/org/terasology/engine/logic/location/LocationResynchEvent.java index bc7b8db5411..3c237f7091c 100644 --- a/engine/src/main/java/org/terasology/engine/logic/location/LocationResynchEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/location/LocationResynchEvent.java @@ -4,8 +4,8 @@ import org.joml.Quaternionf; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class LocationResynchEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/nameTags/NameTagClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/nameTags/NameTagClientSystem.java index 8f2ea2d4f57..14a7f0ea955 100644 --- a/engine/src/main/java/org/terasology/engine/logic/nameTags/NameTagClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/nameTags/NameTagClientSystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -18,6 +17,7 @@ import org.terasology.engine.logic.location.LocationComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.logic.FloatingTextComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.HashMap; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/logic/nameTags/PlayerNameTagSystem.java b/engine/src/main/java/org/terasology/engine/logic/nameTags/PlayerNameTagSystem.java index 571807cdea6..5cdd5324ffb 100644 --- a/engine/src/main/java/org/terasology/engine/logic/nameTags/PlayerNameTagSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/nameTags/PlayerNameTagSystem.java @@ -7,19 +7,19 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.characters.CharacterComponent; -import org.terasology.engine.logic.players.event.OnPlayerSpawnedEvent; import org.terasology.engine.logic.common.DisplayNameComponent; +import org.terasology.engine.logic.players.event.OnPlayerSpawnedEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.ClientInfoComponent; import org.terasology.engine.network.ColorComponent; import org.terasology.engine.network.NetworkSystem; -import org.terasology.nui.Color; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.nui.Color; /** diff --git a/engine/src/main/java/org/terasology/engine/logic/notifications/NotificationSystem.java b/engine/src/main/java/org/terasology/engine/logic/notifications/NotificationSystem.java index 4231af2f665..7676f1ff8a0 100644 --- a/engine/src/main/java/org/terasology/engine/logic/notifications/NotificationSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/notifications/NotificationSystem.java @@ -5,13 +5,13 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.events.ConnectedEvent; import org.terasology.engine.network.events.DisconnectedEvent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system provides the ability to notify one or more client about certain events. diff --git a/engine/src/main/java/org/terasology/engine/logic/players/CameraClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/CameraClientSystem.java index babdacd1d2d..a8e3a674708 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/CameraClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/CameraClientSystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.internal.EntityScope; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -23,6 +22,7 @@ import org.terasology.engine.logic.players.event.ResetCameraEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This is a system that creates and maintains a client side entity for the camera. diff --git a/engine/src/main/java/org/terasology/engine/logic/players/DebugControlSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/DebugControlSystem.java index 814ca75da28..39d656a84bb 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/DebugControlSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/DebugControlSystem.java @@ -6,7 +6,7 @@ import org.terasology.engine.config.SystemConfig; 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -21,6 +21,7 @@ import org.terasology.engine.rendering.nui.NUIManager; import org.terasology.engine.rendering.nui.layers.ingame.metrics.DebugOverlay; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.input.Keyboard; @@ -133,7 +134,8 @@ public void onKeyDown(KeyDownEvent event, EntityRef entity) { } } - @ReceiveEvent(components = CharacterComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = CharacterComponent.class) public void onMouseX(MouseAxisEvent event, EntityRef entity) { if (!mouseGrabbed) { event.consume(); diff --git a/engine/src/main/java/org/terasology/engine/logic/players/FirstPersonClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/FirstPersonClientSystem.java index 4ea8e6ac90b..0aa96f74cd8 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/FirstPersonClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/FirstPersonClientSystem.java @@ -10,7 +10,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -26,6 +25,7 @@ import org.terasology.engine.rendering.logic.VisualComponent; import org.terasology.engine.rendering.world.WorldRenderer; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.math.TeraMath; @RegisterSystem(RegisterMode.CLIENT) diff --git a/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java index 806276cf671..5b9fa751251 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/LocalPlayerSystem.java @@ -12,7 +12,6 @@ import org.terasology.engine.core.Time; import org.terasology.engine.core.subsystem.config.BindsManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RenderSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; @@ -59,6 +58,7 @@ import org.terasology.engine.world.block.BlockComponent; import org.terasology.engine.world.block.regions.BlockRegionComponent; import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.input.ButtonState; import org.terasology.input.Input; import org.terasology.joml.geom.AABBf; diff --git a/engine/src/main/java/org/terasology/engine/logic/players/MenuControlSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/MenuControlSystem.java index 569df28e902..faa81625d64 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/MenuControlSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/MenuControlSystem.java @@ -6,15 +6,13 @@ import org.terasology.engine.audio.AudioManager; import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; -import org.terasology.engine.logic.characters.CharacterComponent; -import org.terasology.input.ButtonState; import org.terasology.engine.input.binds.general.OnlinePlayersButton; import org.terasology.engine.input.binds.general.PauseButton; import org.terasology.engine.input.binds.general.ScreenshotButton; +import org.terasology.engine.logic.characters.CharacterComponent; import org.terasology.engine.logic.characters.events.PlayerDeathEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.NetworkMode; @@ -26,6 +24,8 @@ import org.terasology.engine.rendering.nui.layers.ingame.OnlinePlayersOverlay; import org.terasology.engine.rendering.opengl.ScreenGrabber; import org.terasology.engine.utilities.Assets; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.ButtonState; /** diff --git a/engine/src/main/java/org/terasology/engine/logic/players/PlayerSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/PlayerSystem.java index 35c34f2650b..d7ec534e526 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/PlayerSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/PlayerSystem.java @@ -13,7 +13,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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -21,12 +21,12 @@ import org.terasology.engine.logic.characters.AliveCharacterComponent; import org.terasology.engine.logic.characters.CharacterComponent; import org.terasology.engine.logic.characters.CharacterTeleportEvent; +import org.terasology.engine.logic.health.BeforeDestroyEvent; import org.terasology.engine.logic.location.Location; import org.terasology.engine.logic.location.LocationComponent; import org.terasology.engine.logic.players.event.OnPlayerRespawnedEvent; import org.terasology.engine.logic.players.event.OnPlayerSpawnedEvent; import org.terasology.engine.logic.players.event.RespawnRequestEvent; -import org.terasology.engine.logic.health.BeforeDestroyEvent; import org.terasology.engine.network.Client; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.NetworkSystem; @@ -39,6 +39,7 @@ import org.terasology.engine.world.chunks.ChunkProvider; import org.terasology.engine.world.chunks.localChunkProvider.RelevanceSystem; import org.terasology.engine.world.generator.WorldGenerator; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Iterator; import java.util.List; @@ -202,7 +203,8 @@ public void onDisconnect(DisconnectedEvent event, EntityRef entity) { removeRelevanceEntity(entity); } - @ReceiveEvent(priority = EventPriority.PRIORITY_CRITICAL, components = ClientComponent.class) + @Priority(EventPriority.PRIORITY_CRITICAL) + @ReceiveEvent(components = ClientComponent.class) public void setSpawnLocationOnRespawnRequest(RespawnRequestEvent event, EntityRef entity) { ClientComponent clientComponent = entity.getComponent(ClientComponent.class); EntityRef character = clientComponent.character; @@ -220,7 +222,8 @@ public void setSpawnLocationOnRespawnRequest(RespawnRequestEvent event, EntityRe character.saveComponent(loc); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL, components = ClientComponent.class) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent(components = ClientComponent.class) public void onRespawnRequest(RespawnRequestEvent event, EntityRef entity) { Vector3f spawnPosition = entity.getComponent(LocationComponent.class).getWorldPosition(new Vector3f()); diff --git a/engine/src/main/java/org/terasology/engine/logic/players/PlayerTargetChangedEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/PlayerTargetChangedEvent.java index 09b77095bde..4ec048ab453 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/PlayerTargetChangedEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/PlayerTargetChangedEvent.java @@ -4,7 +4,7 @@ package org.terasology.engine.logic.players; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Fired whenever the targeted entity changes (must be within activation range). diff --git a/engine/src/main/java/org/terasology/engine/logic/players/SetDirectionEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/SetDirectionEvent.java index 39751411670..688d746947e 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/SetDirectionEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/SetDirectionEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Trigger event that sets the direction a player is facing. diff --git a/engine/src/main/java/org/terasology/engine/logic/players/ThirdPersonRemoteClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/ThirdPersonRemoteClientSystem.java index 02615842076..79f907d21a8 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/ThirdPersonRemoteClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/ThirdPersonRemoteClientSystem.java @@ -14,7 +14,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -29,6 +28,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.rendering.logic.VisualComponent; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Iterator; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/logic/players/WorldtimeResyncSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/WorldtimeResyncSystem.java index c5156b665fb..5054f31bd75 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/WorldtimeResyncSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/WorldtimeResyncSystem.java @@ -3,7 +3,6 @@ package org.terasology.engine.logic.players; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -11,6 +10,7 @@ import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.CLIENT) public class WorldtimeResyncSystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/LocalPlayerInitializedEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/LocalPlayerInitializedEvent.java index d49d708353c..a454d05fb5a 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/LocalPlayerInitializedEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/LocalPlayerInitializedEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.logic.players.LocalPlayer; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event gets sent when the {@link LocalPlayer} object is ready to be used. diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerRespawnedEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerRespawnedEvent.java index 428cc9e9f95..21e028cf8e5 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerRespawnedEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerRespawnedEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event gets sent when the player respawns.
    diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerSpawnedEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerSpawnedEvent.java index 556957e4847..8e0d1feff3e 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerSpawnedEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/OnPlayerSpawnedEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event gets sent when the player spawns. diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/ResetCameraEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/ResetCameraEvent.java index 4efd6eb5814..24a7d65b425 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/ResetCameraEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/ResetCameraEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class ResetCameraEvent implements Event { } diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/RespawnRequestEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/RespawnRequestEvent.java index de39d2c6f64..b7f2df37119 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/RespawnRequestEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/RespawnRequestEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; @ServerEvent public class RespawnRequestEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/SynchronizeClientTimeSystem.java b/engine/src/main/java/org/terasology/engine/logic/players/event/SynchronizeClientTimeSystem.java index 78ecb95bb7c..713051de7e4 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/SynchronizeClientTimeSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/SynchronizeClientTimeSystem.java @@ -4,13 +4,13 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.time.WorldtimeResyncEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class SynchronizeClientTimeSystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/logic/players/event/WorldtimeResetEvent.java b/engine/src/main/java/org/terasology/engine/logic/players/event/WorldtimeResetEvent.java index 34fc0ae5a82..0ebabcd6197 100644 --- a/engine/src/main/java/org/terasology/engine/logic/players/event/WorldtimeResetEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/players/event/WorldtimeResetEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.players.event; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; @ServerEvent public class WorldtimeResetEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/selection/ApplyBlockSelectionEvent.java b/engine/src/main/java/org/terasology/engine/logic/selection/ApplyBlockSelectionEvent.java index 49665743211..ed115906205 100644 --- a/engine/src/main/java/org/terasology/engine/logic/selection/ApplyBlockSelectionEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/selection/ApplyBlockSelectionEvent.java @@ -3,9 +3,9 @@ package org.terasology.engine.logic.selection; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.gestalt.module.sandbox.API; import org.terasology.engine.world.block.BlockRegion; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.module.sandbox.API; /** * This event is fired once a player finished a selection using an item with a BlockSelectionComponent. The item used diff --git a/engine/src/main/java/org/terasology/engine/logic/selection/LocalPlayerBlockSelectionByItemSystem.java b/engine/src/main/java/org/terasology/engine/logic/selection/LocalPlayerBlockSelectionByItemSystem.java index e39ea619d63..a3cc28275a4 100644 --- a/engine/src/main/java/org/terasology/engine/logic/selection/LocalPlayerBlockSelectionByItemSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/selection/LocalPlayerBlockSelectionByItemSystem.java @@ -6,7 +6,6 @@ import org.joml.Vector3f; import org.joml.Vector3i; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -19,6 +18,7 @@ import org.terasology.engine.world.selection.BlockSelectionComponent; import org.terasology.engine.world.selection.event.SetBlockSelectionEndingPointEvent; import org.terasology.engine.world.selection.event.SetBlockSelectionStartingPointEvent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * System to allow the use of BlockSelectionComponents. This system is a client only system, though no other player diff --git a/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionEndEvent.java b/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionEndEvent.java index cf8a59878aa..1ba66534217 100644 --- a/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionEndEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionEndEvent.java @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.selection; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.gestalt.module.sandbox.API; import org.terasology.engine.world.block.BlockRegion; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.module.sandbox.API; /** * This event is sent when the player finalizes the position of a moving selection by clicking the left mouse button. diff --git a/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionStartEvent.java b/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionStartEvent.java index 662e8a28e3e..34c85d6c232 100644 --- a/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionStartEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/selection/MovableSelectionStartEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.logic.selection; import org.terasology.engine.world.selection.BlockSelectionComponent; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; -import org.terasology.engine.entitySystem.event.Event; /** * This event should be sent by a system after it receives a {@link ApplyBlockSelectionEvent} which marks the end of a diff --git a/engine/src/main/java/org/terasology/engine/logic/time/TimeClientSystem.java b/engine/src/main/java/org/terasology/engine/logic/time/TimeClientSystem.java index 09657455ec1..c9b35d3f758 100644 --- a/engine/src/main/java/org/terasology/engine/logic/time/TimeClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/logic/time/TimeClientSystem.java @@ -4,18 +4,20 @@ import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.CLIENT) public class TimeClientSystem extends BaseComponentSystem { @In private Time time; - @ReceiveEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @NetFilterEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @ReceiveEvent public void resynchTime(TimeResynchEvent event, EntityRef entityRef) { time.setGameTimeDilation(event.getGameTimeDilation()); } diff --git a/engine/src/main/java/org/terasology/engine/logic/time/TimeResynchEvent.java b/engine/src/main/java/org/terasology/engine/logic/time/TimeResynchEvent.java index febc8538267..16c506b62a2 100644 --- a/engine/src/main/java/org/terasology/engine/logic/time/TimeResynchEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/time/TimeResynchEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.time; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class TimeResynchEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/logic/time/WorldtimeResyncEvent.java b/engine/src/main/java/org/terasology/engine/logic/time/WorldtimeResyncEvent.java index 25076a5b9e6..d2b6c3c4108 100644 --- a/engine/src/main/java/org/terasology/engine/logic/time/WorldtimeResyncEvent.java +++ b/engine/src/main/java/org/terasology/engine/logic/time/WorldtimeResyncEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.logic.time; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; @OwnerEvent public class WorldtimeResyncEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/network/Client.java b/engine/src/main/java/org/terasology/engine/network/Client.java index c21ddea91f2..96bca728bb6 100644 --- a/engine/src/main/java/org/terasology/engine/network/Client.java +++ b/engine/src/main/java/org/terasology/engine/network/Client.java @@ -4,10 +4,10 @@ package org.terasology.engine.network; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; -import org.terasology.nui.Color; import org.terasology.engine.rendering.world.viewDistance.ViewDistance; import org.terasology.engine.world.chunks.ChunkRegionListener; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.nui.Color; /** * A client is the connection between a player (local or remote) and the game. diff --git a/engine/src/main/java/org/terasology/engine/network/ClientPingSystem.java b/engine/src/main/java/org/terasology/engine/network/ClientPingSystem.java index 6a3ebb38830..027673e3cf8 100644 --- a/engine/src/main/java/org/terasology/engine/network/ClientPingSystem.java +++ b/engine/src/main/java/org/terasology/engine/network/ClientPingSystem.java @@ -3,12 +3,12 @@ package org.terasology.engine.network; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.network.events.PingFromClientEvent; import org.terasology.engine.network.events.PingFromServerEvent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system, registered on the client, will respond to the ping event from server. diff --git a/engine/src/main/java/org/terasology/engine/network/NetworkEvent.java b/engine/src/main/java/org/terasology/engine/network/NetworkEvent.java index 90cc5de9cc1..ae822b78478 100644 --- a/engine/src/main/java/org/terasology/engine/network/NetworkEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/NetworkEvent.java @@ -4,7 +4,7 @@ package org.terasology.engine.network; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Optional parent for events that are replicated over the network. Inherit this to make use of advanced features diff --git a/engine/src/main/java/org/terasology/engine/network/NetworkEventSystemDecorator.java b/engine/src/main/java/org/terasology/engine/network/NetworkEventSystemDecorator.java index 3f5d5e68850..08cbaa956ac 100644 --- a/engine/src/main/java/org/terasology/engine/network/NetworkEventSystemDecorator.java +++ b/engine/src/main/java/org/terasology/engine/network/NetworkEventSystemDecorator.java @@ -3,14 +3,14 @@ package org.terasology.engine.network; -import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.metadata.EventLibrary; import org.terasology.engine.entitySystem.metadata.EventMetadata; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.gestalt.assets.ResourceUrn; +import org.terasology.gestalt.entitysystem.event.Event; /** * Decorator for replicate event to network. diff --git a/engine/src/main/java/org/terasology/engine/network/Server.java b/engine/src/main/java/org/terasology/engine/network/Server.java index ff2d9d4b0f3..414ae49d417 100644 --- a/engine/src/main/java/org/terasology/engine/network/Server.java +++ b/engine/src/main/java/org/terasology/engine/network/Server.java @@ -3,9 +3,9 @@ package org.terasology.engine.network; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.chunks.remoteChunkProvider.ChunkReadyListener; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.protobuf.NetData; public interface Server extends ChunkReadyListener { diff --git a/engine/src/main/java/org/terasology/engine/network/ServerPingSystem.java b/engine/src/main/java/org/terasology/engine/network/ServerPingSystem.java index 9f3cd5c70de..31b6ff2fcd2 100644 --- a/engine/src/main/java/org/terasology/engine/network/ServerPingSystem.java +++ b/engine/src/main/java/org/terasology/engine/network/ServerPingSystem.java @@ -4,7 +4,6 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -16,6 +15,7 @@ import org.terasology.engine.network.events.SubscribePingEvent; import org.terasology.engine.network.events.UnSubscribePingEvent; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.time.Duration; import java.time.Instant; diff --git a/engine/src/main/java/org/terasology/engine/network/events/ConnectedEvent.java b/engine/src/main/java/org/terasology/engine/network/events/ConnectedEvent.java index 0ac5a0794b1..097e68e9f7c 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/ConnectedEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/ConnectedEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.persistence.PlayerStore; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event notifying that a new client has connected - sent against the client by the network system. diff --git a/engine/src/main/java/org/terasology/engine/network/events/DisconnectedEvent.java b/engine/src/main/java/org/terasology/engine/network/events/DisconnectedEvent.java index 25b70e460cd..bdf9a7a6997 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/DisconnectedEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/DisconnectedEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event notifying of a client disconnecting. diff --git a/engine/src/main/java/org/terasology/engine/network/events/PingFromClientEvent.java b/engine/src/main/java/org/terasology/engine/network/events/PingFromClientEvent.java index 921ca21aaa9..1d6ae592b0b 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/PingFromClientEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/PingFromClientEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event handles the ping from one client to the server. diff --git a/engine/src/main/java/org/terasology/engine/network/events/PingFromServerEvent.java b/engine/src/main/java/org/terasology/engine/network/events/PingFromServerEvent.java index 0c1517224d6..07d7403e511 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/PingFromServerEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/PingFromServerEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.OwnerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event handles the ping from the server to all clients. diff --git a/engine/src/main/java/org/terasology/engine/network/events/SubscribePingEvent.java b/engine/src/main/java/org/terasology/engine/network/events/SubscribePingEvent.java index ace0503dce2..a63e019b83f 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/SubscribePingEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/SubscribePingEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * The client subscribes ping. diff --git a/engine/src/main/java/org/terasology/engine/network/events/UnSubscribePingEvent.java b/engine/src/main/java/org/terasology/engine/network/events/UnSubscribePingEvent.java index 61e443277d7..a23e0c8d642 100644 --- a/engine/src/main/java/org/terasology/engine/network/events/UnSubscribePingEvent.java +++ b/engine/src/main/java/org/terasology/engine/network/events/UnSubscribePingEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.network.events; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * The client unSubscribes ping. diff --git a/engine/src/main/java/org/terasology/engine/network/internal/LocalClient.java b/engine/src/main/java/org/terasology/engine/network/internal/LocalClient.java index bece82cf729..9510e17ac96 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/LocalClient.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/LocalClient.java @@ -7,14 +7,14 @@ import org.terasology.engine.config.Config; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.logic.common.DisplayNameComponent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.ColorComponent; -import org.terasology.nui.Color; import org.terasology.engine.registry.CoreRegistry; import org.terasology.engine.rendering.world.viewDistance.ViewDistance; import org.terasology.engine.world.chunks.Chunk; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.nui.Color; /** * A local client. diff --git a/engine/src/main/java/org/terasology/engine/network/internal/NetClient.java b/engine/src/main/java/org/terasology/engine/network/internal/NetClient.java index 81636aa5eea..2de4bad37be 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/NetClient.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/NetClient.java @@ -23,7 +23,6 @@ import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.metadata.EventLibrary; import org.terasology.engine.entitySystem.metadata.EventMetadata; import org.terasology.engine.entitySystem.metadata.NetworkEventType; @@ -49,6 +48,7 @@ import org.terasology.engine.world.chunks.Chunk; import org.terasology.engine.world.chunks.Chunks; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.nui.Color; import org.terasology.persistence.typeHandling.DeserializationException; import org.terasology.persistence.typeHandling.SerializationException; diff --git a/engine/src/main/java/org/terasology/engine/network/internal/NetworkEntitySystem.java b/engine/src/main/java/org/terasology/engine/network/internal/NetworkEntitySystem.java index 045300f48e9..a562935785f 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/NetworkEntitySystem.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/NetworkEntitySystem.java @@ -10,12 +10,14 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; 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.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.network.NetworkComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.world.WorldRenderer; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system handles a number of events relevant to the Network System: @@ -46,7 +48,9 @@ public void initialise() { } } - @ReceiveEvent(components = NetworkComponent.class, priority = EventPriority.PRIORITY_CRITICAL, netFilter = RegisterMode.AUTHORITY) + @NetFilterEvent(netFilter = RegisterMode.AUTHORITY) + @Priority(EventPriority.PRIORITY_CRITICAL) + @ReceiveEvent(components = NetworkComponent.class) public void onAddNetworkComponent(OnActivatedComponent event, EntityRef entity) { if (networkSystem.getMode().isServer()) { networkSystem.registerNetworkEntity(entity); diff --git a/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java b/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java index e61a3d1412c..76e1fcf3d32 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java @@ -40,7 +40,6 @@ import org.terasology.engine.entitySystem.entity.internal.EngineEntityManager; import org.terasology.engine.entitySystem.entity.internal.EntityChangeSubscriber; import org.terasology.engine.entitySystem.entity.internal.OwnershipHelper; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.metadata.ComponentLibrary; import org.terasology.engine.entitySystem.metadata.ComponentMetadata; import org.terasology.engine.entitySystem.metadata.EventLibrary; @@ -71,6 +70,7 @@ import org.terasology.engine.world.chunks.remoteChunkProvider.RemoteChunkProvider; import org.terasology.engine.world.generator.WorldGenerator; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.Module; import org.terasology.nui.Color; import org.terasology.persistence.typeHandling.TypeHandlerLibrary; diff --git a/engine/src/main/java/org/terasology/engine/network/internal/ServerImpl.java b/engine/src/main/java/org/terasology/engine/network/internal/ServerImpl.java index c3139d4f6d7..97eb9e606c2 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/ServerImpl.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/ServerImpl.java @@ -22,7 +22,6 @@ import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.internal.EngineEntityManager; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.NetMetricSource; import org.terasology.engine.network.NetworkComponent; import org.terasology.engine.network.Server; @@ -45,6 +44,7 @@ import org.terasology.engine.world.chunks.internal.ChunkSerializer; import org.terasology.engine.world.chunks.remoteChunkProvider.RemoteChunkProvider; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.persistence.typeHandling.DeserializationException; import org.terasology.persistence.typeHandling.SerializationException; import org.terasology.protobuf.EntityData; diff --git a/engine/src/main/java/org/terasology/engine/particles/ParticleSystemManagerImpl.java b/engine/src/main/java/org/terasology/engine/particles/ParticleSystemManagerImpl.java index 8587318ff07..556f212799a 100644 --- a/engine/src/main/java/org/terasology/engine/particles/ParticleSystemManagerImpl.java +++ b/engine/src/main/java/org/terasology/engine/particles/ParticleSystemManagerImpl.java @@ -6,7 +6,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -21,6 +20,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.registry.Share; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.gestalt.module.sandbox.API; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/particles/events/ParticleSystemUpdateEvent.java b/engine/src/main/java/org/terasology/engine/particles/events/ParticleSystemUpdateEvent.java index 0df00c43267..dc9ff2d835f 100644 --- a/engine/src/main/java/org/terasology/engine/particles/events/ParticleSystemUpdateEvent.java +++ b/engine/src/main/java/org/terasology/engine/particles/events/ParticleSystemUpdateEvent.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.particles.events; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; /** diff --git a/engine/src/main/java/org/terasology/engine/persistence/internal/DelayedEntityRef.java b/engine/src/main/java/org/terasology/engine/persistence/internal/DelayedEntityRef.java index 4593f9ef8a0..79e46956899 100644 --- a/engine/src/main/java/org/terasology/engine/persistence/internal/DelayedEntityRef.java +++ b/engine/src/main/java/org/terasology/engine/persistence/internal/DelayedEntityRef.java @@ -4,9 +4,9 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/persistence/serializers/EventSerializer.java b/engine/src/main/java/org/terasology/engine/persistence/serializers/EventSerializer.java index 410e0d557e0..1700577b67c 100644 --- a/engine/src/main/java/org/terasology/engine/persistence/serializers/EventSerializer.java +++ b/engine/src/main/java/org/terasology/engine/persistence/serializers/EventSerializer.java @@ -9,12 +9,12 @@ import com.google.protobuf.ByteString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.metadata.EventLibrary; import org.terasology.engine.entitySystem.metadata.EventMetadata; import org.terasology.engine.entitySystem.metadata.ReplicatedFieldMetadata; import org.terasology.engine.persistence.typeHandling.protobuf.ProtobufPersistedData; import org.terasology.engine.persistence.typeHandling.protobuf.ProtobufPersistedDataSerializer; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.persistence.typeHandling.DeserializationException; import org.terasology.persistence.typeHandling.PersistedDataSerializer; import org.terasology.persistence.typeHandling.SerializationException; diff --git a/engine/src/main/java/org/terasology/engine/physics/bullet/VoxelWorldSystem.java b/engine/src/main/java/org/terasology/engine/physics/bullet/VoxelWorldSystem.java index 228a05f8dda..5a95a144116 100644 --- a/engine/src/main/java/org/terasology/engine/physics/bullet/VoxelWorldSystem.java +++ b/engine/src/main/java/org/terasology/engine/physics/bullet/VoxelWorldSystem.java @@ -5,7 +5,6 @@ import com.google.common.collect.Lists; import org.joml.Vector3ic; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.physics.bullet.world.VoxelBlockFluidWorld; @@ -22,6 +21,7 @@ import org.terasology.engine.world.chunks.Chunks; import org.terasology.engine.world.chunks.event.BeforeChunkUnload; import org.terasology.engine.world.chunks.event.OnChunkLoaded; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.nio.ByteBuffer; import java.nio.ByteOrder; diff --git a/engine/src/main/java/org/terasology/engine/physics/engine/PhysicsSystem.java b/engine/src/main/java/org/terasology/engine/physics/engine/PhysicsSystem.java index 4517786245e..756e3e9168a 100644 --- a/engine/src/main/java/org/terasology/engine/physics/engine/PhysicsSystem.java +++ b/engine/src/main/java/org/terasology/engine/physics/engine/PhysicsSystem.java @@ -14,8 +14,9 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; 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.systems.BaseComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; @@ -42,6 +43,7 @@ import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Iterator; import java.util.List; @@ -79,7 +81,8 @@ public void initialise() { lastNetsync = 0; } - @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}, priority = EventPriority.PRIORITY_NORMAL) + @Priority(EventPriority.PRIORITY_NORMAL) + @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}) public void newRigidBody(OnActivatedComponent event, EntityRef entity) { //getter also creates the rigid body physics.getRigidBody(entity); @@ -301,14 +304,16 @@ private void sendSyncMessages() { } } - @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}, netFilter = RegisterMode.REMOTE_CLIENT) + @NetFilterEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}) public void resynchPhysics(PhysicsResynchEvent event, EntityRef entity) { logger.debug("Received resynch event"); RigidBody body = physics.getRigidBody(entity); body.setVelocity(event.getVelocity(), event.getAngularVelocity()); } - @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}, netFilter = RegisterMode.REMOTE_CLIENT) + @NetFilterEvent(netFilter = RegisterMode.REMOTE_CLIENT) + @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}) public void resynchLocation(LocationResynchEvent event, EntityRef entity) { logger.debug("Received location resynch event"); RigidBody body = physics.getRigidBody(entity); diff --git a/engine/src/main/java/org/terasology/engine/physics/events/ChangeVelocityEvent.java b/engine/src/main/java/org/terasology/engine/physics/events/ChangeVelocityEvent.java index fffb9c53b0b..6adfbb34b96 100644 --- a/engine/src/main/java/org/terasology/engine/physics/events/ChangeVelocityEvent.java +++ b/engine/src/main/java/org/terasology/engine/physics/events/ChangeVelocityEvent.java @@ -4,8 +4,8 @@ package org.terasology.engine.physics.events; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class ChangeVelocityEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/physics/events/ForceEvent.java b/engine/src/main/java/org/terasology/engine/physics/events/ForceEvent.java index 7363f58da1b..a3d0d4935d7 100644 --- a/engine/src/main/java/org/terasology/engine/physics/events/ForceEvent.java +++ b/engine/src/main/java/org/terasology/engine/physics/events/ForceEvent.java @@ -4,8 +4,8 @@ package org.terasology.engine.physics.events; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class ForceEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/physics/events/ImpulseEvent.java b/engine/src/main/java/org/terasology/engine/physics/events/ImpulseEvent.java index 63e697987f0..53abd76a133 100644 --- a/engine/src/main/java/org/terasology/engine/physics/events/ImpulseEvent.java +++ b/engine/src/main/java/org/terasology/engine/physics/events/ImpulseEvent.java @@ -4,8 +4,8 @@ package org.terasology.engine.physics.events; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class ImpulseEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/physics/events/MovedEvent.java b/engine/src/main/java/org/terasology/engine/physics/events/MovedEvent.java index c4183a0afff..e92a6904538 100644 --- a/engine/src/main/java/org/terasology/engine/physics/events/MovedEvent.java +++ b/engine/src/main/java/org/terasology/engine/physics/events/MovedEvent.java @@ -5,7 +5,7 @@ import org.joml.Vector3f; import org.joml.Vector3fc; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class MovedEvent implements Event { private Vector3f delta = new Vector3f(); diff --git a/engine/src/main/java/org/terasology/engine/physics/events/PhysicsResynchEvent.java b/engine/src/main/java/org/terasology/engine/physics/events/PhysicsResynchEvent.java index 6603b819db1..1accbca078a 100644 --- a/engine/src/main/java/org/terasology/engine/physics/events/PhysicsResynchEvent.java +++ b/engine/src/main/java/org/terasology/engine/physics/events/PhysicsResynchEvent.java @@ -4,8 +4,8 @@ package org.terasology.engine.physics.events; import org.joml.Vector3f; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.BroadcastEvent; +import org.terasology.gestalt.entitysystem.event.Event; @BroadcastEvent public class PhysicsResynchEvent implements Event { diff --git a/engine/src/main/java/org/terasology/engine/recording/EventCatcher.java b/engine/src/main/java/org/terasology/engine/recording/EventCatcher.java index 8d767a6f20c..88054ab4534 100644 --- a/engine/src/main/java/org/terasology/engine/recording/EventCatcher.java +++ b/engine/src/main/java/org/terasology/engine/recording/EventCatcher.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.recording; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.PendingEvent; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/recording/EventCopier.java b/engine/src/main/java/org/terasology/engine/recording/EventCopier.java index f1cfd0875ef..876c4895a3c 100644 --- a/engine/src/main/java/org/terasology/engine/recording/EventCopier.java +++ b/engine/src/main/java/org/terasology/engine/recording/EventCopier.java @@ -5,21 +5,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.engine.audio.events.PlaySoundEvent; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.input.BindAxisEvent; import org.terasology.engine.input.BindButtonEvent; import org.terasology.engine.input.cameraTarget.CameraTargetChangedEvent; import org.terasology.engine.input.events.InputEvent; -import org.terasology.engine.input.events.KeyUpEvent; -import org.terasology.engine.input.events.KeyRepeatEvent; import org.terasology.engine.input.events.KeyDownEvent; import org.terasology.engine.input.events.KeyEvent; +import org.terasology.engine.input.events.KeyRepeatEvent; +import org.terasology.engine.input.events.KeyUpEvent; import org.terasology.engine.input.events.MouseAxisEvent; import org.terasology.engine.input.events.MouseButtonEvent; import org.terasology.engine.input.events.MouseWheelEvent; import org.terasology.engine.logic.characters.CharacterMoveInputEvent; import org.terasology.engine.logic.characters.GetMaxSpeedEvent; import org.terasology.engine.logic.characters.events.AttackEvent; +import org.terasology.gestalt.entitysystem.event.Event; import java.lang.reflect.InvocationTargetException; diff --git a/engine/src/main/java/org/terasology/engine/recording/EventSystemReplayImpl.java b/engine/src/main/java/org/terasology/engine/recording/EventSystemReplayImpl.java index 2ef30f75de8..7ae9fa36766 100644 --- a/engine/src/main/java/org/terasology/engine/recording/EventSystemReplayImpl.java +++ b/engine/src/main/java/org/terasology/engine/recording/EventSystemReplayImpl.java @@ -21,16 +21,17 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.internal.EngineEntityManager; import org.terasology.engine.entitySystem.event.AbstractConsumableEvent; +import org.terasology.engine.entitySystem.event.Activity; import org.terasology.engine.entitySystem.event.ConsumableEvent; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.EventPriority; import org.terasology.engine.entitySystem.event.PendingEvent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; +import org.terasology.engine.entitySystem.event.Priority; import org.terasology.engine.entitySystem.event.internal.EventReceiver; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.engine.entitySystem.metadata.EventLibrary; import org.terasology.engine.entitySystem.metadata.EventMetadata; import org.terasology.engine.entitySystem.systems.ComponentSystem; +import org.terasology.engine.entitySystem.systems.NetFilterEvent; import org.terasology.engine.monitoring.PerformanceMonitor; import org.terasology.engine.network.BroadcastEvent; import org.terasology.engine.network.Client; @@ -43,7 +44,10 @@ import org.terasology.engine.world.block.BlockComponent; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import javax.annotation.Nullable; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; @@ -307,9 +311,25 @@ public void registerEventHandler(ComponentSystem handler) { for (Method method : handlerClass.getMethods()) { ReceiveEvent receiveEventAnnotation = method.getAnnotation(ReceiveEvent.class); if (receiveEventAnnotation != null) { - if (!receiveEventAnnotation.netFilter().isValidFor(networkSystem.getMode().isAuthority(), false)) { + NetFilterEvent netFilterAnnotation = method.getAnnotation(NetFilterEvent.class); + if (netFilterAnnotation != null && !netFilterAnnotation.netFilter().isValidFor(networkSystem.getMode().isAuthority(), false)) { continue; } + + int priority; + Priority priorityAnnotation = method.getAnnotation(Priority.class); + if (priorityAnnotation != null) { + priority = priorityAnnotation.value(); + } else { + priority = EventPriority.PRIORITY_NORMAL; + } + + String activity = null; + Activity activityAnnotation = method.getAnnotation(Activity.class); + if (activityAnnotation != null) { + activity = activityAnnotation.value(); + } + Set> requiredComponents = Sets.newLinkedHashSet(); method.setAccessible(true); Class[] types = method.getParameterTypes(); @@ -332,8 +352,8 @@ public void registerEventHandler(ComponentSystem handler) { } EventSystemReplayImpl.ByteCodeEventHandlerInfo handlerInfo = - new EventSystemReplayImpl.ByteCodeEventHandlerInfo(handler, method, receiveEventAnnotation.priority(), - receiveEventAnnotation.activity(), requiredComponents, componentParams); + new EventSystemReplayImpl.ByteCodeEventHandlerInfo(handler, method, priority, + activity, requiredComponents, componentParams); addEventHandler((Class) types[0], handlerInfo, requiredComponents); } } @@ -619,7 +639,7 @@ private static class ByteCodeEventHandlerInfo implements EventSystemReplayImpl.E ByteCodeEventHandlerInfo(ComponentSystem handler, Method method, int priority, - String activity, + @Nullable String activity, Collection> filterComponents, Collection> componentParams) { @@ -652,13 +672,13 @@ public void invoke(EntityRef entity, Event event) { for (int i = 0; i < componentParams.size(); ++i) { params[i + 2] = entity.getComponent(componentParams.get(i)); } - if (!activity.isEmpty()) { + if (activity != null) { PerformanceMonitor.startActivity(activity); } try { methodAccess.invoke(handler, methodIndex, params); } finally { - if (!activity.isEmpty()) { + if (activity != null) { PerformanceMonitor.endActivity(); } } diff --git a/engine/src/main/java/org/terasology/engine/recording/RecordedEntityRef.java b/engine/src/main/java/org/terasology/engine/recording/RecordedEntityRef.java index 578dce16b80..29986a94727 100644 --- a/engine/src/main/java/org/terasology/engine/recording/RecordedEntityRef.java +++ b/engine/src/main/java/org/terasology/engine/recording/RecordedEntityRef.java @@ -5,9 +5,9 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.LowLevelEntityManager; import org.terasology.engine.entitySystem.entity.internal.NullEntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.List; diff --git a/engine/src/main/java/org/terasology/engine/recording/RecordedEvent.java b/engine/src/main/java/org/terasology/engine/recording/RecordedEvent.java index 14586d2e965..0e8c8732f24 100644 --- a/engine/src/main/java/org/terasology/engine/recording/RecordedEvent.java +++ b/engine/src/main/java/org/terasology/engine/recording/RecordedEvent.java @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.recording; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; /** * Saves a recorded event, the id of the entity it was sent against, the component it was sent with, the timestamp in diff --git a/engine/src/main/java/org/terasology/engine/recording/RecordingEventSystemDecorator.java b/engine/src/main/java/org/terasology/engine/recording/RecordingEventSystemDecorator.java index 534aa145026..6d9a6a5e812 100644 --- a/engine/src/main/java/org/terasology/engine/recording/RecordingEventSystemDecorator.java +++ b/engine/src/main/java/org/terasology/engine/recording/RecordingEventSystemDecorator.java @@ -5,10 +5,10 @@ import org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.entitySystem.event.PendingEvent; import org.terasology.engine.entitySystem.event.internal.EventSystem; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.Event; /** * Decorator for recording Events to Record&Replay subsystem. diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/AnimEndEvent.java b/engine/src/main/java/org/terasology/engine/rendering/logic/AnimEndEvent.java index f52c8f8c170..d24852b2d55 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/AnimEndEvent.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/AnimEndEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.rendering.logic; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.rendering.assets.animation.MeshAnimation; +import org.terasology.gestalt.entitysystem.event.Event; public class AnimEndEvent implements Event { private MeshAnimation animation; diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/ChunkMeshRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/logic/ChunkMeshRenderer.java index 0dbfd8e1b8d..b4595352b1b 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/ChunkMeshRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/ChunkMeshRenderer.java @@ -8,7 +8,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -16,6 +15,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.rendering.world.RenderableWorld; import org.terasology.engine.world.chunks.RenderableChunk; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Collection; import java.util.HashMap; diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/FloatingTextRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/logic/FloatingTextRenderer.java index 87e3db7b5a2..965e924b9ec 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/FloatingTextRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/FloatingTextRenderer.java @@ -12,7 +12,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -26,6 +25,7 @@ import org.terasology.engine.rendering.cameras.Camera; import org.terasology.engine.world.WorldProvider; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.nui.Color; import org.terasology.nui.HorizontalAlign; diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/LightFadeSystem.java b/engine/src/main/java/org/terasology/engine/rendering/logic/LightFadeSystem.java index 079a55e2f17..7f73b6d85c7 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/LightFadeSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/LightFadeSystem.java @@ -6,11 +6,11 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem public class LightFadeSystem extends BaseComponentSystem implements UpdateSubscriberSystem { diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/MeshRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/logic/MeshRenderer.java index 943592128fc..a2fc3847e90 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/MeshRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/MeshRenderer.java @@ -17,7 +17,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -29,6 +28,7 @@ import org.terasology.engine.rendering.assets.material.Material; import org.terasology.engine.rendering.world.WorldRenderer; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.joml.geom.AABBf; import java.nio.FloatBuffer; diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/RegionOutlineRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/logic/RegionOutlineRenderer.java index beccea3d8b8..16ed24ba276 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/RegionOutlineRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/RegionOutlineRenderer.java @@ -13,7 +13,6 @@ import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -28,6 +27,7 @@ import org.terasology.engine.utilities.Assets; import org.terasology.engine.world.block.BlockRegion; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.joml.geom.AABBf; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/rendering/logic/SkeletonRenderer.java b/engine/src/main/java/org/terasology/engine/rendering/logic/SkeletonRenderer.java index 55bd5d1bfa2..4a12ee09c69 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/logic/SkeletonRenderer.java +++ b/engine/src/main/java/org/terasology/engine/rendering/logic/SkeletonRenderer.java @@ -17,7 +17,6 @@ import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -38,6 +37,7 @@ import org.terasology.engine.rendering.world.WorldRenderer; import org.terasology.engine.utilities.Assets; import org.terasology.gestalt.assets.management.AssetManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.joml.geom.AABBf; import org.terasology.nui.Color; diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/FocusChangedEvent.java b/engine/src/main/java/org/terasology/engine/rendering/nui/FocusChangedEvent.java index 88a7d363cd9..4141c5bb589 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/FocusChangedEvent.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/FocusChangedEvent.java @@ -4,7 +4,7 @@ package org.terasology.engine.rendering.nui; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class FocusChangedEvent implements Event { } diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/ScreenLayerClosedEvent.java b/engine/src/main/java/org/terasology/engine/rendering/nui/ScreenLayerClosedEvent.java index a9b0db9b8a4..4c082e98f13 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/ScreenLayerClosedEvent.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/ScreenLayerClosedEvent.java @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.rendering.nui; +import org.terasology.engine.network.OwnerEvent; import org.terasology.gestalt.assets.ResourceUrn; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; import org.terasology.gestalt.module.sandbox.API; -import org.terasology.engine.network.OwnerEvent; /** * The event is sent to the UI layer diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/SortOrderSystem.java b/engine/src/main/java/org/terasology/engine/rendering/nui/SortOrderSystem.java index 1452fc05acc..40fd43aafe6 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/SortOrderSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/SortOrderSystem.java @@ -7,17 +7,17 @@ import org.terasology.engine.core.SimpleUri; import org.terasology.engine.core.subsystem.config.BindsManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.input.BindButtonEvent; import org.terasology.engine.input.BindButtonSubscriber; import org.terasology.engine.input.BindableButton; -import org.terasology.input.Keyboard; import org.terasology.engine.input.internal.BindableButtonImpl; import org.terasology.engine.logic.console.ui.ConsoleScreen; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.Keyboard; import java.util.ArrayList; import java.util.Collections; diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUIEditorSystem.java b/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUIEditorSystem.java index de0e4af4c47..3a5b6f79de9 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUIEditorSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUIEditorSystem.java @@ -4,15 +4,16 @@ 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.systems.RegisterSystem; -import org.terasology.input.ButtonState; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.registry.Share; import org.terasology.engine.rendering.nui.NUIManager; import org.terasology.engine.rendering.nui.editor.binds.NUIEditorButton; import org.terasology.engine.rendering.nui.editor.layers.NUIEditorScreen; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.ButtonState; /** * The back-end system for the NUI screen editor. @@ -25,8 +26,8 @@ public class NUIEditorSystem extends AbstractEditorSystem { private boolean editorActive; - @ReceiveEvent(components = ClientComponent.class, - priority = EventPriority.PRIORITY_CRITICAL) + @Priority(EventPriority.PRIORITY_CRITICAL) + @ReceiveEvent(components = ClientComponent.class) public void showEditor(NUIEditorButton event, EntityRef entity) { if (event.getState() == ButtonState.DOWN) { toggleEditor(); diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUISkinEditorSystem.java b/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUISkinEditorSystem.java index b815f203b9c..79464d552b9 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUISkinEditorSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/editor/systems/NUISkinEditorSystem.java @@ -4,15 +4,16 @@ 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.systems.RegisterSystem; -import org.terasology.input.ButtonState; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.registry.Share; import org.terasology.engine.rendering.nui.NUIManager; import org.terasology.engine.rendering.nui.editor.binds.NUISkinEditorButton; import org.terasology.engine.rendering.nui.editor.layers.NUISkinEditorScreen; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.input.ButtonState; /** * The back-end system for the NUI skin editor. @@ -25,8 +26,8 @@ public class NUISkinEditorSystem extends AbstractEditorSystem { private boolean editorActive; - @ReceiveEvent(components = ClientComponent.class, - priority = EventPriority.PRIORITY_CRITICAL) + @Priority(EventPriority.PRIORITY_CRITICAL) + @ReceiveEvent(components = ClientComponent.class) public void showEditor(NUISkinEditorButton event, EntityRef entity) { if (event.getState() == ButtonState.DOWN) { toggleEditor(); diff --git a/engine/src/main/java/org/terasology/engine/rendering/nui/internal/NUIManagerInternal.java b/engine/src/main/java/org/terasology/engine/rendering/nui/internal/NUIManagerInternal.java index fd600ea33c5..f2c1384bbd5 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/nui/internal/NUIManagerInternal.java +++ b/engine/src/main/java/org/terasology/engine/rendering/nui/internal/NUIManagerInternal.java @@ -22,7 +22,7 @@ import org.terasology.engine.core.subsystem.config.BindsManager; 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.systems.BaseComponentSystem; import org.terasology.engine.i18n.TranslationSystem; import org.terasology.engine.input.BindButtonEvent; @@ -48,6 +48,7 @@ import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.gestalt.assets.management.AssetManager; import org.terasology.gestalt.assets.module.ModuleAwareAssetTypeManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.gestalt.module.Module; import org.terasology.gestalt.module.ModuleEnvironment; import org.terasology.gestalt.naming.Name; @@ -651,7 +652,8 @@ public void setForceReleasingMouse(boolean value) { have first pick of input */ - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void mouseAxisEvent(MouseAxisEvent event, EntityRef entity) { if (isReleasingMouse()) { event.consume(); @@ -659,7 +661,8 @@ public void mouseAxisEvent(MouseAxisEvent event, EntityRef entity) { } //mouse button events - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void mouseButtonEvent(MouseButtonEvent event, EntityRef entity) { if (!mouse.isVisible()) { return; @@ -687,7 +690,8 @@ public void mouseButtonEvent(MouseButtonEvent event, EntityRef entity) { } //mouse wheel events - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void mouseWheelEvent(MouseWheelEvent event, EntityRef entity) { if (!mouse.isVisible()) { return; @@ -712,7 +716,8 @@ public void mouseWheelEvent(MouseWheelEvent event, EntityRef entity) { } //text input events - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void charEvent(CharEvent ev, EntityRef entity) { NUICharEvent nuiEvent = new NUICharEvent(mouse, keyboard, ev.getCharacter()); if (focus != null) { @@ -738,7 +743,8 @@ public void charEvent(CharEvent ev, EntityRef entity) { } //raw input events - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void keyEvent(KeyEvent ev, EntityRef entity) { NUIKeyEvent nuiEvent = new NUIKeyEvent(mouse, keyboard, ev.getKey(), ev.getState()); if (focus != null) { @@ -765,7 +771,8 @@ public void keyEvent(KeyEvent ev, EntityRef entity) { //bind input events (will be send after raw input events, if a bind button was pressed and the raw input event // hasn't consumed the event) - @ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH) + @Priority(EventPriority.PRIORITY_HIGH) + @ReceiveEvent(components = ClientComponent.class) public void bindEvent(BindButtonEvent event, EntityRef entity) { NUIBindButtonEvent nuiEvent = new NUIBindButtonEvent(mouse, keyboard, new ResourceUrn(event.getId().getModuleName(), event.getId().getObjectName()).toString(), diff --git a/engine/src/main/java/org/terasology/engine/rendering/world/WorldRendererSystem.java b/engine/src/main/java/org/terasology/engine/rendering/world/WorldRendererSystem.java index c80397a13eb..ab518c1c1c6 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/world/WorldRendererSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/world/WorldRendererSystem.java @@ -3,7 +3,6 @@ package org.terasology.engine.rendering.world; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -11,6 +10,7 @@ import org.terasology.engine.world.WorldComponent; import org.terasology.engine.world.chunks.event.BeforeChunkUnload; import org.terasology.engine.world.chunks.event.OnChunkLoaded; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.CLIENT) public class WorldRendererSystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ClientViewDistanceSystem.java b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ClientViewDistanceSystem.java index 971af42b07d..7560fa43846 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ClientViewDistanceSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ClientViewDistanceSystem.java @@ -6,7 +6,6 @@ import org.terasology.engine.config.RenderingConfig; import org.terasology.engine.context.Context; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -19,6 +18,7 @@ import org.terasology.engine.network.ClientComponent; import org.terasology.engine.registry.In; import org.terasology.engine.rendering.world.WorldRenderer; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.beans.PropertyChangeListener; import java.util.Arrays; diff --git a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ServerViewDistanceSystem.java b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ServerViewDistanceSystem.java index ccffcecb6d6..c3735cfac3e 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ServerViewDistanceSystem.java +++ b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ServerViewDistanceSystem.java @@ -3,7 +3,6 @@ package org.terasology.engine.rendering.world.viewDistance; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -12,6 +11,7 @@ import org.terasology.engine.network.NetworkSystem; import org.terasology.engine.registry.In; import org.terasology.engine.world.chunks.localChunkProvider.RelevanceSystem; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * Handles view distance changes on the server diff --git a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ViewDistanceChangedEvent.java b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ViewDistanceChangedEvent.java index c3f7fadfb99..977b5010072 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ViewDistanceChangedEvent.java +++ b/engine/src/main/java/org/terasology/engine/rendering/world/viewDistance/ViewDistanceChangedEvent.java @@ -3,8 +3,8 @@ package org.terasology.engine.rendering.world.viewDistance; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.network.ServerEvent; +import org.terasology.gestalt.entitysystem.event.Event; /** * Notifies the server that the client's view distance has changed. diff --git a/engine/src/main/java/org/terasology/engine/world/OnChangedBlock.java b/engine/src/main/java/org/terasology/engine/world/OnChangedBlock.java index cdd390ce564..9d89f9b84bf 100644 --- a/engine/src/main/java/org/terasology/engine/world/OnChangedBlock.java +++ b/engine/src/main/java/org/terasology/engine/world/OnChangedBlock.java @@ -5,8 +5,8 @@ import org.joml.Vector3i; import org.joml.Vector3ic; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.block.Block; +import org.terasology.gestalt.entitysystem.event.Event; /** * Event when a block has changed diff --git a/engine/src/main/java/org/terasology/engine/world/block/BlockLifecycleEvent.java b/engine/src/main/java/org/terasology/engine/world/block/BlockLifecycleEvent.java index 6a246be8ee5..4ca0bf94b8c 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/BlockLifecycleEvent.java +++ b/engine/src/main/java/org/terasology/engine/world/block/BlockLifecycleEvent.java @@ -5,8 +5,8 @@ import gnu.trove.list.TIntList; import org.joml.Vector3i; import org.joml.Vector3ic; -import org.terasology.engine.entitySystem.event.Event; import org.terasology.engine.world.BlockEntityRegistry; +import org.terasology.gestalt.entitysystem.event.Event; import java.util.Collections; import java.util.Iterator; diff --git a/engine/src/main/java/org/terasology/engine/world/block/entity/BlockEntitySystem.java b/engine/src/main/java/org/terasology/engine/world/block/entity/BlockEntitySystem.java index 74f1125ba68..a74184a23af 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/entity/BlockEntitySystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/entity/BlockEntitySystem.java @@ -13,17 +13,13 @@ 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.health.DoDestroyEvent; import org.terasology.engine.logic.inventory.events.DropItemEvent; import org.terasology.engine.logic.inventory.events.GiveItemEvent; import org.terasology.engine.logic.location.LocationComponent; -import org.terasology.engine.world.block.entity.damage.BlockDamageModifierComponent; -import org.terasology.engine.world.block.regions.ActAsBlockComponent; -import org.terasology.engine.world.block.regions.BlockRegionComponent; -import org.terasology.engine.world.block.sounds.BlockSounds; import org.terasology.engine.physics.events.ImpulseEvent; import org.terasology.engine.registry.In; import org.terasology.engine.utilities.random.FastRandom; @@ -32,8 +28,13 @@ import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; import org.terasology.engine.world.block.BlockManager; +import org.terasology.engine.world.block.entity.damage.BlockDamageModifierComponent; import org.terasology.engine.world.block.items.BlockItemFactory; import org.terasology.engine.world.block.items.OnBlockToItem; +import org.terasology.engine.world.block.regions.ActAsBlockComponent; +import org.terasology.engine.world.block.regions.BlockRegionComponent; +import org.terasology.engine.world.block.sounds.BlockSounds; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** @@ -64,26 +65,30 @@ public void initialise() { random = new FastRandom(); } - @ReceiveEvent(priority = EventPriority.PRIORITY_LOW) + @Priority(EventPriority.PRIORITY_LOW) + @ReceiveEvent public void doDestroy(DoDestroyEvent event, EntityRef entity, ActAsBlockComponent blockComponent) { if (blockComponent.block != null) { commonDestroyed(event, entity, blockComponent.block.getArchetypeBlock()); } } - @ReceiveEvent(priority = EventPriority.PRIORITY_LOW) + @Priority(EventPriority.PRIORITY_LOW) + @ReceiveEvent public void doDestroy(DoDestroyEvent event, EntityRef entity, BlockComponent blockComponent) { commonDestroyed(event, entity, blockComponent.getBlock()); worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void defaultDropsHandling(CreateBlockDropsEvent event, EntityRef entity, BlockComponent blockComponent) { Vector3ic location = blockComponent.getPosition(); commonDefaultDropsHandling(event, entity, location, blockComponent.getBlock()); } - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void defaultDropsHandling(CreateBlockDropsEvent event, EntityRef entity, ActAsBlockComponent blockComponent) { if (blockComponent.block != null) { if (entity.hasComponent(BlockRegionComponent.class)) { diff --git a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateFinished.java b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateFinished.java index 897d9d1d523..18242ba4049 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateFinished.java +++ b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateFinished.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.world.block.entity.neighbourUpdate; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class LargeBlockUpdateFinished implements Event { } diff --git a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateStarting.java b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateStarting.java index 7d94aca7111..363c0d76c00 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateStarting.java +++ b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/LargeBlockUpdateStarting.java @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.world.block.entity.neighbourUpdate; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class LargeBlockUpdateStarting implements Event { } diff --git a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/NeighbourBlockFamilyUpdateSystem.java b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/NeighbourBlockFamilyUpdateSystem.java index 4744d59070e..6efef81e2c9 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/NeighbourBlockFamilyUpdateSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/entity/neighbourUpdate/NeighbourBlockFamilyUpdateSystem.java @@ -8,21 +8,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.engine.math.Side; import org.terasology.engine.registry.In; -import org.terasology.engine.world.block.family.BlockFamily; -import org.terasology.engine.world.block.family.UpdatesWithNeighboursFamily; import org.terasology.engine.world.BlockEntityRegistry; import org.terasology.engine.world.OnChangedBlock; import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.engine.world.block.family.BlockFamily; +import org.terasology.engine.world.block.family.UpdatesWithNeighboursFamily; import org.terasology.engine.world.block.items.OnBlockItemPlaced; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Set; diff --git a/engine/src/main/java/org/terasology/engine/world/block/entity/placement/BlockPlacingSystem.java b/engine/src/main/java/org/terasology/engine/world/block/entity/placement/BlockPlacingSystem.java index d00b0d76155..c160d60c3fd 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/entity/placement/BlockPlacingSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/entity/placement/BlockPlacingSystem.java @@ -4,20 +4,22 @@ 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldComponent; import org.terasology.engine.world.WorldProvider; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class BlockPlacingSystem extends BaseComponentSystem { @In private WorldProvider worldProvider; - @ReceiveEvent(components = WorldComponent.class, priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent(components = WorldComponent.class) public void placeBlockInWorld(PlaceBlocks event, EntityRef world) { worldProvider.setBlocks(event.getBlocks()); } diff --git a/engine/src/main/java/org/terasology/engine/world/block/items/BlockItemSystem.java b/engine/src/main/java/org/terasology/engine/world/block/items/BlockItemSystem.java index 0b95e216434..15bc6ffd94e 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/items/BlockItemSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/items/BlockItemSystem.java @@ -9,14 +9,9 @@ import org.terasology.engine.audio.AudioManager; import org.terasology.engine.audio.events.PlaySoundEvent; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; -import org.terasology.engine.world.block.entity.placement.PlaceBlocks; -import org.terasology.engine.world.block.family.BlockFamily; -import org.terasology.engine.world.block.family.BlockPlacementData; -import org.terasology.joml.geom.AABBf; import org.terasology.engine.logic.characters.KinematicCharacterMover; import org.terasology.engine.logic.common.ActivateEvent; import org.terasology.engine.logic.inventory.ItemComponent; @@ -32,6 +27,11 @@ import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.engine.world.block.entity.placement.PlaceBlocks; +import org.terasology.engine.world.block.family.BlockFamily; +import org.terasology.engine.world.block.family.BlockPlacementData; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; +import org.terasology.joml.geom.AABBf; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockItemPlaced.java b/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockItemPlaced.java index 05c863c8282..be11e27c9d6 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockItemPlaced.java +++ b/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockItemPlaced.java @@ -5,7 +5,7 @@ import org.joml.Vector3i; import org.joml.Vector3ic; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event gets called whenever a block item is placed in the world diff --git a/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockToItem.java b/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockToItem.java index e5c079a487d..d31b09574d7 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockToItem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/items/OnBlockToItem.java @@ -3,7 +3,7 @@ package org.terasology.engine.world.block.items; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This event is sent when a block in the world is turned into an item, to allow modification of the item entity. diff --git a/engine/src/main/java/org/terasology/engine/world/block/regions/BlockRegionSystem.java b/engine/src/main/java/org/terasology/engine/world/block/regions/BlockRegionSystem.java index d17d82f1ce9..12205971670 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/regions/BlockRegionSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/regions/BlockRegionSystem.java @@ -5,7 +5,7 @@ import org.joml.Vector3ic; 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.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -13,6 +13,7 @@ import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.BlockManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.AUTHORITY) public class BlockRegionSystem extends BaseComponentSystem { @@ -24,7 +25,8 @@ public class BlockRegionSystem extends BaseComponentSystem { private BlockManager blockManager; // trivial priority so that all other logic can happen to the region before erasing the blocks in the region - @ReceiveEvent(priority = EventPriority.PRIORITY_TRIVIAL) + @Priority(EventPriority.PRIORITY_TRIVIAL) + @ReceiveEvent public void onDestroyed(DoDestroyEvent event, EntityRef entity, BlockRegionComponent blockRegion) { for (Vector3ic blockPosition : blockRegion.region) { worldProvider.setBlock(blockPosition, blockManager.getBlock(BlockManager.AIR_ID)); diff --git a/engine/src/main/java/org/terasology/engine/world/block/structure/BlockStructuralSupportSystem.java b/engine/src/main/java/org/terasology/engine/world/block/structure/BlockStructuralSupportSystem.java index d717e6a1c5e..9ea67f18815 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/structure/BlockStructuralSupportSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/structure/BlockStructuralSupportSystem.java @@ -7,7 +7,6 @@ import org.joml.Vector3ic; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.prefab.PrefabManager; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -22,6 +21,7 @@ import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; import org.terasology.engine.world.block.entity.placement.PlaceBlocks; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Collections; import java.util.Comparator; diff --git a/engine/src/main/java/org/terasology/engine/world/block/structure/SideBlockSupportRequired.java b/engine/src/main/java/org/terasology/engine/world/block/structure/SideBlockSupportRequired.java index 17c00e989ad..cc265e397c7 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/structure/SideBlockSupportRequired.java +++ b/engine/src/main/java/org/terasology/engine/world/block/structure/SideBlockSupportRequired.java @@ -5,7 +5,6 @@ import org.joml.Vector3i; import org.joml.Vector3ic; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.prefab.PrefabManager; import org.terasology.engine.logic.delay.DelayManager; import org.terasology.engine.logic.delay.DelayedActionTriggeredEvent; @@ -16,6 +15,7 @@ import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockComponent; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Collections; import java.util.Map; diff --git a/engine/src/main/java/org/terasology/engine/world/block/typeEntity/BlockTypeClientSystem.java b/engine/src/main/java/org/terasology/engine/world/block/typeEntity/BlockTypeClientSystem.java index 9d341a97c8a..7bc6099a315 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/typeEntity/BlockTypeClientSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/block/typeEntity/BlockTypeClientSystem.java @@ -6,13 +6,13 @@ import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.registry.CoreRegistry; import org.terasology.engine.world.block.Block; import org.terasology.engine.world.block.BlockManager; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; @RegisterSystem(RegisterMode.REMOTE_CLIENT) public class BlockTypeClientSystem extends BaseComponentSystem { diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/event/BeforeChunkUnload.java b/engine/src/main/java/org/terasology/engine/world/chunks/event/BeforeChunkUnload.java index 4dad0f21972..5e3e5bf4537 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/event/BeforeChunkUnload.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/event/BeforeChunkUnload.java @@ -5,7 +5,7 @@ import org.joml.Vector3i; import org.joml.Vector3ic; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class BeforeChunkUnload implements Event { diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkGenerated.java b/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkGenerated.java index 8bce8e10051..dacf1053eb8 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkGenerated.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkGenerated.java @@ -4,7 +4,7 @@ import org.joml.Vector3i; import org.joml.Vector3ic; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class OnChunkGenerated implements Event { diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkLoaded.java b/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkLoaded.java index a3fdfa40dd0..75f7c970d46 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkLoaded.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/event/OnChunkLoaded.java @@ -5,7 +5,7 @@ import org.joml.Vector3i; import org.joml.Vector3ic; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; public class OnChunkLoaded implements Event { private Vector3i chunkPos = new Vector3i(); diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/event/PurgeWorldEvent.java b/engine/src/main/java/org/terasology/engine/world/chunks/event/PurgeWorldEvent.java index 32d02a31d25..d17abe238f3 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/event/PurgeWorldEvent.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/event/PurgeWorldEvent.java @@ -3,7 +3,7 @@ package org.terasology.engine.world.chunks.event; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * This {@link Event} is fired when the chunk provider purges diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/localChunkProvider/RelevanceSystem.java b/engine/src/main/java/org/terasology/engine/world/chunks/localChunkProvider/RelevanceSystem.java index 2498d7da966..50c48ed9639 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/localChunkProvider/RelevanceSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/localChunkProvider/RelevanceSystem.java @@ -9,7 +9,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeDeactivateComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.engine.logic.location.LocationComponent; import org.terasology.engine.monitoring.Activity; @@ -24,6 +23,7 @@ import org.terasology.engine.world.chunks.event.OnChunkLoaded; import org.terasology.engine.world.chunks.internal.ChunkRelevanceRegion; import org.terasology.engine.world.chunks.pipeline.PositionFuture; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.util.Collection; import java.util.Comparator; diff --git a/engine/src/main/java/org/terasology/engine/world/internal/EntityAwareWorldProvider.java b/engine/src/main/java/org/terasology/engine/world/internal/EntityAwareWorldProvider.java index ac215ae4d8d..b05fe13349e 100644 --- a/engine/src/main/java/org/terasology/engine/world/internal/EntityAwareWorldProvider.java +++ b/engine/src/main/java/org/terasology/engine/world/internal/EntityAwareWorldProvider.java @@ -28,7 +28,6 @@ import org.terasology.engine.entitySystem.entity.lifecycleEvents.BeforeEntityCreated; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent; import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.metadata.ComponentMetadata; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem; @@ -43,6 +42,7 @@ import org.terasology.engine.world.block.BlockRegion; import org.terasology.engine.world.block.regions.BlockRegionComponent; import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import org.terasology.reflection.metadata.FieldMetadata; import java.util.Collection; diff --git a/engine/src/main/java/org/terasology/engine/world/selection/BlockSelectionSystem.java b/engine/src/main/java/org/terasology/engine/world/selection/BlockSelectionSystem.java index e7a4aaa0c03..bd626f1fb49 100644 --- a/engine/src/main/java/org/terasology/engine/world/selection/BlockSelectionSystem.java +++ b/engine/src/main/java/org/terasology/engine/world/selection/BlockSelectionSystem.java @@ -6,14 +6,14 @@ import org.joml.Vector3f; import org.joml.Vector3i; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; import org.terasology.engine.logic.location.LocationComponent; +import org.terasology.engine.world.block.BlockRegion; import org.terasology.engine.world.selection.event.SetBlockSelectionEndingPointEvent; import org.terasology.engine.world.selection.event.SetBlockSelectionStartingPointEvent; -import org.terasology.engine.world.block.BlockRegion; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; /** * This system updates block selections based on the sender's location and the state of the block selection. diff --git a/engine/src/main/java/org/terasology/engine/world/time/TimeEventBase.java b/engine/src/main/java/org/terasology/engine/world/time/TimeEventBase.java index c448e92c8e6..7b4aa558c45 100644 --- a/engine/src/main/java/org/terasology/engine/world/time/TimeEventBase.java +++ b/engine/src/main/java/org/terasology/engine/world/time/TimeEventBase.java @@ -4,7 +4,7 @@ package org.terasology.engine.world.time; import com.google.common.math.LongMath; -import org.terasology.engine.entitySystem.event.Event; +import org.terasology.gestalt.entitysystem.event.Event; /** * A base class for different timer events diff --git a/subsystems/DiscordRPC/src/main/java/org/terasology/subsystem/discordrpc/DiscordRPCSystem.java b/subsystems/DiscordRPC/src/main/java/org/terasology/subsystem/discordrpc/DiscordRPCSystem.java index 8b9e870b1f0..8332238f899 100644 --- a/subsystems/DiscordRPC/src/main/java/org/terasology/subsystem/discordrpc/DiscordRPCSystem.java +++ b/subsystems/DiscordRPC/src/main/java/org/terasology/subsystem/discordrpc/DiscordRPCSystem.java @@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.entitySystem.entity.EntityRef; -import org.terasology.engine.entitySystem.event.ReceiveEvent; import org.terasology.engine.entitySystem.systems.BaseComponentSystem; import org.terasology.engine.entitySystem.systems.RegisterMode; import org.terasology.engine.entitySystem.systems.RegisterSystem; @@ -20,6 +19,7 @@ import org.terasology.engine.network.NetworkMode; import org.terasology.engine.network.NetworkSystem; import org.terasology.engine.registry.In; +import org.terasology.gestalt.entitysystem.event.ReceiveEvent; import java.time.OffsetDateTime;