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

[Not an Issue] Making an Addon; Best java class to get VS2 ship's current speed variable #1119

Open
TimmyChips opened this issue Mar 8, 2025 · 4 comments

Comments

@TimmyChips
Copy link

TimmyChips commented Mar 8, 2025

(I was hoping to label this as "Will Not Fix" but unfortunately I cannot)
This is not an issue with ValkyrienSkies, thus why it's tagged as such, more so general support for developing a mod that uses VS2!

I was wanting to make a small addon that adds a Create mod contraption block that will output rotational speed based on the VS2 ship's current speed it is placed on, E.g. a VS2 ship going 20 blocks per second = 20 RPM output from this block. I figured I would ask a developer what the best java class to get the variable from, since I know the VS2 framework can be pretty complex. I know this is an odd request, so feel free to dismiss it if you'd like!

@PriestOfFerns
Copy link

@TimmyChips I wouldn't recommend using java, as kotlin (which is what's used used by most addons) is much easiier to work with VS2-wise, since VS2 has a ton of kotlin only extension functions + most VS2 addons are written in kotlin

@PriestOfFerns
Copy link

Either way, to really answer this question I'll need to know what VS2 version you're using. A massive api and physics back end update has happened between public VS2 (2.1/2.3) and in-dev VS2 (2.5). Both are publicly available, but in-dev isn't on curseforge or modrinth (And is also fairly unstable).

@TimmyChips
Copy link
Author

@PriestOfFerns The version I'm using is the public VS2 2.3 build. Right, I'll have to go with the Kotlin route, I completely forgot VS2 was written in Kotlin and not Java. Thanks again for replying!

@PriestOfFerns
Copy link

@TimmyChips Here's a function I wrote some time ago to get linear speed. If you're trying to do a generator that turns rotational movement into SU, you'll need to use ship.omega (angular velocity)

fun getShipSpeed(): Double {
        var ship = level.getShipManagingPos(blockPos)
        if (ship != null) {
            return ship.velocity.length()
        }
        return 0.0
    }

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

No branches or pull requests

2 participants