[go: up one dir, main page]

0% found this document useful (0 votes)
14 views6 pages

Minecraft Combat Module

Uploaded by

dcnprb5gtr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Minecraft Combat Module

Uploaded by

dcnprb5gtr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

package me.aristhena.client.module.modules.

combat;

import java.awt.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import me.aristhena.client.friend.FriendManager;
import me.aristhena.client.gui.click.ClickGui;
import me.aristhena.client.module.Module;
import me.aristhena.client.module.Module.Mod;
import me.aristhena.client.module.modules.combat.aura.Dick22;
import me.aristhena.client.option.Option;
import me.aristhena.event.Event;
import me.aristhena.event.EventTarget;
import me.aristhena.event.events.Render2DEvent;
import me.aristhena.event.events.UpdateEvent;
import me.aristhena.utils.ClientUtils;
import me.aristhena.utils.MathUtils;
import me.aristhena.utils.RenderUtils;
import me.aristhena.utils.RotationUtils;
import me.aristhena.utils.Timer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.potion.Potion;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;

@Mod
public class TickAura extends Module
{
@Option.Op(name="§bRotations")
public static boolean Rotations;
@Option.Op(name="§bTargetInfo")
public static boolean TargetInfo;
private Timer timer;
@Option.Op(name = "§aPlayers")
private boolean players;
@Option.Op(name = "§aMonters")
private boolean mobs;
@Option.Op(name = "§aRange", min = 3.8, max = 10.0, increment = 0.1)
private double range;
private boolean block;
private boolean dura;
private boolean criticals;
@Option.Op(name = "§aChestpladeDura")
public static boolean angle;
private EntityLivingBase target;

public TickAura() {
super();
this.timer = new Timer();
this.players = true;
this.mobs = false;
this.range = 4.0;
this.block = true;
this.dura = true;
this.criticals = true;
}

@EventTarget
private void onRender(final Render2DEvent event) {

if (getClosest() != null && TargetInfo) {


EntityLivingBase target = getClosest();
Minecraft mc = Minecraft.getMinecraft();
double fark = MathUtils.roundToPlace(mc.thePlayer.getHealth()-
target.getHealth(),1);
String farkk = ""+(fark==0 ? "0":(fark<0 ? fark+"" : "+"+fark));
String text = target.getName()+""+farkk;
int y = event.getHeight()/4;

final ItemStack[] myitems = mc.thePlayer.getInventory();


final ItemStack[] targetitems = target.getInventory();
int chestplatedura = 0;
int chestplatedura2 = 0;
ItemStack mychestp = null;
ItemStack targetchestp = null;
if (myitems[2] != null) {
mychestp = myitems[2];
chestplatedura = mychestp.getMaxDamage() -
mychestp.getItemDamage();
}
if (targetitems[2] != null) {
targetchestp = targetitems[2];
chestplatedura2 = targetchestp.getMaxDamage() -
targetchestp.getItemDamage();
}
int chestfarki = chestplatedura - chestplatedura2;
String dura = (chestfarki==0 ? "0" : (chestfarki <0 ? ""+chestfarki :
"+"+chestfarki));

RenderUtils.rectangleBordered(event.getWidth()/3-5, y-5,
event.getWidth()/3+ClientUtils.clientFont().getStringWidth(text), y+33, 1, new
Color(0,0,0,150).getRGB(), Color.BLACK.getRGB());
ClientUtils.clientFont().drawStringWithShadow(target.getName(),
event.getWidth()/3, y, Color.LIGHT_GRAY.getRGB());
ClientUtils.clientFont().drawStringWithShadow("HP "+farkk,
event.getWidth()/3, y+10, (fark==0 ? Color.YELLOW.getRGB():(fark<0 ?
Color.RED.getRGB() : Color.GREEN.getRGB())));
ClientUtils.clientFont().drawStringWithShadow("CP "+dura,
event.getWidth()/3, y+20, (chestfarki==0 ? Color.YELLOW.getRGB() : (chestfarki <0 ?
Color.RED.getRGB() : Color.GREEN.getRGB())));
}
}

@EventTarget
private void onUpdate(final UpdateEvent e) {

if (e.getState() == Event.State.PRE) {

this.target = this.getClosest();
if (this.target != null) { if (this.target.auraTicks <= 10) {
this.target.auraTicks =20;
}
this.lowerTicks();
// if (this.block && ClientUtils.player().getHeldItem() != null &&
ClientUtils.player().getHeldItem().getItem() != null &&
ClientUtils.player().getHeldItem().getItem() instanceof ItemSword) {

ClientUtils.mc().playerController.sendUseItem(ClientUtils.player(),
ClientUtils.mc().theWorld, ClientUtils.player().getHeldItem());
// }
final float[] rots = RotationUtils.getRotations(this.target);
e.setYaw(rots[0]);
e.setPitch(rots[1]);
if (Rotations) {
Minecraft.getMinecraft().thePlayer.rotationYawHead = rots[0];
Minecraft.getMinecraft().thePlayer.renderYawOffset = rots[0];
}

if (target.auraTicks == 13) {

}
}
else if (e.getState() == Event.State.POST && this.target != null ) {
if (ClientUtils.player().isBlocking()) {
ClientUtils.player().sendQueue.addToSendQueue(new
C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,
BlockPos.ORIGIN, EnumFacing.DOWN));
}

if (target.auraTicks == 14) {

ClientUtils.packet(new C09PacketHeldItemChange(8));

// this.swap(9, ClientUtils.player().inventory.currentItem);

ClientUtils.packet(new C03PacketPlayer(true));
this.attack(this.target, false);
this.attack(this.target, true);
ClientUtils.packet(new C09PacketHeldItemChange(0));
// this.swap(9, ClientUtils.player().inventory.currentItem);
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));

}
if (target.auraTicks == 13) {

ClientUtils.packet(new C09PacketHeldItemChange(8));
// this.swap(9, ClientUtils.player().inventory.currentItem);

ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
ClientUtils.packet(new C09PacketHeldItemChange(0));
// this.swap(9, ClientUtils.player().inventory.currentItem);

ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target,
C02PacketUseEntity.Action.ATTACK));

