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

Add OptiGUI support #69

Closed
wants to merge 16 commits into from
Closed

Conversation

opekope2
Copy link

@opekope2 opekope2 commented Mar 21, 2023

What works

  • Pressing the hotkey (but not inside the inventory, this needs a change in OptiGUI)

To be implemented

  • Right click support
    • This is tricky because UseItemCallback is processed server-side. Probably needs a client-side hook as well
  • Support in-inventory quick shulker (needs a change in OptiGUI)

To be changed (maybe)

  • Null safety?

To be discussed

  • Add OptiGUI as a required or an optional dependency (now: required)
    • If optional, it needs a wrapper code
  • Services.getService() throws if service is not found. The services used by the code are registered by OptiGUI

Closes #59
Closes opekope2/OptiGUI#19

@opekope2
Copy link
Author

The code is ready for review and discussion.

@opekope2 opekope2 marked this pull request as ready for review March 25, 2023 02:25
@kyrptonaught
Copy link
Owner

Thanks for this!

I'll look over everything soon.

I would prefer this to be an optional dependency, not required. I can do that part though.

@opekope2
Copy link
Author

A note about the code: it relies on packets sent in order, and MinecraftClient.execute is invoked in order (which are the case for the current Minecraft codebase)

@opekope2 opekope2 changed the title [WIP] Add OptiGUI support Add OptiGUI support Mar 25, 2023
@opekope2
Copy link
Author

Now OptiGUI is an optional dependency. You may decide to include it in "suggests" or "recommends". And yes, I tested it without OptiGUI and it didn't crash with ClassNotFoundException.
I'm not quite finished with OptiGUI docs, so I implemented the optional dependency stuff, because I know how my mod works.
Additionally, if you want to test it, make sure to download Fabric language Kotlin to run/mods, and extract the jars from OptiGUI jar to the run/mods folder in the project (commons-text and the appropriate optiglue is enough), because loom does something and otherwise you'll get a juicy "Error loading OptiGlue!" exception.

@opekope2
Copy link
Author

OptiGUI 2.0.0-beta.4 will introduce breaking change. I'll rewrite the code once OptiGUI 2.0.0 full release arrives, and open a new PR. Which will take some time.

@opekope2 opekope2 closed this Apr 20, 2023
@opekope2
Copy link
Author

opekope2 commented May 31, 2023

After the breaking change in OptiGUI 2.1.0-beta.1, the code has shrunk in size. I have updated the code.

Notes:

  • OptiGUI 2.1.0-beta.1 requires Fabric Loader 0.14.19, so I had to edit gradle.properties
  • Nested JARs need to be extracted into run/mods
  • A full build probably needs to be issued before running the client, otherwise OptiGUI may not load because of some dependency having the wrong version
  • Added a code to check the minimum OptiGUI version

To be discussed:

  • Add Fabric Language Kotlin as modLocalRuntime into build.gradle so it gets downloaded automatically?
  • Log something if OptiGUI is too old, so the user can see it?

@opekope2 opekope2 reopened this May 31, 2023
@kyrptonaught
Copy link
Owner

Can you port this to 1.20/.1? I'll do another look over then

@opekope2
Copy link
Author

opekope2 commented Jun 18, 2023

Not in the next two weeks, I'm having some time off coding and I may refactor OptiGUI again after that. I'll open another PR on the 1.20 branch when ready

@opekope2 opekope2 closed this Jun 18, 2023
@opekope2 opekope2 deleted the optigui-compat branch June 19, 2023 21:09
@opekope2 opekope2 restored the optigui-compat branch June 19, 2023 21:10
@opekope2 opekope2 mentioned this pull request Jul 3, 2023
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.

Quick Shulker compatibility Small issue with OptiGUI
2 participants