Upload files to "src/openonyx/features/player/internal/group_m"
This commit is contained in:
1 parent
5e035a3cee
commit
2e5a4f4611
5 files changed
+1217
No files matched your search
@@ -0,0 +1,205 @@
|
||||
package openonyx.features.player.internal.group_m;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import openonyx.features.player.Scaffold;
|
||||
import openonyx.features.player.internal.internal.BridgeAction;
|
||||
import openonyx.features.player.internal.internal.BridgeTechnique;
|
||||
import openonyx.history.internal.MultiSelectSetting;
|
||||
import openonyx.history.internal.NumberSetting;
|
||||
import openonyx.history.internal.RangeSetting;
|
||||
import openonyx.interaction.BlockUtils;
|
||||
import openonyx.interaction.internal.AimPointOption;
|
||||
import openonyx.interaction.internal.BlockPlacementContext;
|
||||
import openonyx.interaction.internal.CenterAimPoint;
|
||||
import openonyx.interaction.internal.EyePosition;
|
||||
import openonyx.interaction.internal.PlacementOffset;
|
||||
import openonyx.interaction.internal.PlacementResult;
|
||||
import openonyx.interaction.internal.PlacementSearchPattern;
|
||||
import openonyx.interaction.internal.PlacementSolver;
|
||||
import openonyx.movement.MovementPredictor;
|
||||
import openonyx.movement.SimulatedTickState;
|
||||
import openonyx.protocol.group_m.Angles;
|
||||
import openonyx.utilities.MovementInputState;
|
||||
import openonyx.utilities.PlayerUtils;
|
||||
import openonyx.utilities.RayTraceMode;
|
||||
import openonyx.utilities.RayTraceUtils;
|
||||
import openonyx.utilities.VecUtils;
|
||||
import openonyx.utilities.internal.Line3;
|
||||
|
||||
public class ScaffoldGodBridge extends ScaffoldMode implements BridgeTechnique {
|
||||
public MultiSelectSetting<ModesMode> modes;
|
||||
private static final float h = (float) (Math.PI / 180.0);
|
||||
private static final double l = 0.08;
|
||||
private static final double I = 0.42F;
|
||||
private static final double d = 0.98;
|
||||
public static final ScaffoldGodBridge INSTANCE = new ScaffoldGodBridge();
|
||||
private transient boolean f;
|
||||
public NumberSetting forceSneakBelowCount;
|
||||
public RangeSetting ticks;
|
||||
|
||||
private BridgeAction L(ModesMode modesMode) {
|
||||
switch (modesMode) {
|
||||
case JUMP:
|
||||
return new BridgeAction(true, 0, false, false);
|
||||
case SNEAK:
|
||||
return new BridgeAction(false, this.ticks.randomInt(), false, false);
|
||||
case BACKWARDS:
|
||||
return new BridgeAction(false, 0, true, false);
|
||||
case STOP_INPUT:
|
||||
return new BridgeAction(false, 0, false, true);
|
||||
default:
|
||||
throw new MatchException(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private ScaffoldGodBridge() {
|
||||
super("GodBridge");
|
||||
ModesMode[] modesModes = new ModesMode[1];
|
||||
boolean bl = true;
|
||||
modesModes[0] = ModesMode.JUMP;
|
||||
this.modes = new MultiSelectSetting<>("Modes", ModesMode.class, modesModes).allowEmpty(false);
|
||||
this.forceSneakBelowCount = new NumberSetting("Force sneak below count", 3.0, 0.0, 10.0, 1.0);
|
||||
this.ticks = RangeSetting.ofInt("Sneak time", 1, 1, 1, 10).withSuffix(" ticks");
|
||||
}
|
||||
|
||||
private Angles d(PlacementResult placementResult) {
|
||||
float fx = (float)(Math.floor(placementResult.rotation().yaw2() / 90.0F) * 90.0);
|
||||
return new Angles(fx + 45.0F, 75.0F);
|
||||
}
|
||||
|
||||
private double L() {
|
||||
double dx = 0.42F;
|
||||
if (mc.thePlayer.isPotionActive(Potion.jump)) {
|
||||
dx += (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
|
||||
}
|
||||
|
||||
return dx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Angles L(PlacementResult placementResult) {
|
||||
if (Scaffold.INSTANCE.getMovementInputState().equals(MovementInputState.INSTANCE8)) {
|
||||
return placementResult == null ? null : this.d(placementResult);
|
||||
}
|
||||
|
||||
float fx;
|
||||
boolean bl = (fx = (float)(Math.rint((PlayerUtils.L(mc.thePlayer, Scaffold.INSTANCE.getMovementInputState()) + 180.0F) / 45.0F) * 45.0)) % 90.0F == 0.0F;
|
||||
return bl ? this.L(fx) : this.d(fx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementResult L(Vec3 vec3, boolean bl, Line3 line3, ItemStack itemStack) {
|
||||
BlockPlacementContext blockPlacementContext = new BlockPlacementContext(
|
||||
new PlacementSearchPattern(PlacementOffset.NORMAL.getBlockPosList(), BlockPlacementContext.L(vec3)),
|
||||
new AimPointOption(CenterAimPoint.INSTANCE),
|
||||
itemStack,
|
||||
new EyePosition(vec3, bl)
|
||||
);
|
||||
return PlacementSolver.L(Scaffold.INSTANCE.L(VecUtils.L(vec3)), blockPlacementContext);
|
||||
}
|
||||
|
||||
private boolean l() {
|
||||
double dx = this.L();
|
||||
double e = 0.0;
|
||||
|
||||
for (double fx = dx; fx > 0.0; fx = dx = (dx - 0.08) * 0.98) {
|
||||
e += dx;
|
||||
}
|
||||
|
||||
return e >= 2.0;
|
||||
}
|
||||
|
||||
private Angles d(float f) {
|
||||
return new Angles(fx, 75.6F);
|
||||
}
|
||||
|
||||
private Angles L(float f) {
|
||||
ScaffoldGodBridge scaffoldGodBridge1 = this;
|
||||
if (mc.thePlayer.onGround) {
|
||||
scaffoldGodBridge1.f = Math.floor(mc.thePlayer.posX + (float)Math.cos(fx * (float) (Math.PI / 180.0)) * 0.5) != Math.floor(mc.thePlayer.posX)
|
||||
|| Math.floor(mc.thePlayer.posZ + (float)Math.sin(fx * (float) (Math.PI / 180.0)) * 0.5) != Math.floor(mc.thePlayer.posZ);
|
||||
EnumFacing enumFacing = EnumFacing.fromAngle(fx);
|
||||
BlockPos blockPos = VecUtils.L(
|
||||
PlayerUtils.D((Entity)mc.thePlayer)
|
||||
.addVector(enumFacing.getFrontOffsetX() * 0.6, enumFacing.getFrontOffsetY() * 0.6, enumFacing.getFrontOffsetZ() * 0.6)
|
||||
);
|
||||
boolean bl = L(new BlockPos(mc.thePlayer).add(0, -1, 0));
|
||||
boolean bl1 = L(blockPos.add(0, -1, 0));
|
||||
if (bl && bl1) {
|
||||
scaffoldGodBridge1.f = !scaffoldGodBridge1.f;
|
||||
}
|
||||
}
|
||||
|
||||
return new Angles(fx + (scaffoldGodBridge1.f ? 45 : -45), 75.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BridgeAction L(PlacementResult placementResult, Angles angles) {
|
||||
ScaffoldGodBridge scaffoldGodBridge1 = this;
|
||||
if (!scaffoldGodBridge1.isSelected()) {
|
||||
return BridgeAction.INSTANCE;
|
||||
}
|
||||
|
||||
SimulatedTickState simulatedTickState;
|
||||
if (!(simulatedTickState = MovementPredictor.INSTANCE.L().L(1)).clipLedged()) {
|
||||
return BridgeAction.INSTANCE;
|
||||
}
|
||||
|
||||
Vec3 vec3 = simulatedTickState.pos().add(0.0, mc.thePlayer.getEyeHeight(), 0.0);
|
||||
MovingObjectPosition movingObjectPosition = RayTraceUtils.L(RayTraceUtils.L(), RayTraceMode.OUTLINE, false, vec3, angles.L());
|
||||
if (placementResult == null) {
|
||||
return BridgeAction.INSTANCE;
|
||||
}
|
||||
|
||||
boolean bl = placementResult.L(movingObjectPosition);
|
||||
boolean bl1 = Scaffold.INSTANCE.L(movingObjectPosition);
|
||||
if (bl && bl1) {
|
||||
return BridgeAction.INSTANCE;
|
||||
}
|
||||
|
||||
ModesMode modesMode1 = Scaffold.INSTANCE.L() < scaffoldGodBridge1.forceSneakBelowCount.getInt()
|
||||
? ModesMode.SNEAK
|
||||
: L(scaffoldGodBridge1.modes.getValue());
|
||||
ModesMode modesMode2;
|
||||
ScaffoldGodBridge scaffoldGodBridge2;
|
||||
if (modesMode1 == ModesMode.JUMP && scaffoldGodBridge1.l()) {
|
||||
EnumSet enumSet;
|
||||
(enumSet = EnumSet.copyOf(scaffoldGodBridge1.modes.getValue())).remove(ModesMode.JUMP);
|
||||
ModesMode modesMode = L(enumSet);
|
||||
modesMode2 = modesMode != null ? modesMode : ModesMode.SNEAK;
|
||||
scaffoldGodBridge2 = scaffoldGodBridge1;
|
||||
} else {
|
||||
modesMode2 = modesMode1;
|
||||
scaffoldGodBridge2 = scaffoldGodBridge1;
|
||||
}
|
||||
|
||||
return scaffoldGodBridge2.L(modesMode2);
|
||||
}
|
||||
|
||||
private static boolean L(BlockPos blockPos) {
|
||||
BlockPos blockPos1 = blockPos;
|
||||
IBlockState iBlockState;
|
||||
return (iBlockState = BlockUtils.L(blockPos1)) == null || iBlockState.getBlock().getMaterial() == Material.air;
|
||||
}
|
||||
|
||||
private static ModesMode L(EnumSet<ModesMode> enumSet) {
|
||||
EnumSet enumSet1 = enumSet;
|
||||
if (enumSet1.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList arrayList = new ArrayList(enumSet1);
|
||||
return (ModesMode)arrayList.get(ThreadLocalRandom.current().nextInt(arrayList.size()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
package openonyx.features.player.internal.group_m;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import openonyx.configuration.internal.MovementInputEvent;
|
||||
import openonyx.configuration.internal.PostJumpEvent;
|
||||
import openonyx.configuration.internal.PreTickEvent;
|
||||
import openonyx.features.player.Scaffold;
|
||||
import openonyx.features.player.internal.ScaffoldRotationSettings;
|
||||
import openonyx.history.Setting;
|
||||
import openonyx.history.internal.BooleanSetting;
|
||||
import openonyx.history.internal.EnumSetting;
|
||||
import openonyx.history.internal.NumberSetting;
|
||||
import openonyx.interaction.internal.AimPointOption;
|
||||
import openonyx.interaction.internal.BlockPlacementContext;
|
||||
import openonyx.interaction.internal.CenterAimPoint;
|
||||
import openonyx.interaction.internal.EyePosition;
|
||||
import openonyx.interaction.internal.PlacementOffset;
|
||||
import openonyx.interaction.internal.PlacementResult;
|
||||
import openonyx.interaction.internal.PlacementSearchPattern;
|
||||
import openonyx.interaction.internal.PlacementSolver;
|
||||
import openonyx.protocol.RotationHandler;
|
||||
import openonyx.protocol.RotationRequest;
|
||||
import openonyx.protocol.group_m.Angles;
|
||||
import openonyx.protocol.internal.internal.RotationSmoother;
|
||||
import openonyx.utilities.MovementInputState;
|
||||
import openonyx.utilities.PlayerUtils;
|
||||
import openonyx.utilities.RayTraceUtils;
|
||||
import openonyx.utilities.VecUtils;
|
||||
import openonyx.utilities.internal.Line3;
|
||||
|
||||
public class ScaffoldHypixelKeepY extends ScaffoldMode {
|
||||
private static final float b = 99.0F;
|
||||
private transient boolean E;
|
||||
private transient boolean F;
|
||||
private transient int G;
|
||||
public BooleanSetting aimCheck;
|
||||
public NumberSetting diagonalJumpBlocks;
|
||||
public static final ScaffoldHypixelKeepY INSTANCE = new ScaffoldHypixelKeepY();
|
||||
private final transient RotationSmoother rotationSmoother;
|
||||
private static final float J = 84.0F;
|
||||
private transient int D;
|
||||
private transient int c;
|
||||
public NumberSetting diagonalAirDelay;
|
||||
public BooleanSetting keepYOnRightClick;
|
||||
private transient boolean g;
|
||||
public BooleanSetting strictAimCheck;
|
||||
private static final long L = 500L;
|
||||
private transient long j;
|
||||
private static final float m = 39.0F;
|
||||
public NumberSetting straightJumpBlocks;
|
||||
public NumberSetting idleAimSpeed;
|
||||
private transient float I;
|
||||
public NumberSetting straightAirDelay;
|
||||
private transient boolean i;
|
||||
public NumberSetting rotationOffset;
|
||||
private static final double H = 4.0;
|
||||
public EnumSetting<RotationStyle> rotationStyle = new EnumSetting<>("Rotation style", RotationStyle.DIAGONAL)
|
||||
.describe("Where the aim sits on the block face; falls back to Normal while moving diagonally")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
|
||||
@EventHandler
|
||||
private void onPostJump(PostJumpEvent postJumpEvent) {
|
||||
this.i = false;
|
||||
}
|
||||
|
||||
private Angles L() {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ);
|
||||
Angles angles = Angles.L(new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 1.0, blockPos.getZ() + 0.5), mc.thePlayer.getPositionEyes(1.0F));
|
||||
return scaffoldHypixelKeepY1.L(blockPos, EnumFacing.UP, angles, true);
|
||||
}
|
||||
|
||||
private int D() {
|
||||
return this.L(false) ? this.diagonalJumpBlocks.getInt() : this.straightJumpBlocks.getInt();
|
||||
}
|
||||
|
||||
private Angles L(BlockPos blockPos, EnumFacing enumFacing, Angles angles, boolean bl) {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
float f = angles.pitch2();
|
||||
float ix = scaffoldHypixelKeepY1.L();
|
||||
switch (scaffoldHypixelKeepY1.L()) {
|
||||
case NORMAL:
|
||||
while (false) {
|
||||
}
|
||||
|
||||
boolean bl2 = scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 135.0F, f) || scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix + 135.0F, f);
|
||||
boolean bl4 = scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 180.0F, f);
|
||||
float h;
|
||||
if (!bl && !bl2 && !bl4) {
|
||||
h = angles.yaw2();
|
||||
} else if (!bl && scaffoldHypixelKeepY1.L(true)) {
|
||||
h = bl4 ? ix - 180.0F : angles.yaw2();
|
||||
} else if (!bl && !bl2) {
|
||||
h = ix - 180.0F;
|
||||
} else {
|
||||
BlockPos blockPos1 = new BlockPos(Math.floor(mc.thePlayer.posX), Math.floor(mc.thePlayer.posY) - 1.0, Math.floor(mc.thePlayer.posZ));
|
||||
double d = blockPos1.getX() + 0.5 - mc.thePlayer.posX;
|
||||
if (MathHelper.wrapAngleTo180_float((float)(Math.toDegrees(Math.atan2(blockPos1.getZ() + 0.5 - mc.thePlayer.posZ, d)) - 90.0) - ix) > 0.0F) {
|
||||
h = ix + 135.0F;
|
||||
if (scaffoldHypixelKeepY1.strictAimCheck.getValue() && !scaffoldHypixelKeepY1.L(blockPos, enumFacing, h, f)) {
|
||||
h = ix - 135.0F;
|
||||
}
|
||||
} else {
|
||||
h = ix - 135.0F;
|
||||
if (scaffoldHypixelKeepY1.strictAimCheck.getValue() && !scaffoldHypixelKeepY1.L(blockPos, enumFacing, h, f)) {
|
||||
h = ix + 135.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Angles(h, f);
|
||||
case DIAGONAL:
|
||||
if (bl) {
|
||||
return new Angles(ix - 180.0F, f);
|
||||
}
|
||||
|
||||
boolean bl1 = scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 135.0F, f) || scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix + 135.0F, f);
|
||||
boolean bl3 = !scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 180.0F, f) && (scaffoldHypixelKeepY1.strictAimCheck.getValue() || !bl1);
|
||||
Angles angles2 = new Angles;
|
||||
float jx;
|
||||
float k;
|
||||
if (bl3) {
|
||||
jx = angles.yaw2();
|
||||
k = f;
|
||||
} else {
|
||||
jx = ix - 180.0F;
|
||||
k = f;
|
||||
}
|
||||
|
||||
angles2./* $VF: Unable to resugar constructor */<init>(jx, k);
|
||||
return angles2;
|
||||
case OFFSET:
|
||||
float gx = angles.yaw2();
|
||||
if (scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 180.0F, f)) {
|
||||
gx = ix - 180.0F;
|
||||
} else if (scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix - 135.0F, f)) {
|
||||
gx = ix - 135.0F;
|
||||
} else if (scaffoldHypixelKeepY1.L(blockPos, enumFacing, ix + 135.0F, f)) {
|
||||
gx = ix + 135.0F;
|
||||
}
|
||||
|
||||
return new Angles(gx, f);
|
||||
case BACK:
|
||||
Angles angles1 = Angles.L(scaffoldHypixelKeepY1.L(blockPos, enumFacing), mc.thePlayer.getPositionEyes(1.0F));
|
||||
if (scaffoldHypixelKeepY1.strictAimCheck.getValue() && !scaffoldHypixelKeepY1.L(blockPos, enumFacing, angles1.yaw2(), angles1.pitch2())) {
|
||||
return new Angles(angles.yaw2(), angles1.pitch2());
|
||||
}
|
||||
|
||||
return angles1;
|
||||
default:
|
||||
throw new MatchException(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean L(boolean bl) {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
float f;
|
||||
if ((f = scaffoldHypixelKeepY1.L() % 360.0F) < 0.0F) {
|
||||
f += 360.0F;
|
||||
}
|
||||
|
||||
float gx;
|
||||
return (gx = f % 90.0F) > (bl ? 10.0F : 20.0F) && gx < (bl ? 80.0F : 70.0F);
|
||||
}
|
||||
|
||||
private long L() {
|
||||
if (mc.getNetHandler() == null) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
NetworkPlayerInfo networkPlayerInfo;
|
||||
return (networkPlayerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID())) == null ? 0L : Math.max(0, networkPlayerInfo.getResponseTime());
|
||||
}
|
||||
|
||||
private ScaffoldHypixelKeepY() {
|
||||
super("HypixelKeepY");
|
||||
this.rotationOffset = new NumberSetting("Rotation offset", 0.15, 0.0, 1.0, 0.01)
|
||||
.describe("Shifts the aim point from the face centre towards the player")
|
||||
.visibleWhen(() -> this.rotationStyle.is(RotationStyle.OFFSET));
|
||||
this.aimCheck = new BooleanSetting("Aim check", true)
|
||||
.describe("Only place once the crosshair raytrace actually lands on the target block")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.strictAimCheck = new BooleanSetting("Strict aim check", true)
|
||||
.describe("Require the raytrace to hit the exact face, not just the block")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.straightJumpBlocks = new NumberSetting("Straight jump blocks", 0.0, 0.0, 3.0, 1.0)
|
||||
.describe("Blocks laid on the ground before jumping while bridging straight")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.diagonalJumpBlocks = new NumberSetting("Diagonal jump blocks", 0.0, 0.0, 3.0, 1.0)
|
||||
.describe("Blocks laid on the ground before jumping while bridging diagonally")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.straightAirDelay = new NumberSetting("Straight air delay", 1.0, 0.0, 4.0, 1.0)
|
||||
.withSuffix(" ticks")
|
||||
.describe("Ticks to wait after the target appears in the arc before placing (straight)")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.diagonalAirDelay = new NumberSetting("Diagonal air delay", 1.0, 0.0, 4.0, 1.0)
|
||||
.withSuffix(" ticks")
|
||||
.describe("Ticks to wait after the target appears in the arc before placing (diagonal)")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.keepYOnRightClick = new BooleanSetting("Keep Y on right click", false)
|
||||
.describe("Only pin the Y level while the use key is held")
|
||||
.visibleWhen(Setting.BOOLEAN_SUPPLIER);
|
||||
this.idleAimSpeed = new NumberSetting("Idle aim speed", 100.0, 1.0, 180.0, 1.0)
|
||||
.withSuffix("°/t")
|
||||
.describe("How fast the aim turns back under your feet once you stop placing");
|
||||
this.I = 99.0F;
|
||||
this.rotationSmoother = (rotationRequest, angles, angles1) -> angles.L(angles1, this.I, 39.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RotationRequest L(Angles angles, ScaffoldRotationSettings scaffoldRotationSettings, boolean bl) {
|
||||
RotationRequest rotationRequest = scaffoldRotationSettings.L(angles, bl);
|
||||
return new RotationRequest(
|
||||
angles, null, List.of(this.rotationSmoother), rotationRequest.L(), rotationRequest.L(), bl, rotationRequest.getMovementFixMode(), null
|
||||
);
|
||||
}
|
||||
|
||||
public void h() {
|
||||
if (this.isSelected() && mc.thePlayer != null) {
|
||||
if (mc.thePlayer.onGround) {
|
||||
this.G++;
|
||||
} else {
|
||||
this.G = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementResult L(Vec3 vec3, boolean bl, Line3 line3, ItemStack itemStack) {
|
||||
BlockPos blockPos = VecUtils.L(vec3);
|
||||
BlockPos blockPos1;
|
||||
if (this.l()) {
|
||||
if (this.c > mc.thePlayer.posY - 1.0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
blockPos1 = new BlockPos(blockPos.getX(), this.c, blockPos.getZ());
|
||||
} else {
|
||||
blockPos1 = Scaffold.INSTANCE.L(blockPos);
|
||||
}
|
||||
|
||||
BlockPlacementContext blockPlacementContext = new BlockPlacementContext(
|
||||
new PlacementSearchPattern(PlacementOffset.NORMAL.getBlockPosList(), this.L(vec3, line3)),
|
||||
new AimPointOption(CenterAimPoint.INSTANCE),
|
||||
itemStack,
|
||||
new EyePosition(vec3, bl)
|
||||
);
|
||||
PlacementResult placementResult;
|
||||
if ((placementResult = PlacementSolver.L(blockPos1, blockPlacementContext)) != null && !this.i) {
|
||||
this.F = this.i = true;
|
||||
this.D = 0;
|
||||
}
|
||||
|
||||
return placementResult;
|
||||
}
|
||||
|
||||
@EventHandler(priority = 1000)
|
||||
private void onPreTick(PreTickEvent preTickEvent) {
|
||||
if (mc.thePlayer != null) {
|
||||
this.I();
|
||||
if (this.F) {
|
||||
this.D++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition L(PlacementResult placementResult, Angles angles) {
|
||||
if (placementResult == null) {
|
||||
return null;
|
||||
} else if (this.l() && this.D < this.d() && this.G >= this.D()) {
|
||||
return null;
|
||||
} else {
|
||||
this.F = false;
|
||||
this.j = System.currentTimeMillis();
|
||||
MovingObjectPosition movingObjectPosition;
|
||||
if ((movingObjectPosition = super.L(placementResult, angles)) != null && placementResult.L(movingObjectPosition)) {
|
||||
return movingObjectPosition;
|
||||
} else if (!this.aimCheck.getValue()) {
|
||||
return placementResult.L();
|
||||
} else {
|
||||
return !this.strictAimCheck.getValue()
|
||||
&& movingObjectPosition != null
|
||||
&& movingObjectPosition.typeOfHit == MovingObjectType.BLOCK
|
||||
&& movingObjectPosition.getBlockPos().equals(placementResult.interactedBlockPos())
|
||||
? placementResult.L()
|
||||
: null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vec3 L(BlockPos blockPos, EnumFacing enumFacing) {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
Vec3 vec31 = new Vec3(
|
||||
blockPos.getX() + 0.5 + enumFacing.getFrontOffsetX() * 0.5,
|
||||
blockPos.getY() + 0.5 + enumFacing.getFrontOffsetY() * 0.5,
|
||||
blockPos.getZ() + 0.5 + enumFacing.getFrontOffsetZ() * 0.5
|
||||
);
|
||||
Vec3 vec3 = mc.thePlayer.getPositionEyes(1.0F);
|
||||
double d = enumFacing.getFrontOffsetX() != 0 ? vec31.xCoord : MathHelper.clamp_double(vec3.xCoord, blockPos.getX(), blockPos.getX() + 1.0);
|
||||
double e = enumFacing.getFrontOffsetY() != 0 ? vec31.yCoord : MathHelper.clamp_double(vec3.yCoord, blockPos.getY(), blockPos.getY() + 1.0);
|
||||
double f = enumFacing.getFrontOffsetZ() != 0 ? vec31.zCoord : MathHelper.clamp_double(vec3.zCoord, blockPos.getZ(), blockPos.getZ() + 1.0);
|
||||
double gx = scaffoldHypixelKeepY1.rotationOffset.getValue();
|
||||
return new Vec3(vec31.xCoord + (d - vec31.xCoord) * gx, vec31.yCoord + (e - vec31.yCoord) * gx, vec31.zCoord + (f - vec31.zCoord) * gx);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void D() {
|
||||
if (mc.thePlayer != null) {
|
||||
this.c = MathHelper.floor_double(mc.thePlayer.posY) - 1;
|
||||
this.g = false;
|
||||
this.G = 0;
|
||||
this.i = false;
|
||||
this.F = !mc.thePlayer.onGround;
|
||||
this.D = this.F ? -1 : 0;
|
||||
this.E = false;
|
||||
this.j = System.currentTimeMillis() - 600L;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onMovementInput(MovementInputEvent movementInputEvent) {
|
||||
if (mc.thePlayer != null && mc.currentScreen == null) {
|
||||
if (this.l()) {
|
||||
if (movementInputEvent.getMovementInputState().i()) {
|
||||
if (mc.thePlayer.onGround) {
|
||||
if (Scaffold.INSTANCE.L() > 0) {
|
||||
if (this.G >= this.D()) {
|
||||
movementInputEvent.L(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean l() {
|
||||
return mc.thePlayer.isPotionActive(Potion.jump) ? false : !this.keepYOnRightClick.getValue() || mc.gameSettings.keyBindUseItem.isKeyDown();
|
||||
}
|
||||
|
||||
private boolean L(BlockPos blockPos, EnumFacing enumFacing, float f, float g) {
|
||||
MovingObjectPosition movingObjectPosition;
|
||||
if ((movingObjectPosition = RayTraceUtils.L(new Angles(f, gx), 4.0)) != null && movingObjectPosition.typeOfHit == MovingObjectType.BLOCK) {
|
||||
return !movingObjectPosition.getBlockPos().equals(blockPos) ? false : !this.strictAimCheck.getValue() || movingObjectPosition.sideHit == enumFacing;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private RotationStyle L() {
|
||||
return this.L(false) ? RotationStyle.NORMAL : this.rotationStyle.getValue();
|
||||
}
|
||||
|
||||
private int d() {
|
||||
return this.L(false) ? this.diagonalAirDelay.getInt() : this.straightAirDelay.getInt();
|
||||
}
|
||||
|
||||
private float L() {
|
||||
MovementInputState movementInputState;
|
||||
return (movementInputState = Scaffold.INSTANCE.getMovementInputState()) != null && movementInputState.i()
|
||||
? PlayerUtils.L(mc.thePlayer, movementInputState)
|
||||
: mc.thePlayer.rotationYaw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Angles L(PlacementResult placementResult) {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
if (mc.thePlayer == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mc.thePlayer.onGround) {
|
||||
scaffoldHypixelKeepY1.E = false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - scaffoldHypixelKeepY1.j > scaffoldHypixelKeepY1.L() + 500L && Scaffold.INSTANCE.L() > 0) {
|
||||
scaffoldHypixelKeepY1.I = scaffoldHypixelKeepY1.idleAimSpeed.getFloat();
|
||||
return scaffoldHypixelKeepY1.L();
|
||||
}
|
||||
|
||||
if (placementResult == null) {
|
||||
return RotationHandler.INSTANCE.getAngles3();
|
||||
}
|
||||
|
||||
boolean bl = scaffoldHypixelKeepY1.l();
|
||||
boolean bl1;
|
||||
if (scaffoldHypixelKeepY1.E) {
|
||||
bl1 = bl;
|
||||
scaffoldHypixelKeepY1.I = 39.0F;
|
||||
} else if (bl) {
|
||||
scaffoldHypixelKeepY1.I = (float)ThreadLocalRandom.current().nextDouble(84.0, 99.0);
|
||||
bl1 = bl;
|
||||
} else {
|
||||
scaffoldHypixelKeepY1.I = scaffoldHypixelKeepY1.idleAimSpeed.getFloat();
|
||||
bl1 = bl;
|
||||
}
|
||||
|
||||
if (bl1 && !mc.thePlayer.onGround) {
|
||||
scaffoldHypixelKeepY1.E = true;
|
||||
}
|
||||
|
||||
return scaffoldHypixelKeepY1.L(placementResult.interactedBlockPos(), placementResult.direction(), placementResult.rotation(), false);
|
||||
}
|
||||
|
||||
private void I() {
|
||||
ScaffoldHypixelKeepY scaffoldHypixelKeepY1 = this;
|
||||
int ix = MathHelper.floor_double(mc.thePlayer.posY) - 1;
|
||||
if (!scaffoldHypixelKeepY1.l()) {
|
||||
scaffoldHypixelKeepY1.c = ix;
|
||||
scaffoldHypixelKeepY1.g = false;
|
||||
} else if (mc.gameSettings.keyBindJump.isKeyDown()) {
|
||||
scaffoldHypixelKeepY1.c = ix;
|
||||
scaffoldHypixelKeepY1.g = true;
|
||||
} else {
|
||||
if (scaffoldHypixelKeepY1.g || mc.thePlayer.onGround) {
|
||||
scaffoldHypixelKeepY1.c = ix;
|
||||
scaffoldHypixelKeepY1.g = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,399 @@
|
||||
package openonyx.features.player.internal.group_m;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import openonyx.configuration.internal.JumpEvent;
|
||||
import openonyx.configuration.internal.MovementInputEvent;
|
||||
import openonyx.configuration.internal.StrafeEvent;
|
||||
import openonyx.configuration.internal.TickEndEvent;
|
||||
import openonyx.configuration.internal.TickEvent;
|
||||
import openonyx.features.player.Scaffold;
|
||||
import openonyx.interaction.BlockUtils;
|
||||
import openonyx.interaction.internal.PlacementResult;
|
||||
import openonyx.protocol.RotationHandler;
|
||||
import openonyx.protocol.group_d.RotationAngleMath;
|
||||
import openonyx.protocol.group_m.Angles;
|
||||
import openonyx.protocol.internal.MovementFixMode;
|
||||
import openonyx.utilities.MovementInputState;
|
||||
import openonyx.utilities.PlayerUtils;
|
||||
import openonyx.utilities.RayTraceMode;
|
||||
import openonyx.utilities.RayTraceUtils;
|
||||
import openonyx.utilities.internal.Line3;
|
||||
|
||||
public class ScaffoldHypixelSprint extends ScaffoldMode {
|
||||
private float A;
|
||||
private static final int K = 2;
|
||||
private boolean B;
|
||||
private static final double C = 4.5;
|
||||
private static final int J = 10;
|
||||
private float D;
|
||||
private static final float c = 90.0F;
|
||||
private static final float a = 200.0F;
|
||||
private static final List<MovementInputState> MOVEMENT_INPUT_STATES = List.of(
|
||||
MovementInputState.INSTANCE5,
|
||||
MovementInputState.INSTANCE,
|
||||
MovementInputState.INSTANCE3,
|
||||
MovementInputState.INSTANCE2,
|
||||
MovementInputState.INSTANCE6,
|
||||
MovementInputState.INSTANCE4,
|
||||
MovementInputState.INSTANCE9,
|
||||
MovementInputState.INSTANCE7
|
||||
);
|
||||
private boolean g;
|
||||
private static final float M = 83.0F;
|
||||
private int L;
|
||||
private static final float[] j = L(180.0F);
|
||||
private static final float m = 60.0F;
|
||||
private float h;
|
||||
private boolean l;
|
||||
public static final ScaffoldHypixelSprint INSTANCE = new ScaffoldHypixelSprint();
|
||||
private static final float[] d = L(90.0F);
|
||||
private static final float i = 45.0F;
|
||||
private static final int f = 3;
|
||||
private float H;
|
||||
private static final float e = 0.1F;
|
||||
|
||||
private float L() {
|
||||
float fx = mc.thePlayer.rotationYaw;
|
||||
boolean bl3 = mc.gameSettings.keyBindForward.isKeyDown();
|
||||
boolean bl2 = mc.gameSettings.keyBindBack.isKeyDown();
|
||||
boolean bl1 = mc.gameSettings.keyBindLeft.isKeyDown();
|
||||
boolean bl = mc.gameSettings.keyBindRight.isKeyDown();
|
||||
if (bl3 && !bl2) {
|
||||
if (bl1 && !bl) {
|
||||
float k;
|
||||
float q;
|
||||
return (q = (k = fx - 45.0F) % 360.0F) < 0.0F ? q + 360.0F : q;
|
||||
}
|
||||
|
||||
if (bl && !bl1) {
|
||||
float jx;
|
||||
float p;
|
||||
return (p = (jx = fx + 45.0F) % 360.0F) < 0.0F ? p + 360.0F : p;
|
||||
}
|
||||
} else if (bl2 && !bl3) {
|
||||
fx += 180.0F;
|
||||
if (bl1 && !bl) {
|
||||
float ix;
|
||||
float n;
|
||||
return (n = (ix = fx + 45.0F) % 360.0F) < 0.0F ? n + 360.0F : n;
|
||||
}
|
||||
|
||||
if (bl && !bl1) {
|
||||
float hx;
|
||||
float mx;
|
||||
return (mx = (hx = fx - 45.0F) % 360.0F) < 0.0F ? mx + 360.0F : mx;
|
||||
}
|
||||
} else {
|
||||
if (bl1 && !bl) {
|
||||
float gx;
|
||||
float lx;
|
||||
return (lx = (gx = fx - 90.0F) % 360.0F) < 0.0F ? lx + 360.0F : lx;
|
||||
}
|
||||
|
||||
if (bl && !bl1) {
|
||||
fx += 90.0F;
|
||||
}
|
||||
}
|
||||
|
||||
float o;
|
||||
return (o = fx % 360.0F) < 0.0F ? o + 360.0F : o;
|
||||
}
|
||||
|
||||
private ScaffoldHypixelSprint() {
|
||||
super("HypixelSprint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementResult L(Vec3 vec3, boolean bl, Line3 line3, ItemStack itemStack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private MovementInputState L(float f) {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
MovementInputState movementInputState = MovementInputState.INSTANCE5;
|
||||
float gx = Float.MAX_VALUE;
|
||||
|
||||
for (MovementInputState movementInputState1 : MOVEMENT_INPUT_STATES) {
|
||||
float hx;
|
||||
if ((hx = Math.abs(MathHelper.wrapAngleTo180_float(PlayerUtils.L(scaffoldHypixelSprint1.h, movementInputState1) - fx))) < gx) {
|
||||
gx = hx;
|
||||
movementInputState = movementInputState1;
|
||||
}
|
||||
}
|
||||
|
||||
return movementInputState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void D() {
|
||||
this.l = false;
|
||||
this.B = false;
|
||||
this.g = false;
|
||||
this.L = 0;
|
||||
if (mc.thePlayer != null) {
|
||||
this.h = mc.thePlayer.rotationYaw;
|
||||
this.D = 83.0F;
|
||||
this.H = this.L() - 180.0F;
|
||||
this.A = 83.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTickEnd(TickEndEvent tickEndEvent) {
|
||||
if (mc.thePlayer != null) {
|
||||
float fx = this.L() - 180.0F;
|
||||
mc.thePlayer.rotationYawHead = fx;
|
||||
mc.thePlayer.renderYawOffset = fx;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void d() {
|
||||
RotationHandler.INSTANCE.L((Angles)null);
|
||||
}
|
||||
|
||||
@EventHandler(priority = -500)
|
||||
private void onMovementInput(MovementInputEvent movementInputEvent) {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
MovementInputState movementInputState = movementInputEvent.getMovementInputState();
|
||||
if (L() == MovementFixMode.SILENT && movementInputState.i()) {
|
||||
float fx = PlayerUtils.L(mc.thePlayer.rotationYaw, movementInputState);
|
||||
movementInputEvent.L(scaffoldHypixelSprint1.L(fx));
|
||||
}
|
||||
}
|
||||
|
||||
private Angles L() {
|
||||
return new Angles(this.h, this.D, true);
|
||||
}
|
||||
|
||||
private MovingObjectPosition L(float f, float g) {
|
||||
Entity entity;
|
||||
Vec3 vec3 = (entity = mc.getRenderViewEntity()).getPositionEyes(1.0F);
|
||||
return RayTraceUtils.L(4.5, RayTraceMode.COLLIDER, false, vec3, Vec3.directionFromRotation(gx, fx), entity);
|
||||
}
|
||||
|
||||
private MovingObjectPosition L(BlockPos blockPos) {
|
||||
if (!BlockUtils.L(BlockUtils.d(blockPos), blockPos, null)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BlockPos blockPos2 = null;
|
||||
EnumFacing enumFacing = null;
|
||||
double dx = Double.MAX_VALUE;
|
||||
|
||||
int ix;
|
||||
int jx;
|
||||
for (int n = ix = -3; n <= 3; n = ++ix) {
|
||||
int k;
|
||||
for (int lx = jx = -2; lx <= 0; lx = ++jx) {
|
||||
for (int mx = k = -3; mx <= 3; mx = ++k) {
|
||||
BlockPos blockPos1;
|
||||
EnumFacing enumFacing1;
|
||||
double ex;
|
||||
if (!BlockUtils.d(blockPos1 = blockPos.add(ix, jx, k))
|
||||
&& (enumFacing1 = L(blockPos1, blockPos)) != EnumFacing.DOWN
|
||||
&& !((ex = mc.thePlayer.getDistanceSqToCenter(blockPos1)) >= dx)) {
|
||||
dx = ex;
|
||||
blockPos2 = blockPos1;
|
||||
enumFacing = enumFacing1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blockPos2 == null ? null : new MovingObjectPosition(Vec3.atCenterOf(blockPos2), enumFacing, blockPos2);
|
||||
}
|
||||
|
||||
@EventHandler(priority = -500)
|
||||
private void onJump(JumpEvent jumpEvent) {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
MovementFixMode movementFixMode;
|
||||
if ((movementFixMode = L()) == MovementFixMode.SILENT || movementFixMode == MovementFixMode.STRICT) {
|
||||
jumpEvent.d(scaffoldHypixelSprint1.h);
|
||||
}
|
||||
}
|
||||
|
||||
private static EnumFacing L(BlockPos blockPos, BlockPos blockPos1) {
|
||||
int k = blockPos1.getX() - blockPos.getX();
|
||||
int ix = blockPos1.getY() - blockPos.getY();
|
||||
int jx = blockPos1.getZ() - blockPos.getZ();
|
||||
if (Math.abs(k) >= Math.abs(ix) && Math.abs(k) >= Math.abs(jx)) {
|
||||
return k > 0 ? EnumFacing.EAST : EnumFacing.WEST;
|
||||
} else if (Math.abs(ix) < Math.abs(k) || Math.abs(ix) < Math.abs(jx)) {
|
||||
return jx > 0 ? EnumFacing.SOUTH : EnumFacing.NORTH;
|
||||
} else {
|
||||
return ix > 0 ? EnumFacing.UP : EnumFacing.DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
private Angles L(MovingObjectPosition movingObjectPosition) {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
float hx = scaffoldHypixelSprint1.L() + 90.0F;
|
||||
float[] n = j;
|
||||
int ix = j.length;
|
||||
|
||||
int jx;
|
||||
for (int r = jx = 0; r < ix; r = ++jx) {
|
||||
float fx = n[jx];
|
||||
float[] gx = d;
|
||||
int k = d.length;
|
||||
|
||||
int lx;
|
||||
for (int q = lx = 0; q < k; q = ++lx) {
|
||||
float o = gx[lx];
|
||||
float mx = hx + fx;
|
||||
float p = MathHelper.clamp_float(o, -90.0F, 90.0F);
|
||||
MovingObjectPosition movingObjectPosition1;
|
||||
if ((movingObjectPosition1 = scaffoldHypixelSprint1.L(mx, p)) != null
|
||||
&& movingObjectPosition1.typeOfHit == MovingObjectType.BLOCK
|
||||
&& movingObjectPosition1.getBlockPos().equals(movingObjectPosition.getBlockPos())
|
||||
&& movingObjectPosition1.sideHit == movingObjectPosition.sideHit) {
|
||||
return new Angles(mx, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void I() {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
if (!scaffoldHypixelSprint1.B) {
|
||||
scaffoldHypixelSprint1.B = true;
|
||||
float gx = (float)(200.0 - Math.random());
|
||||
scaffoldHypixelSprint1.h = scaffoldHypixelSprint1.h
|
||||
+ MathHelper.clamp_float(MathHelper.wrapAngleTo180_float(scaffoldHypixelSprint1.H - scaffoldHypixelSprint1.h), -gx, gx);
|
||||
float fx = mc.thePlayer.rotationYaw;
|
||||
scaffoldHypixelSprint1.h = mc.thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(scaffoldHypixelSprint1.h - fx);
|
||||
scaffoldHypixelSprint1.D = scaffoldHypixelSprint1.D
|
||||
+ MathHelper.clamp_float(MathHelper.wrapAngleTo180_float(scaffoldHypixelSprint1.A - scaffoldHypixelSprint1.D), -gx, gx);
|
||||
scaffoldHypixelSprint1.l = Math.abs(MathHelper.wrapAngleTo180_float(scaffoldHypixelSprint1.h - scaffoldHypixelSprint1.H)) <= 0.1F
|
||||
&& Math.abs(MathHelper.wrapAngleTo180_float(scaffoldHypixelSprint1.D - scaffoldHypixelSprint1.A)) <= 0.1F;
|
||||
}
|
||||
}
|
||||
|
||||
private void L(BlockPos blockPos) {
|
||||
MovingObjectPosition movingObjectPosition;
|
||||
if ((movingObjectPosition = this.L(blockPos)) != null) {
|
||||
Angles angles;
|
||||
if ((angles = this.L(movingObjectPosition)) == null) {
|
||||
this.l = false;
|
||||
this.B = true;
|
||||
} else {
|
||||
this.H = angles.yaw2();
|
||||
this.A = angles.pitch2();
|
||||
this.I();
|
||||
if (mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.onGround) {
|
||||
this.l = false;
|
||||
}
|
||||
|
||||
if (this.l) {
|
||||
if (this.L(movingObjectPosition.getBlockPos())) {
|
||||
BlockUtils.L(movingObjectPosition);
|
||||
mc.thePlayer.swingItem();
|
||||
}
|
||||
|
||||
this.L = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = 1000)
|
||||
private void onTick(TickEvent tickEvent) {
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint1 = this;
|
||||
if (mc.thePlayer != null && mc.theWorld != null && mc.playerController != null) {
|
||||
if (scaffoldHypixelSprint1.L > 0) {
|
||||
scaffoldHypixelSprint1.L--;
|
||||
}
|
||||
|
||||
scaffoldHypixelSprint1.B = false;
|
||||
boolean bl = Scaffold.INSTANCE.h();
|
||||
BlockPos blockPos = new BlockPos(mc.thePlayer).down();
|
||||
if (bl && BlockUtils.d(blockPos)) {
|
||||
scaffoldHypixelSprint1.L(blockPos);
|
||||
}
|
||||
|
||||
float gx;
|
||||
float fx = Math.abs(MathHelper.wrapAngleTo180_float((gx = scaffoldHypixelSprint1.L() + 45.0F) - scaffoldHypixelSprint1.h));
|
||||
int ix = 10 - (fx > 60.0F ? 2 : 1);
|
||||
if (scaffoldHypixelSprint1.L == ix && !mc.gameSettings.keyBindJump.isKeyDown() && scaffoldHypixelSprint1.g) {
|
||||
scaffoldHypixelSprint1.h = gx;
|
||||
}
|
||||
|
||||
if (mc.thePlayer.onGround && mc.gameSettings.keyBindJump.isKeyDown()) {
|
||||
scaffoldHypixelSprint1.h = scaffoldHypixelSprint1.L();
|
||||
}
|
||||
|
||||
ScaffoldHypixelSprint scaffoldHypixelSprint2;
|
||||
if (L() == MovementFixMode.CHANGE_LOOK) {
|
||||
RotationAngleMath.L(mc.thePlayer, scaffoldHypixelSprint1.L());
|
||||
RotationHandler.INSTANCE.L((Angles)null);
|
||||
scaffoldHypixelSprint2 = scaffoldHypixelSprint1;
|
||||
} else {
|
||||
RotationHandler.INSTANCE.L(scaffoldHypixelSprint1.L());
|
||||
scaffoldHypixelSprint2 = scaffoldHypixelSprint1;
|
||||
}
|
||||
|
||||
scaffoldHypixelSprint2.g = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean L(BlockPos blockPos) {
|
||||
double dx = mc.playerController.getBlockReachDistance();
|
||||
return mc.thePlayer.getPositionEyes(1.0F).squareDistanceTo(Vec3.atCenterOf(blockPos)) <= dx * dx;
|
||||
}
|
||||
|
||||
@EventHandler(priority = -500)
|
||||
private void onStrafe(StrafeEvent strafeEvent) {
|
||||
MovementFixMode movementFixMode;
|
||||
float fx = (movementFixMode = L()) != MovementFixMode.SILENT && movementFixMode != MovementFixMode.STRICT ? strafeEvent.d() : this.h;
|
||||
strafeEvent.L(PlayerUtils.L(strafeEvent.getVec32(), strafeEvent.L(), fx));
|
||||
}
|
||||
|
||||
private static float[] L(float f) {
|
||||
float gx = fx;
|
||||
ArrayList arrayList;
|
||||
(arrayList = new ArrayList()).add(0.0F);
|
||||
fx = 1.0F;
|
||||
|
||||
for (float n = fx; n <= 20.0F; n = ++fx) {
|
||||
arrayList.add(-fx);
|
||||
arrayList.add(fx);
|
||||
}
|
||||
|
||||
for (float jx = fx = 22.0F; jx <= gx; jx = fx) {
|
||||
arrayList.add(-fx);
|
||||
arrayList.add(fx);
|
||||
fx += 2.0F;
|
||||
}
|
||||
|
||||
float[] k = new float[arrayList.size()];
|
||||
boolean bl = true;
|
||||
float[] hx = k;
|
||||
|
||||
int ix;
|
||||
for (int lx = ix = 0; lx < hx.length; lx = ix) {
|
||||
int o = ix;
|
||||
float mx = (Float)arrayList.get(ix);
|
||||
ix++;
|
||||
hx[o] = mx;
|
||||
}
|
||||
|
||||
return hx;
|
||||
}
|
||||
|
||||
private static MovementFixMode L() {
|
||||
return Scaffold.INSTANCE.scaffoldRotationSettings.L();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package openonyx.features.player.internal.group_m;
|
||||
|
||||
import java.util.Comparator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.features.player.internal.ScaffoldRotationSettings;
|
||||
import openonyx.history.ModeOption;
|
||||
import openonyx.interaction.internal.BlockPlacementContext;
|
||||
import openonyx.interaction.internal.PlacementResult;
|
||||
import openonyx.protocol.RotationRequest;
|
||||
import openonyx.protocol.group_m.Angles;
|
||||
import openonyx.utilities.RayTraceUtils;
|
||||
import openonyx.utilities.internal.Line3;
|
||||
|
||||
public abstract class ScaffoldMode extends ModeOption implements MinecraftAccess {
|
||||
public abstract PlacementResult L(Vec3 vec3, boolean bl, Line3 line3, ItemStack itemStack);
|
||||
|
||||
protected Comparator<BlockPos> L(Vec3 vec3, Line3 line3) {
|
||||
return line3 != null ? BlockPlacementContext.L(line3) : BlockPlacementContext.L(vec3);
|
||||
}
|
||||
|
||||
public Angles L(PlacementResult placementResult) {
|
||||
return placementResult == null ? null : placementResult.rotation();
|
||||
}
|
||||
|
||||
public MovingObjectPosition L(PlacementResult placementResult, Angles angles) {
|
||||
return RayTraceUtils.L(angles);
|
||||
}
|
||||
|
||||
protected ScaffoldMode(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
public RotationRequest L(Angles angles, ScaffoldRotationSettings scaffoldRotationSettings, boolean bl) {
|
||||
return scaffoldRotationSettings.L(angles, bl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package openonyx.features.player.internal.group_m;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import openonyx.configuration.internal.PostJumpEvent;
|
||||
import openonyx.features.player.Scaffold;
|
||||
import openonyx.features.player.internal.group_m.internal.JumpAimMode;
|
||||
import openonyx.features.player.internal.group_m.internal.ScaffoldDown;
|
||||
import openonyx.features.player.internal.group_m.internal.ScaffoldSneak;
|
||||
import openonyx.features.player.internal.group_m.internal.ScaffoldStabilizer;
|
||||
import openonyx.features.player.internal.group_m.internal.ScaffoldTelly;
|
||||
import openonyx.history.internal.EnumSetting;
|
||||
import openonyx.interaction.internal.AimContext;
|
||||
import openonyx.interaction.internal.AimPointMode;
|
||||
import openonyx.interaction.internal.AimPointOption;
|
||||
import openonyx.interaction.internal.AimPointStrategy;
|
||||
import openonyx.interaction.internal.BlockPlacementContext;
|
||||
import openonyx.interaction.internal.CenterAimPoint;
|
||||
import openonyx.interaction.internal.EyePosition;
|
||||
import openonyx.interaction.internal.InteractionSupport_011;
|
||||
import openonyx.interaction.internal.InteractionSupport_016;
|
||||
import openonyx.interaction.internal.PlacementOffset;
|
||||
import openonyx.interaction.internal.PlacementResult;
|
||||
import openonyx.interaction.internal.PlacementSearchPattern;
|
||||
import openonyx.interaction.internal.PlacementSolver;
|
||||
import openonyx.interaction.internal.RandomAimPoint;
|
||||
import openonyx.interaction.internal.StabilizedAimPoint;
|
||||
import openonyx.protocol.group_m.Angles;
|
||||
import openonyx.utilities.PlayerUtils;
|
||||
import openonyx.utilities.VecUtils;
|
||||
import openonyx.utilities.internal.Line3;
|
||||
|
||||
public class ScaffoldNormal extends ScaffoldMode {
|
||||
public ScaffoldStabilizer scaffoldStabilizer;
|
||||
public ScaffoldSneak scaffoldSneak;
|
||||
public ScaffoldTelly scaffoldTelly;
|
||||
public EnumSetting<AimPointMode> rotationMode = new EnumSetting<>("Rotation mode", AimPointMode.STABILIZED);
|
||||
public static final ScaffoldNormal INSTANCE = new ScaffoldNormal();
|
||||
private transient double H;
|
||||
public ScaffoldDown scaffoldDown;
|
||||
|
||||
// $VF: Unable to simplify switch on enum
|
||||
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
|
||||
@Override
|
||||
public Angles L(PlacementResult placementResult) {
|
||||
if (ScaffoldTelly.INSTANCE.isEnabled() && ScaffoldTelly.INSTANCE.l()) {
|
||||
switch ((JumpAimMode)ScaffoldTelly.INSTANCE.jumpAim.getValue()) {
|
||||
case REVERSE:
|
||||
return new Angles(
|
||||
(float)(Math.rint(PlayerUtils.L((Entity)mc.thePlayer).yaw2() / 45.0F) * 45.0),
|
||||
mc.thePlayer.rotationPitch < 45.0F ? 45.0F : mc.thePlayer.rotationPitch
|
||||
);
|
||||
case RESET:
|
||||
while (false) {
|
||||
}
|
||||
|
||||
return null;
|
||||
default:
|
||||
throw new MatchException(null, null);
|
||||
}
|
||||
} else {
|
||||
return super.L(placementResult);
|
||||
}
|
||||
}
|
||||
|
||||
private AimPointStrategy L(Vec3 vec3, boolean bl, Line3 line3) {
|
||||
AimContext aimContext = new AimContext(vec3.add(0.0, EyePosition.L(bl), 0.0), this.H);
|
||||
switch ((AimPointMode)this.rotationMode.getValue()) {
|
||||
case CENTER:
|
||||
while (false) {
|
||||
}
|
||||
|
||||
return CenterAimPoint.INSTANCE;
|
||||
case RANDOM:
|
||||
return InteractionSupport_016.INSTANCE;
|
||||
case STABILIZED:
|
||||
return new InteractionSupport_011(aimContext, line3);
|
||||
case NEAREST_ROTATION:
|
||||
return new RandomAimPoint(aimContext);
|
||||
case EDGE_POINT:
|
||||
return new StabilizedAimPoint(aimContext);
|
||||
default:
|
||||
throw new MatchException(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition L(PlacementResult placementResult, Angles angles) {
|
||||
if (placementResult == null) {
|
||||
return null;
|
||||
} else {
|
||||
MovingObjectPosition movingObjectPosition;
|
||||
if ((movingObjectPosition = super.L(placementResult, angles)) != null && placementResult.L(movingObjectPosition)) {
|
||||
return movingObjectPosition;
|
||||
} else {
|
||||
return ScaffoldDown.h() ? placementResult.L() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = -50)
|
||||
private void onPostJump(PostJumpEvent postJumpEvent) {
|
||||
this.H = ThreadLocalRandom.current().nextDouble(-0.01, 0.01);
|
||||
}
|
||||
|
||||
private ScaffoldNormal() {
|
||||
super("Normal");
|
||||
this.scaffoldSneak = ScaffoldSneak.INSTANCE;
|
||||
this.scaffoldTelly = ScaffoldTelly.INSTANCE;
|
||||
this.scaffoldDown = ScaffoldDown.INSTANCE;
|
||||
this.scaffoldStabilizer = ScaffoldStabilizer.INSTANCE;
|
||||
this.H = ThreadLocalRandom.current().nextDouble(-0.02, 0.02);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementResult L(Vec3 vec3, boolean bl, Line3 line3, ItemStack itemStack) {
|
||||
Comparator comparator = this.L(vec3, line3);
|
||||
List list;
|
||||
ScaffoldNormal scaffoldNormal1;
|
||||
if (ScaffoldDown.h()) {
|
||||
list = PlacementOffset.DOWN.getBlockPosList();
|
||||
scaffoldNormal1 = this;
|
||||
} else {
|
||||
list = PlacementOffset.NORMAL.getBlockPosList();
|
||||
scaffoldNormal1 = this;
|
||||
}
|
||||
|
||||
AimPointStrategy aimPointStrategy = scaffoldNormal1.L(vec3, bl, line3);
|
||||
BlockPlacementContext blockPlacementContext = new BlockPlacementContext(
|
||||
new PlacementSearchPattern(list, comparator), new AimPointOption(aimPointStrategy, ScaffoldDown.h()), itemStack, new EyePosition(vec3, bl)
|
||||
);
|
||||
return PlacementSolver.L(Scaffold.INSTANCE.L(VecUtils.L(vec3)), blockPlacementContext);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user