add nomixin efly mode

This commit is contained in:
Daniella / Tove 2024-05-26 00:02:35 +02:00
parent 590372176d
commit b3b913c617

View file

@ -12,9 +12,13 @@ import com.baseband.client.util.misc.Marker;
import com.baseband.client.util.ingame.MotionUtil;
import de.tudbut.tools.Lock;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketPlayer;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
@Movement
public class ElytraFly extends Feature {
@ -24,6 +28,9 @@ public class ElytraFly extends Feature {
Packet,
}
@Config("NoMixin")
public boolean noMixin = false;
@Config("Sounds")
public boolean sounds;
@ -95,6 +102,38 @@ public class ElytraFly extends Feature {
takeoff.unlock();
init = true;
wasOnGround = false;
if(noMixin) {
if (mc.player == mc.getRenderViewEntity()) {
Vec2f movementVec = player.movementInput.getMoveVector();
float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F);
float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F);
double x = movementVec.x * f2 - movementVec.y * f1;
double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0);
double z = movementVec.y * f2 + movementVec.x * f1;
float d = (float) Math.sqrt(x * x + y * y + z * z);
if (d < 1) {
d = 1;
}
/*if(mode == Mode.BOOST && player.rotationPitch > 0) {
player.motionX += x * speed() / 40;
player.motionZ += z * speed() / 40;
}*/
//if(mode == Mode.CONTROL) {
player.motionX = x / d * hSpeed / 10;
//if(!strictMode || y < 0)
player.motionY = y / d * vSpeed / 10;
//else
//player.motionY = 0;
player.motionZ = z / d * vSpeed / 10;
//}
}
//if(mode == Mode.CONTROL)
negateElytraFallMomentum(player);
}
}
else if(autoTakeoff) {
lastTakeoffTry++;
@ -153,6 +192,8 @@ public class ElytraFly extends Feature {
}
public void move(MoveEvent e) {
if(noMixin)
return;
if (mc.player.isElytraFlying()) {
double motionY = 0;
double[] motionXZ = MotionUtil.getMotion((double) hSpeed / 10);
@ -181,4 +222,17 @@ public class ElytraFly extends Feature {
//Prevent annoying bow behaviour and/or falling sounds when looking down
}
}
public void negateElytraFallMomentum(EntityPlayer player) {
if (!player.isInWater()) {
if (!player.isInLava()) {
Vec3d vec3d = player.getLookVec();
float f = player.rotationPitch * 0.017453292F;
double d = vec3d.length();
float f1 = MathHelper.cos(f);
f1 = (float) ((double) f1 * (double) f1 * Math.min(1.0D, d / 0.4D));
player.motionY -= -0.08D + (double) f1 * 0.06D;
}
}
}
}