mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add command to disable Gravity (#1955)
Allow disabling gravity (flying) for servers that allow this. /move gravity: show gravity handling status /move gravity on: enable gravity handling (falling) /move gravity off: disable gravity handling (flying) Co-authored-by: ORelio <ORelio@users.noreply.github.com>
This commit is contained in:
parent
288994aeec
commit
8795aab810
6 changed files with 33 additions and 14 deletions
|
|
@ -8,7 +8,7 @@ namespace MinecraftClient.Commands
|
|||
public class Move : Command
|
||||
{
|
||||
public override string CmdName { get { return "move"; } }
|
||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|x y z> [-f]"; } }
|
||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|x y z|gravity [on|off]> [-f]"; } }
|
||||
public override string CmdDesc { get { return "walk or start walking. \"-f\": force unsafe movements like falling or touching fire"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
|
|
@ -35,6 +35,14 @@ namespace MinecraftClient.Commands
|
|||
handler.SetTerrainEnabled(false);
|
||||
return Translations.Get("cmd.move.disable");
|
||||
}
|
||||
else if (args[0] == "gravity")
|
||||
{
|
||||
if (args.Count >= 2)
|
||||
Settings.GravityEnabled = (args[1] == "on");
|
||||
if (Settings.GravityEnabled)
|
||||
return Translations.Get("cmd.move.gravity.enabled");
|
||||
else return Translations.Get("cmd.move.gravity.disabled");
|
||||
}
|
||||
else if (handler.GetTerrainEnabled())
|
||||
{
|
||||
if (args.Count == 1)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ namespace MinecraftClient.Mapping
|
|||
/// <param name="motionY">Current vertical motion speed</param>
|
||||
/// <returns>Updated location after applying gravity</returns>
|
||||
public static Location HandleGravity(World world, Location location, ref double motionY)
|
||||
{
|
||||
if (Settings.GravityEnabled)
|
||||
{
|
||||
Location onFoots = new Location(location.X, Math.Floor(location.Y), location.Z);
|
||||
Location belowFoots = Move(location, Direction.Down);
|
||||
|
|
@ -36,6 +38,7 @@ namespace MinecraftClient.Mapping
|
|||
}
|
||||
else if (!(world.GetBlock(onFoots).Type.IsSolid()))
|
||||
location = Move2Steps(location, onFoots, ref motionY, true).Dequeue();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -311,6 +311,9 @@ cmd.move.dir_fail=Kann nicht in diese Richtung laufen.
|
|||
cmd.move.walk=Gehe nach {0}
|
||||
cmd.move.fail=Konnte Pfad nach {0} nicht berechnen.
|
||||
cmd.move.suggestforce=Weg nach {0} konnte nicht berechnet werden. Benutze den -f Parameter, um unsichere Wege zu aktivieren.
|
||||
cmd.move.gravity.enabled=Gravitation ist aktiv.
|
||||
cmd.move.gravity.disabled=Gravitation ist deaktiviert.
|
||||
|
||||
|
||||
# Reco
|
||||
cmd.reco.desc=Starte neu und verbinde erneut zum Server.
|
||||
|
|
|
|||
|
|
@ -311,6 +311,8 @@ cmd.move.dir_fail=Cannot move in that direction.
|
|||
cmd.move.walk=Walking to {0}
|
||||
cmd.move.fail=Failed to compute path to {0}
|
||||
cmd.move.suggestforce=Failed to compute a safe path to {0}. Try -f parameter to allow unsafe movements.
|
||||
cmd.move.gravity.enabled=Gravity is enabled.
|
||||
cmd.move.gravity.disabled=Gravity is disabled.
|
||||
|
||||
# Reco
|
||||
cmd.reco.desc=restart and reconnect to the server.
|
||||
|
|
|
|||
|
|
@ -311,6 +311,8 @@ cmd.move.dir_fail=Impossible de se déplacer dans cette direction.
|
|||
cmd.move.walk=Marche vers {0}
|
||||
cmd.move.fail=Échec de calcul du chemin vers {0}
|
||||
cmd.move.suggestforce=Échec de calcul du chemin vers {0}. Utilisez -f pour autoriser les mouvements risqués.
|
||||
cmd.move.gravity.enabled=La gravité est activée.
|
||||
cmd.move.gravity.disabled=La gravité est désactivée.
|
||||
|
||||
# Reco
|
||||
cmd.reco.desc=Relancer le programme et se reconnecter au serveur
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ namespace MinecraftClient
|
|||
public static bool DisplayChatLinks = true;
|
||||
public static bool DisplayInventoryLayout = true;
|
||||
public static bool TerrainAndMovements = false;
|
||||
public static bool GravityEnabled = true;
|
||||
public static bool InventoryHandling = false;
|
||||
public static string PrivateMsgsCmdName = "tell";
|
||||
public static CacheType SessionCaching = CacheType.Disk;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue