package yee;
import org.lwjgl.opengl.GL11;
import ml.teamreliant.reliant.Client;
import ml.teamreliant.reliant.event.Event;
import ml.teamreliant.reliant.event.EventTarget;
import ml.teamreliant.reliant.event.events.Render3DEvent;
import ml.teamreliant.reliant.event.events.UpdateEvent;
import ml.teamreliant.reliant.module.Module;
import ml.teamreliant.reliant.module.ModuleManager;
import ml.teamreliant.reliant.module.Module.Mod;
import ml.teamreliant.reliant.option.Option;
import ml.teamreliant.reliant.option.Option.Op;
import ml.teamreliant.reliant.utils.RenderUtils;
import ml.teamreliant.reliant.utils.RotationUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBow;
@Mod
public class BowAimbot extends Module{
protected Minecraft mc = Minecraft.getMinecraft();
@Option.Op (min = 90.0, max = 360.0, increment = 1.0)
public double angle;
@Op
public boolean lockView;
private EntityLivingBase target;
private float velocity;
private int state;
private float r;
private float g;
private float b;
private static float[] rainbowArray;
public BowAimbot() {
this.angle = 90.0;
this.lockView = false;
this.r = 0.33f;
this.g = 0.34f;
this.b = 0.33f;
}
@EventTarget
private void onPreUpdate(final UpdateEvent event) {
if (event.state == Event.State.PRE) {
if (this.mc.thePlayer.rotationPitch <= -80.0f || this.mc.thePlayer.getCurrentEquippedItem() == null || !(this.mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemBow)) {
this.target = null;
return;
}
this.loadEntity();
int bowCurrentCharge = this.mc.thePlayer.getItemInUseDuration();
if (ModuleManager.getModule(FastBow.class).enabled) {
bowCurrentCharge = (int) FastBow.speed;
}
this.velocity = bowCurrentCharge / 20.0f;
this.velocity = (this.velocity * this.velocity + this.velocity * 2.0f) / 3.0f;
if (this.velocity < 0.1) {
return;
}
if (this.velocity > 1.0f) {
this.velocity = 1.0f;
}
final double distanceToEnt = this.mc.thePlayer.getDistanceToEntity(this.target);
final double predictX = this.target.posX + (this.target.posX - this.target.lastTickPosX) * (distanceToEnt / this.getVelocity() + this.getPingMoveTicks(this.target));
final double predictZ = this.target.posZ + (this.target.posZ - this.target.lastTickPosZ) * (distanceToEnt / this.getVelocity() + this.getPingMoveTicks(this.target));
final double x = predictX - this.mc.thePlayer.posX;
final double z = predictZ - this.mc.thePlayer.posZ;
final double h = this.target.posY + this.target.getEyeHeight() - (this.mc.thePlayer.posY + 0.9 + this.mc.thePlayer.getEyeHeight());
final double h2 = Math.sqrt(x * x + z * z);
final double h3 = Math.sqrt(h2 * h2 + h * h);
final float yaw = (float)(Math.atan2(z, x) * 180.0 / 3.141592653589793) - 90.0f;
final float pitch = -RotationUtils.getTrajAngleSolutionLow((float)h2, (float)h, this.velocity);
event.yaw = yaw;
event.pitch = pitch;
if (this.lockView) {
this.mc.thePlayer.rotationYaw = yaw;
this.mc.thePlayer.rotationPitch = pitch;
}
}
}
@EventTarget
private void onRender(final Render3DEvent event) {
if (this.velocity < 0.1) {
return;
}
int color = -1;
int thingyt = 1184432128;
GL11.glColor4f(this.rainbowArray[0], this.rainbowArray[1], this.rainbowArray[2], 1.0f);
RenderUtils.drawEsp(this.target, event.getPartialTicks(), color, thingyt);
}
private float[] getRainbow() {
if (this.state == 0) {
this.r += 0.02;
this.b -= 0.02;
if (this.r >= 0.85) {
++this.state;
}
}
else if (this.state == 1) {
this.g += 0.02;
this.r -= 0.02;
if (this.g >= 0.85) {
++this.state;
}
}
else {
this.b += 0.02;
this.g -= 0.02;
if (this.b >= 0.85) {
this.state = 0;
}
}
return new float[] { this.r, this.g, this.b };
}
private void loadEntity() {
EntityLivingBase loadEntity = null;
double distance = 2.147483647E9;
for (final Object o : this.mc.theWorld.loadedEntityList) {
if (o instanceof Entity) {
final Entity e = (Entity)o;
if (e instanceof EntityLivingBase && e != this.mc.thePlayer && e.isEntityAlive() && e.getDistanceToEntity(this.mc.thePlayer) >= 1.5) {
if (!(e instanceof EntityOtherPlayerMP) && !this.mc.thePlayer.canEntityBeSeen(e)) {
continue;
}
final double x = e.posX - this.mc.thePlayer.posX;
final double z = e.posZ - this.mc.thePlayer.posZ;
final double h = this.mc.thePlayer.posY + this.mc.thePlayer.getEyeHeight() - (e.posY + e.getEyeHeight());
final double h2 = Math.sqrt(x * x + z * z);
final float yaw = (float)(Math.atan2(z, x) * 180.0 / 3.141592653589793) - 90.0f;
final float pitch = (float)(Math.atan2(h, h2) * 180.0 / 3.141592653589793);
final double xDist = RotationUtils.getDistanceBetweenAngles(yaw, this.mc.thePlayer.rotationYaw % 360.0f);
final double yDist = RotationUtils.getDistanceBetweenAngles(pitch, this.mc.thePlayer.rotationPitch % 360.0f);
final double dist = Math.sqrt(xDist * xDist + yDist * yDist);
if (dist > this.angle) {
continue;
}
if (dist >= distance) {
continue;
}
loadEntity = (EntityLivingBase)e;
distance = dist;
}
}
this.target = loadEntity;
}
}
private float getVelocity() {
final float vel = this.velocity;
return vel * 2.0f;
}
private double getPingMoveTicks(EntityLivingBase e)
{
if ((e instanceof EntityOtherPlayerMP))
{
EntityOtherPlayerMP player = (EntityOtherPlayerMP)e;
return Client.netUtils.getPlayerPing(player.getCommandSenderName()) / 20;
}
return 0.0D;
}
}
nimm die rotations vom bow und hab spaß