From 9f29561f40dce95c00d52f5ee91f5184e0d5ed5c Mon Sep 17 00:00:00 2001 From: Richard-Rogalski Date: Thu, 19 Dec 2024 11:35:44 -0600 Subject: [PATCH] =?UTF-8?q?Add=20vertical=20flight=20speed=20config=20opti?= =?UTF-8?q?on=20=F0=9F=9B=AB=F0=9F=9B=AB=F0=9F=9B=AB=F0=9F=9B=AB?= =?UTF-8?q?=F0=9F=9B=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../etfuturum/configuration/configs/ConfigTweaks.java | 2 ++ .../etfuturum/mixinplugin/EtFuturumEarlyMixins.java | 3 ++- .../etfuturum/mixins/early/flyspeed/MixinEntityPlayer.java | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigTweaks.java b/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigTweaks.java index 0a25561f..213acc27 100644 --- a/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigTweaks.java +++ b/src/main/java/ganymedes01/etfuturum/configuration/configs/ConfigTweaks.java @@ -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"; @@ -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."); } } diff --git a/src/main/java/ganymedes01/etfuturum/mixinplugin/EtFuturumEarlyMixins.java b/src/main/java/ganymedes01/etfuturum/mixinplugin/EtFuturumEarlyMixins.java index 5e5961df..40a36434 100644 --- a/src/main/java/ganymedes01/etfuturum/mixinplugin/EtFuturumEarlyMixins.java +++ b/src/main/java/ganymedes01/etfuturum/mixinplugin/EtFuturumEarlyMixins.java @@ -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; @@ -129,7 +130,7 @@ public List getMixins(Set loadedCoreMods) { mixins.add("randomtickspeed.MixinWorldServer"); } - if (ConfigMixins.creativeFlightSpeedModifier > 1) { + if (ConfigMixins.creativeFlightSpeedModifier > 1 || ConfigTweaks.creativeFlightVerticalModifier > 1) { mixins.add("flyspeed.MixinEntityPlayer"); } diff --git a/src/main/java/ganymedes01/etfuturum/mixins/early/flyspeed/MixinEntityPlayer.java b/src/main/java/ganymedes01/etfuturum/mixins/early/flyspeed/MixinEntityPlayer.java index d565e134..9323e6ed 100644 --- a/src/main/java/ganymedes01/etfuturum/mixins/early/flyspeed/MixinEntityPlayer.java +++ b/src/main/java/ganymedes01/etfuturum/mixins/early/flyspeed/MixinEntityPlayer.java @@ -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; @@ -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); } -} \ No newline at end of file +}