-
-
Notifications
You must be signed in to change notification settings - Fork 77
Add a global lua api to serve version helper functions #734
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
base: dev/1.21.1
Are you sure you want to change the base?
Conversation
…rsions from our addons. Also removed old unused IMC event
Build PreviewYou can find files attached to the below linked Workflow Run URL (Logs).
|
src/main/java/de/srendi/advancedperipherals/common/addons/APAddons.java
Outdated
Show resolved
Hide resolved
...java/de/srendi/advancedperipherals/common/addons/computercraft/luaapi/GlobalAPHelperAPI.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Kevin Z <[email protected]> Signed-off-by: Srendi <[email protected]>
...java/de/srendi/advancedperipherals/common/addons/computercraft/luaapi/GlobalAPHelperAPI.java
Outdated
Show resolved
Hide resolved
@@ -50,7 +50,7 @@ public class CCRegistration { | |||
|
|||
public static void register() { | |||
IntegrationPeripheralProvider.load(); | |||
ComputerCraftAPI.registerAPIFactory(unused -> new GlobalAPHelperAPI()); | |||
ComputerCraftAPI.registerAPIFactory(unused -> new GlobalVersionsLuaAPI()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's not related to computer environment, we can also use singleton for it.
ComputerCraftAPI.registerAPIFactory(unused -> new GlobalVersionsLuaAPI()); | |
ComputerCraftAPI.registerAPIFactory(unused -> GlobalVersionsLuaAPI.INSTANCE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
@@ -13,12 +13,9 @@ | |||
import java.util.Map; | |||
import java.util.Optional; | |||
|
|||
public class GlobalAPHelperAPI implements ILuaAPI { | |||
public class GlobalVersionsLuaAPI implements ILuaAPI { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static final String INSTANCE = new GlobalVersionsLuaAPI(); | |
Added a new global accessible lua api (to every computer, turtle and pocket) to serve helper functions to retrieve versions of AP, MC and our add-ons
I primarily had this idea when I made the new bridges and 0.8 to check if a script even supports your AP version.