Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Event system with some basic events #45

Merged
merged 2 commits into from
Jan 3, 2023
Merged

Event system with some basic events #45

merged 2 commits into from
Jan 3, 2023

Conversation

Jeryn99
Copy link
Collaborator

@Jeryn99 Jeryn99 commented Jan 3, 2023

This adds a event system for other mods APIs
It comes with 3 basic events, Take off, land and Tardis entry

Copy link
Collaborator

@CommandrMoose CommandrMoose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start. Had some notes about the events you've created.

});

@FunctionalInterface
public interface TardisEntry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this event is fired, we already have an interior dimension registered or created. It would be beneficial for the event to contain the TARDISLevelOperator as they can already fetch the rest of this information from the relevant managers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough! Will do so

public interface Land {
void onLand(TardisLevelOperator tardisLevelOperator, LevelAccessor level, BlockPos pos);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No OnTardisExit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is code for the Landing Event? Unless you just used this line to ask why there was no Tardis exit event - and in that case, it's just because I only did 3 events to demonstrate the system

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imagine this was on onEnterTardis

@@ -239,6 +244,9 @@ public void beginFlight() {
}

public void endFlight() {
TardisNavLocation lastKnown = operator.getControlManager().getTargetLocation();
TardisEvents.LAND.invoker().onLand(operator, lastKnown.level, lastKnown.position);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TARDIS cannot end a flight until it hasn't met the criteria in line 250. This will act as if the TARDIS is confirmed to be landing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move the invoker

import whocraft.tardis_refined.client.TardisClientData;
import whocraft.tardis_refined.common.capability.TardisLevelOperator;
import whocraft.tardis_refined.common.dimension.DelayedTeleportData;
import whocraft.tardis_refined.common.dimension.fabric.DimensionHandlerImpl;
import whocraft.tardis_refined.common.tardis.IExteriorShell;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up imports

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

@@ -0,0 +1,43 @@
package whocraft.tardis_refined.api.event;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class could benefit from documentation, clarifying what each event means.

@Jeryn99 Jeryn99 merged commit 619f076 into master Jan 3, 2023
@CommandrMoose CommandrMoose deleted the feature/events branch January 4, 2023 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants