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

dimensional height offset -> 1.18.1 #63

Open
wants to merge 3 commits into
base: releases/1.18.1
Choose a base branch
from

Conversation

zsawyer
Copy link
Owner

@zsawyer zsawyer commented Jan 24, 2023

attempt to fix #35

zsawyer added 3 commits January 24, 2023 20:26
conversion scheme still converts Minecraft's a right-handed system to Mumble's left-handed system but using a different approach (switching z axis instead of previously swapping z and y axis)

fixes #55
                    // Make people in other dimensions far away so that they're muted.
                    val yAxisAdjuster = (world.registryKey.value.stableHash % 2048) * config.clientDimensionYAxisAdjust
                    camPos[1] += yAxisAdjuster

/**
 * A stable hash function designed for world IDs.
 * Different clients should be able to run this on the same world ID and get the same result.
 *
 * Based on the `djb2` hash function: [Hash Functions](http://www.cse.yorku.ca/~oz/hash.html)
 */
val Identifier.stableHash: Int
    get() {
        var hash = 5381

        for (c in this.toString()) {
            hash += (hash shl 5) + c.code
        }

        return hash
    }

fixes #35
@zsawyer zsawyer self-assigned this Jan 24, 2023
@zsawyer zsawyer added this to the 6.0.0 milestone Jan 24, 2023
Comment on lines +231 to +238
ResourceKey<Level> dimension = game.player.level.dimension();
if (dimension == null) {
// silently ignoring because it would become too spammy
return;
}

int configuredOffset = MumbleLinkImpl.dimensionalHeight();
int hash = LinkAPIHelper.stableHash(dimension.toString());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this dimension.toString is the same as what fabrics implementation uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant