A fabric mod and api that lets you change player gravity direction

Overview

GravityChanger

A fabric mod and api that lets you change player gravity direction.

Features

This mod adds 6 items that let you change your gravity to any of the 6 axis directions.
These items are currently uncraftable and can be found in the tools tab of creative menu.
This mod can also be used as an api to let other mods change player gravity.

Required Dependencies

Fabric Api
Cloth Config

Optional Dependencies

Mod Menu

Config

This mod has a config located in .minecraft/config/gravitychanger.json. You can edit it manually or in game using modmenu.
The config has 2 categories: Client and Server.
Client category contains options that only take effect on the client and need to be set on the client.
Server category contains options that only take effect on the server and need to be set in the server config. If you are playing in singleplayer your server uses the same config as your client and you can change it from modmenu. If you are playing on a server the server config is not updated when you change it on your client, it can only be edited using the server config file.

Commands

/gravity get <player> - gets player's gravity, returns direction index(0-5)
/gravity set <direction> <players> - sets gravity for selected players
/gravity rotate <direction> <players> - rotates gravity for selected players relative to their look direction
/gravity randomise <players> - randomises gravity for selected players

Importing

To import the mod you can use modrinth maven.
Add the following to your project:

grable.properties

gravitychanger_version = 0.3.0

Replace 0.2.0 with the version you want to use from here.

build.gradle

repositories {
    maven {
		name = "Modrinth"
		url = "https://api.modrinth.com/maven"
		content {
			includeGroup "maven.modrinth"
		}
	}
}

dependencies {
    modImplementation "maven.modrinth:gravitychanger:${project.gravitychanger_version}"
}

fabric.mod.json

"depends": {
    "gravitychanger": "^0.3.0"
}

Replace 0.3.0 with the lowest version of the mod your mod works with

Now you should be able to use methods in me.andrew.gravitychanger.api.GravityChangerAPI class to manipulate player gravity.

Comments
  • Weirdness of movement handling

    Weirdness of movement handling

    I found that this mod handles movement in a weird way, causing the velocity to be "wrong". When the player's gravity direction is up and the player is moving towards positive x direction, the velocity's x value is negative. This will cause many issues because the velocity is deemed as in the world coordinate, not the player's self coordinate. With this, Immersive Portals mod cannot transform velocity correctly if the player crosses a portal with rotation transformation.

    I see that you are modifying the argument in Entity#move. https://github.com/Gaider10/GravityChanger/blob/master/src/main/java/me/andrew/gravitychanger/mixin/EntityMixin.java#L210 The better way is to not change move but change the velocity update code Entity#updateVelocity.

    opened by qouteall 5
  • Player gets stuck when joining a server with another player until gravity is changed

    Player gets stuck when joining a server with another player until gravity is changed

    When joining a server/Lan world, if there a player already in the server the player that joins gets stuck and can't/doesn't move, if gravity is changed movement becomes normal. if the player dies, instead of resetting its gravity it keeps it but there is weird collision bugs until gravity is updated

    bug 
    opened by Ch1216 3
  • Camera works strange

    Camera works strange

    Camera shouldn't save its previous state in the gravity direction but instead pick the closest possible one in the current gravity direction and apply it after gravity changing

    enhancement 
    opened by ImSpaceLover 3
  • Strange movement while gravity is set to Up.

    Strange movement while gravity is set to Up.

    While the gravity is set to Up, movement while facing directly east/west is swapped (i.e. pressing W to moves you backward relative to your perspective instead of forward). Facing between north/south and east/west also alters movement, and changing the config file has no effect on this ("keepWorldLook", "client", and "server" have all been changed to no avail).

    My current version of each required mod includes: GravityChanger-0.3.0-1.18.1 cloth-config-6.1.48-fabric fabric-api-0.44.0+1.18 fabric-loader-0.12.11-1.18.1

    By the looks of it, #19 also mentions this. Something must have happened with the latest update that messed with this fix. I'm not that great at coding, so I likely won't be much help in that regard.

    opened by Limesar 2
  • API request

    API request

    I am considering integrating Immersive Portals (ImmPtl) mod with Gravity Changer mod. To accomplish that, I need GravityChanger to provide some sets of API:

    • Get the offset of the player's eye pos from the player's feet pos.
    • ~~Set a player's gravity direction without changing the camera position. (currently, the API keeps the feet pos and change eye pos when changing gravity)~~ Turns out not needed
    • ~~Get the camera rotation quaternion~~ Turns out not needed

    (this list may change) I can implement these API on ImmPtl's side. But it would be better that gravity changer provides these API.

    And I prefer the API of another style. For example, currently setting a player's gravity direction is done by

    ((RotatableEntityAccessor) player).gravitychanger$setGravityDirection(direction, false);
    

    I want this kind of API:

    GravityChangerAPI.setGravityDirection(player, direction)
    

    https://github.com/qouteall/ImmersivePortalsMod/issues/877

    opened by qouteall 2
  • Invalid injection crash on startup with latest Pehkui

    Invalid injection crash on startup with latest Pehkui

    Log

    Latest of all 4 mods. (Cloth Config, Fabric API, Pehkui, and GravityChanger)

    Related information seems to be: Specified index 0 for @ModifyArg is invalid for args (Lnet/minecraft/class_238;DDD), expected D on net/minecraft/class_1657::onTickMovementExpandXProxy

    bug 
    opened by stormdirus2 2
  • Suggestion: Some way of death after Y=450

    Suggestion: Some way of death after Y=450

    A survival player with no way of changing its gravity, would get stuck if it fell while being on up gravity, I suggest some kind of way to reset player position / just kill them some way after Y=450, like just death after y=450 or start taking damage like the void since your running out of oxygen, it would be great if this could be a gamerule or config

    enhancement 
    opened by Ch1216 2
  • Suggestion: /gravity command

    Suggestion: /gravity command

    Note: I used my minecraft username instead of [player].

    Set:

    /gravity set [direction] [player] - sets players's gravity direction

    Example: /gravity set North I_like_Space

    Get:

    /gravity get [player] - returns player's gravity direction

    Example: Executed command: /gravity get direction I_like_Space Console/chat output: Gravity direction of I_like_Space is East

    Reset:

    /gravity reset [player] - sets player's gravity to Down

    Example: /gravity reset I_like_Space

    Persist:

    /gravity persist [direction] [player] - makes player's gravity stay the same after death or /gravity persist [player] - does the same thing but uses current gravity direction instead of [direction]

    Example: /gravity persist North I_like_Space or /gravity persist I_like_Space

    Invert:

    /gravity invert [player] - inverts player's gravity depending on their current gravity

    Example: Previous direction: East Command: /gravity invert I_like_Space Current direction: West

    Randomize:

    /gravity randomize [player] - changes player's gravity to a random one

    Example: /gravity randomize I_like_Space

    Rotate:

    /gravity rotate [forward/backward/left/right] [player] - changes player's gravity relative to their current gravity.

    Example: Previous direction: Down Was looking at: North Executed command: /gravity rotate forward I_like_Space
    Current direction: North

    Previous direction: North Was looking at: East Executed command: /gravity rotate left I_like_Space
    Current direction: Up

    enhancement 
    opened by ImSpaceLover 2
  • Optifine causes camera issues

    Optifine causes camera issues

    First off, it's about time someone made a rotational gravity mod since 1.12!!!

    The mod works great when I tried it out on 1.18.1. Then I decided to install optifine for 1.18.1 and things started to go whacky. The gravity still worked as intended, but the camera is no longer orientated correctly to the gravity direction. Its orientation stays as if my gravity is normal (down), but the camera does some freaky stuff when I look around, and it's way more apparent when I switch to 3rd person.

    Is this mod not compatible with optifine? Hopefully this is just a bug with this version and I don't know if this bug exists in the 1.17 version or not. Haven't tried it yet.

    Also, since I'm speaking here, I got a couple of suggestions: -Is it possible to extend this mod's behavior to items, or more importantly all mobs? For example, using commands, all entities (@e) within certain coordinates or a certain radius will have their gravity direction changed to whatever is specified. -And can you make a smooth camera transition switching between gravity directions like in the Starminer or Up and Down and All Around mods? The sudden camera switch is kinda nausea-inducing for me at least.

    Other than this issue, and my suggestions, I'm loving this mod so far. Keep up the great work!

    opened by XDCam15 1
  • "3d vine" blocks only work when your standing on top of them

    by 3d vine blocks i mean, Cave vines/Glow berries, Twisting vines and Weeping vines, by standing on top of them I mean relatively on top (image for example) (https://user-images.githubusercontent.com/68875386/146688871-4142ee7e-5483-4342-b732-fa5f5be21089.png) If you try to use them from beneath they don't work

    opened by Ch1216 1
  • About dependency management

    About dependency management

    According to the ReadMe https://github.com/Gaider10/GravityChanger/blob/master/README.md , you recommend configuring dependency using the dev jar. The normal way that Fabric proposes is to publish the mod jar (not dev jar) into maven and use Maven for dependency. You can publish this mod to Modrinth https://modrinth.com/ then we can use the maven repo provided by Modrinth.

    The dev jar dependency has these drawbacks:

    • If the other mod's dev env uses a different version of yarn mapping, it may break. If that dev env use Mojang mapping, it cannot work
    • If I don't put that jar into git, then other people forking my project can't compile. If I put that jar into git, the git file will swell if I upgrade the dependency (it's hard to fully delete things from a git repo)
    opened by qouteall 1
  • Gravity resets, but perspective doesn't on death

    Gravity resets, but perspective doesn't on death

    Dying while in a different form of gravity causes the player to respawn with standard gravity, but whatever perspective the player was rotated to on death

    opened by AwwShoot 1
Releases(0.3.0)
Owner
null
Minecraft mod to change the stack size of all items. Fabric 1.17

Stacker Minecraft mod to change the stack size of all items. For Fabric 1.17 Note: This mod has a config that defaults to 64. Change it to be whatever

Andrew Grant 18 Sep 25, 2022
A mod that lets you create "contracts" that transfer ownership of pets and other tameable entities.

Pet Transfer A simple mod for Fabric that lets you create contracts that can transfer ownership of pets and other tameable creatures. No Forge port pl

Emirikol 2 Jan 14, 2022
CustomHandGUI - This mod allows you to change hands position on screen

CustomHandGUI This mod allows you to change hands position on screen And you can change your main hand to be left hand! Keybindings: F - Swaps hands.

AqUpd 2 Apr 11, 2022
COMMA Config API is an API allowing you to easily create complex and stylish config menu screens for Minecraft Fabric mods

COMMA Config API is an API allowing you to easily create complex and stylish config menu screens for Minecraft Fabric mods. COMMA stands for Configurable Options Menu Modding API

Dr. Rubisco 1 Jan 13, 2022
Polydex - a mod allowing you to see player-friendly information about blocks and items on servers

Polydex is a mod allowing you to see player-friendly information about blocks and items on servers. It designed for survival-like, vanilla client compatible servers using Polymer mods or PolyMC, through it can be used in modded or vanilla-content setting!

null 5 Dec 20, 2022
C2ME-fabric - A Fabric mod designed to improve the chunk performance of Minecraft.

C^2M-Engine A Fabric mod designed to improve the chunk performance of Minecraft. So what is C2ME? C^2M-Engine, or C2ME for short, is a Fabric mod desi

null 414 Jan 7, 2023
A client-side Fabric mod for Minecraft Beta 1.7.3 that allows you to connect to servers running almost any patch from Alpha v1.1.2_01 to Beta 1.7.3.

multiversion-fabric A client-side Fabric mod for Minecraft Beta 1.7.3 that allows you to connect to servers running almost any patch from Alpha v1.1.2

0n1 2 Mar 13, 2022
A simple Serverside Fabric mod that allows you to assign commands to Item(Stacks)

Item Commander Shiny item do stuff A simple Serverside Fabric mod that allows you to assign commands to Item(Stacks). It works by adding NBT data to t

null 2 Feb 25, 2022
resetchunks is a tiny fabric mod that re-adds the /resetchunks command, allowing you to regenerate one or more chunks

resetchunks is a tiny fabric mod that enables the /resetchunks command, allowing you to regenerate one or more chunks.

Potassium 5 Jul 25, 2022
An elegant Minecraft mod template for the Fabric mod loader

Fabric Example Mod Lorem ipsum dolor sit amet Example is a Minecraft mod that lorem ipsum dolor sit amet. Ut mi lectus, egestas a justo nec, hendrerit

Axieum 24 Dec 25, 2022
Addon to the Minecraft Forge/Fabric mod InvMove that adds mod compatibilities

Addon to the Minecraft Forge/Fabric mod InvMove that adds mod compatibilities

David M. 3 Oct 21, 2022
A fabric mod that works with the URMW API

URMW-Helper-Mod URMW-Helper is a fully client side Fabric mod that works with the URMW API. The goal of the mod is to get rid of the awkward switching

null 1 Jan 26, 2022
Run Fabric Mods on Forge! It's an mod loading api, too (not implemented yet). No any releationship between Python library PILlow.

Pillow Mod Loader 中文 | English Quilt that runs on Forge Not implemented yet. Yes, you can believe it. This mod will make Quilt compatible with Forge.

null 18 Dec 20, 2022
Create: Liftoff is a create addon that hopes to empower the player even more with the industrial age of the create mod and space rockets!

Create: Liftoff Welcome to Create: Liftoff, a mod that hopes to empower the player even more with the industrial age of the create mod and space rocke

Tazer 9 Jun 6, 2022
A minecraft mod that adds colored ping values inside each player's nametag.

Ping Nametags (Fabric) A minecraft mod that adds colored ping values inside each player's nametag. Installation Stable Releases (recommended) The late

Paul Soporan 3 Nov 21, 2021
A Minecraft mod to track the position of every player connected to your server.

WAT (Where are they?) WAT is a mod to track the position of every player connected to a server and then log those positions into a text file. Those lo

Alexander IP 5 Aug 8, 2022
A mod about player interactions, made for Modfest: Singularity.

Affectionate A mod about affectionate player interactions, made for Modfest: Singularity. What is it? This mod focuses on affectionate player interact

LambdAurora 15 Dec 10, 2022
Add an event on Spigot API to listen to players kill a player with EnderCrystal

(Minecraft) Add an event on Spigot API to listen to players kill a player with EnderCrystal

Guang_Chen_ 4 Dec 22, 2022
A Minecraft Mod for Fabric which aims to make Block Entity rendering faster and more customizable with almost no compromises.

Enhanced Block Entities EBE is a 100% client side mod for Minecraft on the Fabric mod loader which aims to increase the performance of block entity re

null 151 Dec 30, 2022