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 compatibility with Linkart mod #23

Closed
wants to merge 4 commits into from

Conversation

GeeTransit
Copy link

@GeeTransit GeeTransit commented Sep 10, 2023

Linkart has an interface we can use to check if a minecart is a train (instead of reading from NBT, which you've mentioned was computationally expensive). The Mods utility enum handles optional dependencies (such as Linkart).

For all carts in a train except the leader, they use the modified speed logic (so that they can match the speed of the first cart). I've removed checks for this.hasPassengers() as the code already checks it for standalone carts (in moveOnRailOverwrite).

For the leading cart, nothing much changes - it'll use the vanilla logic if the cart is a chest/hopper minecart or if it's empty, and if it has a passenger it'll use the modified logic. The only change is for ensuring trains accelerate together. I loop through all the following carts to check that the whole train is at the same speed before accelerating (to prevent it from breaking apart).

Note that higher speeds might not work until this Linkart patch smoothing out minecart velocity is merged.

EDIT: I've built a 1.19.4 JAR containing these changes on the releases of my fork.

- Ensure Linkart chained trains accelerate together
- Linkart follower minecarts always use modified speed logic
- Removed redundant checks for this.hasPassengers()
- Added mods utility enum
@GeeTransit GeeTransit marked this pull request as ready for review September 10, 2023 01:24
@audaki
Copy link
Owner

audaki commented Sep 10, 2023

I just checked your changes, this is much more than a fix and therefore out of scope of what I want to maintain.

Feel free to fork this mod with your changes and publish it on your own.

@audaki audaki closed this Sep 10, 2023
Other mods can use AudakiCartEngine.registerModifiedEngineCheck to
register a cart checker function. Return true to force modified speed
logic, false to force vanilla speed logic.
@GeeTransit
Copy link
Author

GeeTransit commented Sep 17, 2023

I've reverted and simplified the changes above. It's closer to what the previous issue suggested as a fix (which is to make follower minecarts also have increased speed).

On Audaki Cart Engine's side, I added a hook for other mods to specify if a cart should use the modified speed logic or not.

On Linkart's side, it can register into the hook and specify that follower minecarts should use the modified speed logic. The acceleration capping logic (to keep the train together) can be implemented from Linkart's side (by using a ModifyArg on the .move() call).

Not sure if a new PR is needed since it's on the same branch.

Also no worries if it's out of scope again - CC0 is amazing :)

@audaki audaki reopened this Sep 17, 2023
@audaki
Copy link
Owner

audaki commented Sep 17, 2023

@GeeTransit

Hey, I had to reopen this pull request to see your changes. I checked your changes and thought about it. The changes are still kind of invasive and I do have the problem that I can't invest much time into maintaining atm. That's why I kept the scope as small as possible, as vanilla as possible, just like a bug fix for too low speed.

So I really think it'd be best if you forked it and published the mod yourself. I've already seen you have some ideas like different speeds by different ground types and I think many players would enjoy your fork!

kind regards, Kira

PS: Have fun with the fork 😊

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.

None yet

2 participants