hammy275 / mc-vr-api

An API to allow mod developers to see VR player data from Vivecraft.
GNU Lesser General Public License v3.0
8 stars 0 forks source link

VRPlayerTick #8

Closed hammy275 closed 2 years ago

hammy275 commented 2 years ago

This should be similar to a Forge event, but won't actually be.

Whenever TickEvent.PlayerTickEvent is called, it should get all of the plugin instances (probably from a variable they're stored into at startup), we should call a VRPlayerTick function, that is passed in all of the parameters from TickEvent.PlayerTickEvent.

The reason we do this over a regular Forge event is so it can be easily used without requiring the API, similarly to the rest of the API.

hammy275 commented 2 years ago

Note, I'm changing the system massively, so we can easily add new events without having to change the plugin interface (as that would require a major version bump each time we add a new event).

Instead, IVRAPI/VRAPI instances now contain a method called registerVRPlayerTickHandler, which registers a function that can take an instance of IVRPlayerTick/VRPlayerTick. When a new VRPlayerTick instance is created, it calls IVRPlayerTick on all the handlers. VRPlayerTick instances are created in the API's CommonSubscriber

hammy275 commented 2 years ago

Added in https://github.com/hammy3502/mc-vr-api/commit/20e1d772d93778145a5eaf71aa2fc4072953b709