this.attack(this.target, true);

}
}

private void attack(final EntityLivingBase ent, final boolean crit) {


ClientUtils.player().swingItem();
if (crit) {
this.crit();
}
else {
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C03PacketPlayer());
}
final float sharpLevel =
EnchantmentHelper.func_152377_a(ClientUtils.mc().thePlayer.getHeldItem(),
ent.getCreatureAttribute());
final boolean vanillaCrit = ClientUtils.mc().thePlayer.fallDistance > 0.0f
&& !ClientUtils.mc().thePlayer.onGround && !ClientUtils.mc().thePlayer.isOnLadder()
&& !ClientUtils.mc().thePlayer.isInWater() && !
ClientUtils.mc().thePlayer.isPotionActive(Potion.blindness) &&
ClientUtils.mc().thePlayer.ridingEntity == null;
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C02PacketUseEntity(ent, C02PacketUseEntity.Action.ATTACK));

if (crit || vanillaCrit) {
ClientUtils.mc().thePlayer.onCriticalHit(ent);
}
if (sharpLevel > 0.0f) {
ClientUtils.mc().thePlayer.onEnchantmentCritical(ent);
}
if (TickAura.angle) {
final ItemStack[] items = this.target.getInventory();
ItemStack helm = null;
if (items[2] != null) {
helm = items[2];
}
if (items[2] != null) {
ClientUtils.sendMessage("§2§l[§f§lTick Aura§2§l]: §fS\u0130K\u0130\
u015e! G\u00f6\u011f\u00fcsl\u00fck Dayan\u0131kl\u0131l\u0131\u011f\u0131: " +
String.valueOf(helm.getMaxDamage() - helm.getItemDamage()), false);
}
}
}

private void crit() {


final double posY = ClientUtils.mc().thePlayer.posY;
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C03PacketPlayer.C04PacketPlayerPosition(ClientUtils.mc().thePlayer.posX, posY +
0.0625, ClientUtils.mc().thePlayer.posZ, true));
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C03PacketPlayer.C04PacketPlayerPosition(ClientUtils.mc().thePlayer.posX, posY,
ClientUtils.mc().thePlayer.posZ, false));
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C03PacketPlayer.C04PacketPlayerPosition(ClientUtils.mc().thePlayer.posX, posY +
1.1E-5, ClientUtils.mc().thePlayer.posZ, false));
ClientUtils.mc().thePlayer.sendQueue.addToSendQueue(new
C03PacketPlayer.C04PacketPlayerPosition(ClientUtils.mc().thePlayer.posX, posY,
ClientUtils.mc().thePlayer.posZ, false));
}

protected void swap(final int slot, final int hotbarNum) {

ClientUtils.mc().playerController.windowClick(ClientUtils.mc().thePlayer.inventoryC
ontainer.windowId, slot, hotbarNum, 2, ClientUtils.mc().thePlayer);
}

public EntityLivingBase getClosest() {


double last = 9.0;
EntityLivingBase ent = null;
for (final Object o : ClientUtils.mc().theWorld.loadedEntityList) {
final EntityLivingBase entity;
if (o instanceof EntityLivingBase && this.check(entity =
(EntityLivingBase)o)) {
if (entity.getDistanceToEntity(ClientUtils.player()) >= last) {
continue;
}
last = entity.getDistanceToEntity(ClientUtils.player());
ent = entity;
}
}
return ent;
}
private EntityLivingBase getTarget(final boolean startup) {
final List<EntityLivingBase> targets = new ArrayList<EntityLivingBase>();

if (startup) {
for (int i = 0; i < 10; ++i) {
this.lowerTicks();
}
}

for (final Entity ent : ClientUtils.loadedEntityList()) {


if (ent instanceof EntityLivingBase) {
final EntityLivingBase entity = (EntityLivingBase)ent;
if ((entity.auraTicks > 12 && ( entity.auraTicks > 13)) || !
this.check(entity)) {
continue;
}
targets.add(entity);
}
}
Collections.sort(targets, new Comparator<EntityLivingBase>() {
@Override
public int compare(final EntityLivingBase ent1, final EntityLivingBase
ent2) {
return ent1.auraTicks - ent2.auraTicks;
}
});
if (targets.isEmpty()) {
return null;
}
final EntityLivingBase ent2 = targets.get(0);
if (this.target != ent2) {
Math.min(ent2.auraTicks, 12);
}
return ent2;
}

private void lowerTicks() {


for (final Entity ent : ClientUtils.loadedEntityList()) {
if (ent instanceof EntityLivingBase) {
final EntityLivingBase entityLivingBase;
final EntityLivingBase entity = entityLivingBase =
(EntityLivingBase)ent;
--entityLivingBase.auraTicks;
}
}
}
private boolean check(final EntityLivingBase e) {
return e != null && e != ClientUtils.mc().thePlayer &&
e.getDistanceToEntity(ClientUtils.mc().thePlayer) <= this.range && (!(e instanceof
EntityMob) || this.mobs) && (!(e instanceof EntityPlayer) || this.players) && (!(e
instanceof EntityPlayer) || !FriendManager.isFriend(e.getName()));
}
}

You might also like