diff --git a/src/openonyx/features/player/internal/internal/BridgeAction.java b/src/openonyx/features/player/internal/internal/BridgeAction.java new file mode 100644 index 0000000..985b31a --- /dev/null +++ b/src/openonyx/features/player/internal/internal/BridgeAction.java @@ -0,0 +1,5 @@ +package openonyx.features.player.internal.internal; + +public record BridgeAction(boolean jump, int sneakTime, boolean stopInput, boolean stepBack) { + public static final BridgeAction INSTANCE = new BridgeAction(false, 0, false, false); +} diff --git a/src/openonyx/features/player/internal/internal/BridgeActionResolver.java b/src/openonyx/features/player/internal/internal/BridgeActionResolver.java new file mode 100644 index 0000000..493b090 --- /dev/null +++ b/src/openonyx/features/player/internal/internal/BridgeActionResolver.java @@ -0,0 +1,28 @@ +package openonyx.features.player.internal.internal; + +import openonyx.core.MinecraftAccess; +import openonyx.features.player.Scaffold; +import openonyx.interaction.internal.PlacementResult; +import openonyx.protocol.group_m.Angles; +import openonyx.utilities.PlayerUtils; + +public class BridgeActionResolver implements MinecraftAccess { + public static BridgeAction L(PlacementResult placementResult, Angles angles, BridgeTechnique bridgeTechnique) { + PlacementResult placementResult1 = placementResult; + if (PlayerUtils.d(mc.thePlayer)) { + int i = ScaffoldClutch.INSTANCE.isEnabled() ? ScaffoldClutch.INSTANCE.L(angles) : Scaffold.INSTANCE.scaffoldRotationSettings.L(angles); + boolean bl = Scaffold.INSTANCE.L() <= 0; + boolean bl1 = i >= 1; + if (bl || bl1) { + return new BridgeAction(false, Math.max(1, i), false, false); + } + } + + if (bridgeTechnique == null) { + return BridgeAction.INSTANCE; + } + + BridgeAction bridgeAction; + return (bridgeAction = bridgeTechnique.L(placementResult1, angles)) != null ? bridgeAction : BridgeAction.INSTANCE; + } +} diff --git a/src/openonyx/features/player/internal/internal/BridgeTechnique.java b/src/openonyx/features/player/internal/internal/BridgeTechnique.java new file mode 100644 index 0000000..2d95d20 --- /dev/null +++ b/src/openonyx/features/player/internal/internal/BridgeTechnique.java @@ -0,0 +1,9 @@ +package openonyx.features.player.internal.internal; + +import openonyx.interaction.internal.PlacementResult; +import openonyx.protocol.group_m.Angles; + +@FunctionalInterface +public interface BridgeTechnique { + BridgeAction L(PlacementResult placementResult, Angles angles); +} diff --git a/src/openonyx/features/player/internal/internal/ScaffoldAcceleration.java b/src/openonyx/features/player/internal/internal/ScaffoldAcceleration.java new file mode 100644 index 0000000..7863d38 --- /dev/null +++ b/src/openonyx/features/player/internal/internal/ScaffoldAcceleration.java @@ -0,0 +1,33 @@ +package openonyx.features.player.internal.internal; + +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.Entity; +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 ScaffoldAcceleration extends SettingSection implements MinecraftAccess { + public NumberSetting speedMultiplier = new NumberSetting("Speed multiplier", 0.6, 0.1, 3.0, 0.01); + public BooleanSetting onlyOnGround = new BooleanSetting("Only on ground", false); + public static final ScaffoldAcceleration INSTANCE = new ScaffoldAcceleration(); + + @EventHandler + private void onPreTick(PreTickEvent preTickEvent) { + if (mc.thePlayer != null) { + if (!this.onlyOnGround.getValue() || mc.thePlayer.onGround) { + double d = this.speedMultiplier.getFloat(); + PlayerUtils.L(mc.thePlayer, VecUtils.d(PlayerUtils.L((Entity)mc.thePlayer), d, 1.0, d)); + } + } + } + + private ScaffoldAcceleration() { + super("Acceleration", false); + this.visibleWhen(Setting.BOOLEAN_SUPPLIER); + } +} diff --git a/src/openonyx/features/player/internal/internal/ScaffoldAutoBlock.java b/src/openonyx/features/player/internal/internal/ScaffoldAutoBlock.java new file mode 100644 index 0000000..3dbe15f --- /dev/null +++ b/src/openonyx/features/player/internal/internal/ScaffoldAutoBlock.java @@ -0,0 +1,21 @@ +package openonyx.features.player.internal.internal; + +import openonyx.history.SettingSection; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.NumberSetting; + +public class ScaffoldAutoBlock extends SettingSection { + public static final ScaffoldAutoBlock INSTANCE = new ScaffoldAutoBlock(); + public NumberSetting doNotUseBelowCount; + public BooleanSetting alwaysHoldBlock = new BooleanSetting("Always hold block", false) + .describe("Keeps the block slot held server-side the whole time instead of swapping to it only on the tick a block goes out"); + public NumberSetting slotResetDelay = new NumberSetting("Slot reset delay", 5.0, 0.0, 40.0, 1.0) + .withSuffix(" ticks") + .describe("How long the silent slot is held after a placement before the real slot comes back"); + + private ScaffoldAutoBlock() { + super("Auto block", true); + this.doNotUseBelowCount = new NumberSetting("Do not use below count", 1.0, 0.0, 64.0, 1.0) + .describe("Leaves a stack alone once it is down to this many blocks"); + } +}