Skip to content

Commit

Permalink
Add vertical flight speed config option πŸ›«πŸ›«πŸ›«πŸ›«πŸ›«
Browse files Browse the repository at this point in the history
Adds a new config option to tweak vertical creative
flight speed _while sprinting_. This is disabled by
default and found in tweaks.cfg rather than mixins.cfg
for being non-vanilla behavior.

In vanilla, vertical flight is 3/5 the speed of horizontal
flight, so users who want a 1:1 x/y flight speed ratio can
set verticalFlightSpeed higher than its horizontal
counterpart.

There is one, problem, with this currently, and that is
the flight down button (shift) also stops the player from
sprinting. I plan to address this in another PR/commit
that prevents shift from breaking sprint in creative.
( will be disabled by default )

Signed-off-by: Richard Rogalski <[email protected]>
  • Loading branch information
Richard-Rogalski committed Dec 19, 2024
1 parent ca2579b commit 9f29561
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ConfigTweaks extends ConfigBase {
public static boolean deepslateReplacesCobblestone;
public static boolean stonecutterSawHurts;
public static boolean squidsBlindPlayers;
public static float creativeFlightVerticalModifier;

public static final String catAbandoned = "abandoned ideas";
public static final String catCustomTweaks = "custom tweaks";
Expand Down Expand Up @@ -43,6 +44,7 @@ protected void syncConfigOptions() {
deepslateReplacesCobblestone = getBoolean("deepslateReplacesCobblestone", catCustomTweaks, false, "If you want cobblestone to be replaced with cobbled deepslate during world generation.");
stonecutterSawHurts = getBoolean("stonecutterSawHurts", catCustomTweaks, false, "If you want stonecutters to deal damage to players standing on them.");
squidsBlindPlayers = getBoolean("squidsBlindPlayers", catCustomTweaks, false, "Squids will blind players when they take damage.");
creativeFlightVerticalModifier = getFloat("creativeFlightVerticalModifier", catCustomTweaks, 1, 1, 5, "When greater than 1, boosts vertical(up/down) creative flight speed when sprinting.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ganymedes01.etfuturum.configuration.configs.ConfigEnchantsPotions;
import ganymedes01.etfuturum.configuration.configs.ConfigEntities;
import ganymedes01.etfuturum.configuration.configs.ConfigMixins;
import ganymedes01.etfuturum.configuration.configs.ConfigTweaks;
import ganymedes01.etfuturum.lib.Reference;
import net.minecraft.launchwrapper.Launch;
import org.spongepowered.asm.mixin.MixinEnvironment;
Expand Down Expand Up @@ -129,7 +130,7 @@ public List<String> getMixins(Set<String> loadedCoreMods) {
mixins.add("randomtickspeed.MixinWorldServer");
}

if (ConfigMixins.creativeFlightSpeedModifier > 1) {
if (ConfigMixins.creativeFlightSpeedModifier > 1 || ConfigTweaks.creativeFlightVerticalModifier > 1) {
mixins.add("flyspeed.MixinEntityPlayer");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ganymedes01.etfuturum.mixins.early.flyspeed;

import ganymedes01.etfuturum.configuration.configs.ConfigMixins;
import ganymedes01.etfuturum.configuration.configs.ConfigTweaks;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
Expand All @@ -23,5 +24,6 @@ public MixinEntityPlayer(World p_i1594_1_) {
@Inject(method = "moveEntityWithHeading", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;moveEntityWithHeading(FF)V", ordinal = 0))
private void setMovementFactor(float p_70612_1_, float p_70612_2_, CallbackInfo ci) {
this.jumpMovementFactor = this.capabilities.getFlySpeed() * (this.isSprinting() ? ConfigMixins.creativeFlightSpeedModifier : 1);
this.motionY = this.motionY * 0.6D * (this.isSprinting() ? ConfigTweaks.creativeFlightVerticalModifier : 1);
}
}
}

0 comments on commit 9f29561

Please sign in to comment.