diff --git a/src/openonyx/features/player/internal/internal/ScaffoldStrafe.java b/src/openonyx/features/player/internal/internal/ScaffoldStrafe.java new file mode 100644 index 0000000..fe2ee13 --- /dev/null +++ b/src/openonyx/features/player/internal/internal/ScaffoldStrafe.java @@ -0,0 +1,73 @@ +package openonyx.features.player.internal.internal; + +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.Entity; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import openonyx.configuration.internal.PreTickEvent; +import openonyx.core.MinecraftAccess; +import openonyx.history.Setting; +import openonyx.history.SettingSection; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.NumberSetting; +import openonyx.utilities.PlayerUtils; +import openonyx.utilities.VecUtils; + +public class ScaffoldStrafe extends SettingSection implements MinecraftAccess { + private transient int d; + public BooleanSetting hypixel; + public NumberSetting speed = new NumberSetting("Speed", 0.247, 0.0, 5.0, 0.001); + public static final ScaffoldStrafe INSTANCE = new ScaffoldStrafe(); + public BooleanSetting onlyOnGround; + + @EventHandler + private void onPreTick(PreTickEvent preTickEvent) { + if (mc.thePlayer != null) { + ScaffoldStrafe scaffoldStrafe1; + if (PlayerUtils.L(mc.thePlayer)) { + this.d++; + scaffoldStrafe1 = this; + } else { + this.d = 0; + scaffoldStrafe1 = this; + } + + if (!scaffoldStrafe1.onlyOnGround.getValue() || mc.thePlayer.onGround) { + if (this.hypixel.getValue()) { + double dx = 0.207; + PotionEffect potionEffect; + if (((potionEffect = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed)) != null ? potionEffect.getAmplifier() : -1) >= 0) { + dx = 0.295; + } + + if (mc.thePlayer.ticksExisted % 20 == 0 || this.d <= 7) { + dx = 0.09800000190734863; + } + + PlayerUtils.L(mc.thePlayer, PlayerUtils.L(PlayerUtils.L((Entity)mc.thePlayer), dx)); + } else { + PlayerUtils.L(mc.thePlayer, PlayerUtils.L(PlayerUtils.L((Entity)mc.thePlayer), this.speed.getFloat())); + } + } + } + } + + @Override + protected void d() { + if (this.hypixel.getValue() && mc.thePlayer != null) { + PlayerUtils.L(mc.thePlayer, VecUtils.d(PlayerUtils.L((Entity)mc.thePlayer), 0.5, 1.0, 0.5)); + } + } + + @Override + protected void D() { + this.d = 0; + } + + private ScaffoldStrafe() { + super("Strafe", false); + this.hypixel = new BooleanSetting("Hypixel", false); + this.onlyOnGround = new BooleanSetting("Only on ground", false); + this.visibleWhen(Setting.BOOLEAN_SUPPLIER); + } +} diff --git a/src/openonyx/features/player/internal/internal/ScaffoldStrafeSpeed.java b/src/openonyx/features/player/internal/internal/ScaffoldStrafeSpeed.java new file mode 100644 index 0000000..b987f06 --- /dev/null +++ b/src/openonyx/features/player/internal/internal/ScaffoldStrafeSpeed.java @@ -0,0 +1,30 @@ +package openonyx.features.player.internal.internal; + +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.Entity; +import openonyx.configuration.internal.PostJumpEvent; +import openonyx.core.MinecraftAccess; +import openonyx.history.Setting; +import openonyx.history.SettingSection; +import openonyx.history.internal.RangeSetting; +import openonyx.utilities.PlayerUtils; + +public class ScaffoldStrafeSpeed extends SettingSection implements MinecraftAccess { + public RangeSetting rangeSetting = RangeSetting.of("Straight speed", 0.48, 0.49, 0.1, 1.0); + public static final ScaffoldStrafeSpeed INSTANCE = new ScaffoldStrafeSpeed(); + public RangeSetting rangeSetting2 = RangeSetting.of("Diagonal speed", 0.48, 0.49, 0.1, 1.0); + + private ScaffoldStrafeSpeed() { + super("Strafe on jump", false); + this.visibleWhen(Setting.BOOLEAN_SUPPLIER); + } + + @EventHandler + private void onPostJump(PostJumpEvent postJumpEvent) { + if (mc.thePlayer != null) { + boolean bl = (float)(Math.rint((PlayerUtils.L(mc.thePlayer) + 180.0F) / 45.0F) * 45.0) % 90.0F == 0.0F; + RangeSetting rangeSettingx = bl ? this.rangeSetting : this.rangeSetting2; + PlayerUtils.L(mc.thePlayer, PlayerUtils.L(PlayerUtils.L((Entity)mc.thePlayer), rangeSettingx.random())); + } + } +}