This commit is contained in:
jackh 2025-01-23 14:00:39 -07:00
parent ab97ad7947
commit acf6cc2688
20 changed files with 425 additions and 275 deletions

View File

@ -1,13 +1,7 @@
package keystrokesmod.clickgui.components;
public class Component {
public boolean isVisible = true;
public boolean isVisible() {
return isVisible;
}
public boolean visible = true;
public void render() {
}

View File

@ -13,11 +13,11 @@ import org.lwjgl.opengl.GL11;
public class BindComponent extends Component {
public boolean isBinding;
private ModuleComponent moduleComponent;
private int o;
public ModuleComponent moduleComponent;
public int o;
private int x;
private int y;
private KeySetting keySetting;
public KeySetting keySetting;
public BindComponent(ModuleComponent moduleComponent, int o) {
this.moduleComponent = moduleComponent;
@ -39,16 +39,13 @@ public class BindComponent extends Component {
}
public void render() {
if (!isVisible()) {
this.o = this.o - 12;
}
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
if (keySetting == null) {
this.drawString(!this.moduleComponent.mod.canBeEnabled() && this.moduleComponent.mod.script == null ? "Module cannot be bound." : this.isBinding ? "Press a key..." : "Current bind: '§e" + (this.moduleComponent.mod.getKeycode() >= 1000 ? "M" + (this.moduleComponent.mod.getKeycode() - 1000) : Keyboard.getKeyName(this.moduleComponent.mod.getKeycode())) + "§r'");
}
else {
this.drawString(this.isBinding ? "Press a key..." : "" + this.keySetting.getName() + ": '§e" + (this.keySetting.getKey() >= 1000 ? "M" + (this.keySetting.getKey() - 1000) : Keyboard.getKeyName(this.keySetting.getKey())) + "§r'");
this.drawString(this.isBinding ? "Press a key..." : this.keySetting.getName() + ": '§e" + (this.keySetting.getKey() >= 1000 ? "M" + (this.keySetting.getKey() - 1000) : Keyboard.getKeyName(this.keySetting.getKey())) + "§r'");
}
GL11.glPopMatrix();
}
@ -139,10 +136,4 @@ public class BindComponent extends Component {
public void onGuiClosed() {
this.isBinding = false;
}
@Override
public boolean isVisible() {
return keySetting == null || keySetting.isVisible;
}
}

View File

@ -13,9 +13,9 @@ import java.awt.*;
public class ButtonComponent extends Component {
private final int c = (new Color(20, 255, 0)).getRGB();
private Module mod;
private ButtonSetting buttonSetting;
public ButtonSetting buttonSetting;
private ModuleComponent p;
private int o;
public int o;
private int x;
private int y;
@ -29,9 +29,6 @@ public class ButtonComponent extends Component {
}
public void render() {
if (!isVisible()) {
this.o = this.o - 12;
}
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
Minecraft.getMinecraft().fontRendererObj.drawString((this.buttonSetting.isMethodButton ? "[=] " : (this.buttonSetting.isToggled() ? "[+] " : "[-] ")) + this.buttonSetting.getName(), (float) ((this.p.categoryComponent.getX() + 4) * 2), (float) ((this.p.categoryComponent.getY() + this.o + 4) * 2), this.buttonSetting.isToggled() ? this.c : -1, false);
@ -65,10 +62,4 @@ public class ButtonComponent extends Component {
public boolean i(int x, int y) {
return x > this.x && x < this.x + this.p.categoryComponent.getWidth() && y > this.y && y < this.y + 11;
}
@Override
public boolean isVisible() {
return buttonSetting == null || buttonSetting.isVisible;
}
}
}

View File

@ -72,14 +72,14 @@ public class CategoryComponent {
this.xx = 0;
this.opened = false;
this.dragging = false;
int moduleRenderX = this.titleHeight + 3;
int moduleRenderY = this.titleHeight + 3;
this.scale = new ScaledResolution(Minecraft.getMinecraft());
this.targetModuleY = this.moduleY;
for (Module mod : Raven.getModuleManager().inCategory(this.categoryName)) {
ModuleComponent b = new ModuleComponent(mod, this, moduleRenderX);
ModuleComponent b = new ModuleComponent(mod, this, moduleRenderY);
this.modules.add(b);
moduleRenderX += 16;
moduleRenderY += 16;
}
}
@ -238,7 +238,7 @@ public class CategoryComponent {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
RenderUtils.scissor(0, this.y - 2, this.x + this.width + 4, extra - this.y + 4);
RenderUtils.drawRoundedGradientOutlinedRectangle(this.x - 2, this.y, this.x + this.width + 2, extra, 9, translucentBackground,
RenderUtils.drawRoundedGradientOutlinedRectangle(this.x - 2, this.y, this.x + this.width + 2, extra, 10, translucentBackground,
((opened || hovering) && Gui.rainBowOutlines.isToggled()) ? RenderUtils.setAlpha(Utils.getChroma(2, 0), 0.5) : regularOutline, ((opened || hovering) && Gui.rainBowOutlines.isToggled()) ? RenderUtils.setAlpha(Utils.getChroma(2, 700), 0.5) : regularOutline2);
renderItemForCategory(this.categoryName, this.x + 1, this.y + 4, opened || hovering);
renderer.drawString(this.n4m ? this.pvp : this.categoryName.name(), namePos, (float) (this.y + 4), categoryNameColor, false);

View File

@ -7,9 +7,9 @@ import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class DescriptionComponent extends Component {
private DescriptionSetting desc;
public DescriptionSetting desc;
private ModuleComponent p;
private int o;
public int o;
private int x;
private int y;

View File

@ -22,7 +22,6 @@ import java.util.Iterator;
public class ModuleComponent extends Component {
private int originalHoverAlpha = 120;
private final int c2 = (new Color(154, 2, 255)).getRGB();
private final int hoverColor = (new Color(0, 0, 0, originalHoverAlpha)).getRGB();
private final int unsavedColor = new Color(114, 188, 250).getRGB();
private final int invalidColor = new Color(255, 80, 80).getRGB();
@ -48,39 +47,30 @@ public class ModuleComponent extends Component {
int y = yPos + 12;
if (mod != null && !mod.getSettings().isEmpty()) {
for (Setting v : mod.getSettings()) {
if (!v.visible) {
continue;
}
if (v instanceof SliderSetting) {
SliderSetting n = (SliderSetting) v;
SliderComponent s = new SliderComponent(n, this, y);
if (!s.isVisible()) {
continue;
}
this.settings.add(s);
y += 12;
}
else if (v instanceof ButtonSetting) {
ButtonSetting b = (ButtonSetting) v;
ButtonComponent c = new ButtonComponent(mod, b, this, y);
if (!c.isVisible()) {
continue;
}
this.settings.add(c);
y += 12;
}
else if (v instanceof DescriptionSetting) {
DescriptionSetting d = (DescriptionSetting) v;
DescriptionComponent m = new DescriptionComponent(d, this, y);
if (!m.isVisible()) {
continue;
}
this.settings.add(m);
y += 12;
}
else if (v instanceof KeySetting) {
KeySetting setting = (KeySetting) v;
BindComponent keyComponent = new BindComponent(this, setting, y);
if (!keyComponent.isVisible()) {
continue;
}
this.settings.add(keyComponent);
y += 12;
}
@ -97,7 +87,7 @@ public class ModuleComponent extends Component {
while (true) {
while (var3.hasNext()) {
Component co = (Component) var3.next();
if (!co.isVisible()) {
if (!isVisible(co)) {
continue;
}
co.updateHeight(y);
@ -113,46 +103,6 @@ public class ModuleComponent extends Component {
}
}
public static void e() {
GL11.glDisable(2929);
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glDepthMask(true);
GL11.glEnable(2848);
GL11.glHint(3154, 4354);
GL11.glHint(3155, 4354);
}
public static void f() {
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glEnable(2929);
GL11.glDisable(2848);
GL11.glHint(3154, 4352);
GL11.glHint(3155, 4352);
GL11.glEdgeFlag(true);
}
public static void g() {
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.0F);
}
public static void v(float x, float y, float x1, float y1, int t, int b) {
e();
GL11.glShadeModel(7425);
GL11.glBegin(7);
g();
GL11.glVertex2f(x, y1);
GL11.glVertex2f(x1, y1);
g();
GL11.glVertex2f(x1, y);
GL11.glVertex2f(x, y);
GL11.glEnd();
GL11.glShadeModel(7424);
f();
}
public void render() {
if (hovering || hoverTimer != null) {
double hoverAlpha = (hovering && hoverTimer != null) ? hoverTimer.getValueFloat(0, originalHoverAlpha, 1) : (hoverTimer != null && !hovering) ? originalHoverAlpha - hoverTimer.getValueFloat(0, originalHoverAlpha, 1) : originalHoverAlpha;
@ -162,7 +112,6 @@ public class ModuleComponent extends Component {
RenderUtils.drawRoundedRectangle(this.categoryComponent.getX(), this.categoryComponent.getY() + yPos, this.categoryComponent.getX() + this.categoryComponent.getWidth(), this.categoryComponent.getY() + 16 + this.yPos, 8, Utils.mergeAlpha(hoverColor, (int) hoverAlpha));
}
v((float) this.categoryComponent.getX(), (float) (this.categoryComponent.getY() + this.yPos), (float) (this.categoryComponent.getX() + this.categoryComponent.getWidth()), (float) (this.categoryComponent.getY() + 15 + this.yPos), this.mod.isEnabled() ? this.c2 : -12829381, this.mod.isEnabled() ? this.c2 : -12302777);
GL11.glPushMatrix();
int button_rgb = this.mod.isEnabled() ? enabledColor : disabledColor;
@ -205,7 +154,7 @@ public class ModuleComponent extends Component {
if (this.isOpened || smoothTimer != null) {
for (Component settingComponent : this.settings) {
if (!settingComponent.isVisible()) {
if (!isVisible(settingComponent)) {
continue;
}
settingComponent.render();
@ -232,7 +181,7 @@ public class ModuleComponent extends Component {
while (true) {
while (var2.hasNext()) {
Component c = (Component) var2.next();
if (!c.isVisible()) {
if (!isVisible(c)) {
continue;
}
if (c instanceof SliderComponent) {
@ -255,7 +204,7 @@ public class ModuleComponent extends Component {
while (true) {
while (var2.hasNext()) {
Component c = (Component) var2.next();
if (!c.isVisible()) {
if (!isVisible(c)) {
continue;
}
if (c instanceof SliderComponent) {
@ -344,4 +293,50 @@ public class ModuleComponent extends Component {
public boolean overModuleName(int x, int y) {
return x > this.categoryComponent.getX() && x < this.categoryComponent.getX() + this.categoryComponent.getWidth() && y > this.categoryComponent.getModuleY() + this.yPos && y < this.categoryComponent.getModuleY() + 16 + this.yPos;
}
}
public void updateSettingPositions() {
int y = this.yPos + 12;
for (Component c : this.settings) {
if (!isVisible(c)) {
continue;
}
if (c instanceof DescriptionComponent) {
((DescriptionComponent) c).o = y;
y += 12;
}
else if (c instanceof BindComponent) {
((BindComponent) c).o = y;
if (((BindComponent) c).keySetting != null) { // not the bind for the module
y += 12;
}
}
else if (c instanceof SliderComponent) {
((SliderComponent) c).o = y;
y += 12;
}
else if (c instanceof ButtonComponent) {
((ButtonComponent) c).o = y;
y += 12;
}
}
this.categoryComponent.updateHeight();
}
public boolean isVisible(Component component) {
if (component instanceof SliderComponent) {
return ((SliderComponent) component).sliderSetting.visible;
}
if (component instanceof ButtonComponent) {
return ((ButtonComponent) component).buttonSetting.visible;
}
if (component instanceof DescriptionComponent) {
return ((DescriptionComponent) component).desc.visible;
}
if (component instanceof BindComponent) {
if (((BindComponent) component).keySetting != null) {
return ((BindComponent) component).keySetting.visible;
}
}
return true;
}
}

View File

@ -16,9 +16,9 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
public class SliderComponent extends Component {
private SliderSetting sliderSetting;
public SliderSetting sliderSetting;
private ModuleComponent moduleComponent;
private int o;
public int o;
private int x;
private int y;
private boolean heldDown = false;
@ -33,9 +33,6 @@ public class SliderComponent extends Component {
}
public void render() {
if (!isVisible()) {
this.o = this.o - 12;
}
RenderUtils.drawRoundedRectangle(this.moduleComponent.categoryComponent.getX() + 4, this.moduleComponent.categoryComponent.getY() + this.o + 11, this.moduleComponent.categoryComponent.getX() + 4 + this.moduleComponent.categoryComponent.getWidth() - 8, this.moduleComponent.categoryComponent.getY() + this.o + 15, 4, -12302777);
int l = this.moduleComponent.categoryComponent.getX() + 4;
int r = this.moduleComponent.categoryComponent.getX() + 4 + (int) this.w;
@ -61,7 +58,7 @@ public class SliderComponent extends Component {
value = this.sliderSetting.getOptions()[(int) this.sliderSetting.getInput()];
}
else {
value = Utils.isWholeNumber(input) ? (int) input + "" : String.valueOf(input);
value = Utils.asWholeNum(input);
}
}
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.sliderSetting.getName() + ": " + (this.sliderSetting.isString ? "§e" : "§b") +value + suffix, (float) ((int) ((float) (this.moduleComponent.categoryComponent.getX() + 4) * 2.0F)), (float) ((int) ((float) (this.moduleComponent.categoryComponent.getY() + this.o + 3) * 2.0F)), -1);
@ -76,7 +73,6 @@ public class SliderComponent extends Component {
this.y = this.moduleComponent.categoryComponent.getModuleY() + this.o;
this.x = this.moduleComponent.categoryComponent.getX();
double d = Math.min(this.moduleComponent.categoryComponent.getWidth() - 8, Math.max(0, x - this.x));
if (this.heldDown) {
this.moduleComponent.mod.onSlide(this.sliderSetting);
if (d == 0.0D && this.sliderSetting.canBeDisabled) {
@ -132,10 +128,4 @@ public class SliderComponent extends Component {
public void onGuiClosed() {
this.heldDown = false;
}
@Override
public boolean isVisible() {
return sliderSetting == null || sliderSetting.isVisible;
}
}
}

View File

@ -28,7 +28,6 @@ import net.minecraft.network.play.client.*;
import net.minecraft.util.*;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@ -204,6 +203,11 @@ public class KillAura extends Module {
blinkedPackets.add(packet);
e.setCanceled(true);
}
if (!lag && target != null && Utils.holdingSword() && autoBlockMode.getInput() >= 2) {
if (packet instanceof C08PacketPlayerBlockPlacement) {
e.setCanceled(true);
}
}
}
@SubscribeEvent
@ -211,21 +215,21 @@ public class KillAura extends Module {
if (!Utils.nullCheck()) {
return;
}
if (target != null && Mouse.isButtonDown(0)) {
swingItem();
if (target != null) {
if (Mouse.isButtonDown(0)) {
swingItem();
}
if (blinkAutoBlock() || autoBlockMode.getInput() == 2) {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
}
}
if (checkUsing && disableCheckUsing && ++disableCTicks >= 2) {
checkUsing = false;
}
if (autoBlockOverride() && target != null) {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
}
if (target == null) {
if (checkUsing && Mouse.isButtonDown(1) && !blinkAutoBlock()) {
if (!sendUnBlock) {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true);
checkUsing = false;
}
if (checkUsing && !sendUnBlock && Mouse.isButtonDown(1) && !blinkAutoBlock()) {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true);
checkUsing = false;
}
}
if (!checkUsing) {
@ -470,6 +474,9 @@ public class KillAura extends Module {
@SubscribeEvent
public void onMouse(MouseEvent e) {
if (!settingCondition()) {
return;
}
if (e.button == 0 || e.button == 1) {
if (e.button == 1) {
EntityLivingBase g = Utils.raytrace(3);
@ -841,11 +848,18 @@ public class KillAura extends Module {
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
lag = true;
}
break;
case 2:
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
lag = true;
if (!ModuleUtils.isBlocked) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
lag = true;
}
break;
}
break;
@ -859,13 +873,22 @@ public class KillAura extends Module {
blinking.set(true);
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
}
break;
@ -877,20 +900,29 @@ public class KillAura extends Module {
switch (interactTicks) {
case 1:
blinking.set(true);
if (lag) {
if (ModuleUtils.isBlocked) {
setSwapSlot();
swapped = true;
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
if (lag) {
if (swapped) {
setCurrentSlot();
swapped = false;
}
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
}
break;
@ -904,13 +936,22 @@ public class KillAura extends Module {
blinking.set(true);
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
}
break;
@ -925,14 +966,25 @@ public class KillAura extends Module {
blinking.set(true);
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets();
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 3:
firstCycle = false;
lag = true;
break;
}
}
@ -942,15 +994,24 @@ public class KillAura extends Module {
blinking.set(true);
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets();
interactTicks = 0;
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
firstCycle = true;
lag = true;
interactTicks = 0;
break;
}
}
@ -1056,7 +1117,7 @@ public class KillAura extends Module {
continue;
}
ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i);
double damage = Utils.getDamage(stack);
double damage = Utils.getDamageLevel(stack);
if (damage != 0) {
if (damage > bestDamage) {
bestDamage = damage;

View File

@ -22,6 +22,7 @@ public class Velocity extends Module {
private SliderSetting horizontal;
private SliderSetting vertical;
private SliderSetting chance;
private ButtonSetting onlyWhileAttacking;
private ButtonSetting onlyWhileTargeting;
private ButtonSetting disableS;
private ButtonSetting zzWhileNotTargeting;
@ -35,10 +36,11 @@ public class Velocity extends Module {
public Velocity() {
super("Velocity", category.combat);
this.registerSetting(velocityModes = new SliderSetting("Modes", 0, velocityModesString));
this.registerSetting(velocityModes = new SliderSetting("Mode", 0, velocityModesString));
this.registerSetting(horizontal = new SliderSetting("Horizontal", 0.0, 0.0, 100.0, 1.0));
this.registerSetting(vertical = new SliderSetting("Vertical", 0.0, 0.0, 100.0, 1.0));
this.registerSetting(chance = new SliderSetting("Chance", "%", 100.0D, 0.0D, 100.0D, 1.0D));
this.registerSetting(onlyWhileAttacking = new ButtonSetting("Only while attacking", false));
this.registerSetting(onlyWhileTargeting = new ButtonSetting("Only while targeting", false));
this.registerSetting(disableS = new ButtonSetting("Disable while holding S", false));
this.registerSetting(zzWhileNotTargeting = new ButtonSetting("00 while not targeting", false));
@ -46,10 +48,20 @@ public class Velocity extends Module {
this.registerSetting(allowSelfFireball = new ButtonSetting("Allow self fireball", false));
}
public void guiUpdate() {
this.onlyWhileAttacking.setVisible(velocityModes.getInput() == 0, this);
this.onlyWhileTargeting.setVisible(velocityModes.getInput() == 0, this);
this.disableS.setVisible(velocityModes.getInput() == 0, this);
this.allowSelfFireball.setVisible(velocityModes.getInput() == 1, this);
this.disableExplosions.setVisible(velocityModes.getInput() == 1, this);
this.zzWhileNotTargeting.setVisible(velocityModes.getInput() == 1, this);
}
@SubscribeEvent
public void onReceivePacket(ReceivePacketEvent e) {
if (velocityModes.getInput() == 1) {
if (!Utils.nullCheck() || LongJump.stopVelocity || e.isCanceled()) {
if (!Utils.nullCheck() || LongJump.stopVelocity || e.isCanceled() || ModuleManager.bedAura.cancelKnockback()) {
return;
}
if (e.getPacket() instanceof S27PacketExplosion) {
@ -123,6 +135,9 @@ public class Velocity extends Module {
if (mc.thePlayer.maxHurtTime <= 0 || mc.thePlayer.hurtTime != mc.thePlayer.maxHurtTime) {
return;
}
if (onlyWhileAttacking.isToggled() && !ModuleUtils.isAttacking) {
return;
}
if (onlyWhileTargeting.isToggled() && (mc.objectMouseOver == null || mc.objectMouseOver.entityHit == null)) {
return;
}

View File

@ -78,7 +78,10 @@ public class LongJump extends Module {
}
public void guiUpdate() {
//temporaryFlightKey.isVisible = mode.getInput() == 0;
this.verticalMotion.setVisible(mode.getInput() == 0, this);
this.motionDecay.setVisible(mode.getInput() == 0, this);
this.allowStrafe.setVisible(mode.getInput() == 0, this);
this.temporaryFlightKey.setVisible(mode.getInput() == 0, this);
}
public void onEnable() {

View File

@ -13,6 +13,7 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.*;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Mouse;
@ -157,6 +158,13 @@ public class NoSlow extends Module {
}
}
@SubscribeEvent(priority = EventPriority.LOWEST) // called last in order to apply fix
public void onMoveInput(PrePlayerInputEvent e) {
if (mode.getInput() == 4 && getSlowed() != 0.2f && !canFloat) {
mc.thePlayer.movementInput.jump = false;
}
}
public static float getSlowed() {
if (mc.thePlayer.getHeldItem() == null || ModuleManager.noSlow == null || !ModuleManager.noSlow.isEnabled()) {
return 0.2f;

View File

@ -157,7 +157,7 @@ public class BedAura extends Module {
@SubscribeEvent
public void onReceivePacket(ReceivePacketEvent e) {
if (!Utils.nullCheck() || !cancelKnockback.isToggled() || currentBlock == null) {
if (!Utils.nullCheck() || !cancelKnockback()) {
return;
}
if (e.getPacket() instanceof S12PacketEntityVelocity) {
@ -218,7 +218,7 @@ public class BedAura extends Module {
}
public boolean cancelKnockback() {
return this.isEnabled() && this.currentBlock != null && this.cancelKnockback.isToggled();
return cancelKnockback.isToggled() && currentBlock != null && RotationUtils.inRange(currentBlock, range.getInput());
}
private BlockPos[] getBedPos() {

View File

@ -165,7 +165,7 @@ public class InvManager extends Module {
autoClose();
return;
}
String name = chest.getLowerChestInventory().getName();
String name = Utils.stripColor(chest.getLowerChestInventory().getName());
if (!customChest.isToggled() && !name.equals("Chest") && !name.equals("Ender Chest") && !name.equals("Large Chest")) {
return;
}
@ -395,7 +395,7 @@ public class InvManager extends Module {
if (desiredSlot != -1) {
ItemStack itemStackInSlot = getItemStack(desiredSlot + 35);
if (itemStackInSlot != null && itemStackInSlot.getItem() instanceof ItemSword) {
damageInSlot = Utils.getDamage(itemStackInSlot);
damageInSlot = Utils.getDamageLevel(itemStackInSlot);
}
}
for (int i = 9; i < 45; i++) {
@ -403,7 +403,7 @@ public class InvManager extends Module {
if (item == null || !(item.getItem() instanceof ItemSword)) {
continue;
}
double damage = Utils.getDamage(item);
double damage = Utils.getDamageLevel(item);
if (damage > lastDamage && damage > damageInSlot) {
lastDamage = damage;
bestSword = i;
@ -415,7 +415,7 @@ public class InvManager extends Module {
if (item == null || !(item.getItem() instanceof ItemSword)) {
continue;
}
double damage = Utils.getDamage(item);
double damage = Utils.getDamageLevel(item);
if (damage > lastDamage && damage > damageInSlot) {
lastDamage = damage;
bestSword = i;
@ -544,99 +544,131 @@ public class InvManager extends Module {
return bestRod;
}
private int getBestTool(ItemStack itemStack, IInventory inventory) {
int bestTool = -1;
double lastEfficiency = -1;
private int getBestTool(ItemStack tool, IInventory inventory) {
if (tool == null || !(tool.getItem() instanceof ItemTool)) {
return -1;
}
Block blockType = Blocks.dirt;
if (itemStack.getItem() instanceof ItemAxe) {
if (tool.getItem() instanceof ItemAxe) {
blockType = Blocks.log;
}
else if (itemStack.getItem() instanceof ItemPickaxe) {
else if (tool.getItem() instanceof ItemPickaxe) {
blockType = Blocks.stone;
}
for (int i = 5; i < 45; i++) {
ItemStack item = getItemStack(i);
if (item == null || !(item.getItem() instanceof ItemTool) || item.getItem() != itemStack.getItem()) {
else if (tool.getItem() instanceof ItemSpade) {
blockType = Blocks.dirt;
}
Class<?> toolClass = tool.getItem().getClass();
int bestSlot = -1;
double bestEfficiency = -1.0;
for (int slot = 5; slot < 45; slot++) {
ItemStack stack = getItemStack(slot);
if (stack == null || !(stack.getItem() instanceof ItemTool)) {
continue;
}
double efficiency = Utils.getEfficiency(item, blockType);
if (efficiency > lastEfficiency) {
lastEfficiency = efficiency;
bestTool = i;
if (toolClass.isInstance(stack.getItem())) {
double efficiency = Utils.getEfficiency(stack, blockType);
if (efficiency > bestEfficiency) {
bestEfficiency = efficiency;
bestSlot = slot;
}
}
}
if (inventory != null) {
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack item = inventory.getStackInSlot(i);
if (item == null || !(item.getItem() instanceof ItemTool) || item.getItem() != itemStack.getItem()) {
for (int slot = 0; slot < inventory.getSizeInventory(); slot++) {
ItemStack stack = inventory.getStackInSlot(slot);
if (stack == null || !(stack.getItem() instanceof ItemTool)) {
continue;
}
double efficiency = Utils.getEfficiency(item, blockType);;
if (efficiency > lastEfficiency) {
lastEfficiency = efficiency;
bestTool = i;
if (toolClass.isInstance(stack.getItem())) {
double efficiency = Utils.getEfficiency(stack, blockType);
if (efficiency > bestEfficiency) {
bestEfficiency = efficiency;
bestSlot = slot;
}
}
}
}
return bestTool;
return bestSlot;
}
private int getBestPotion(int desiredSlot, IInventory inventory) {
int amplifier = -1;
int bestScore = -1;
int bestPotion = -1;
int bestStackSize = -1;
double amplifierInSlot = -1;
int biggestStack = 0;
if (amplifierInSlot != -1) {
ItemStack itemStackInSlot = getItemStack( desiredSlot + 35);
if (itemStackInSlot != null && itemStackInSlot.getItem() instanceof ItemPotion) {
amplifierInSlot = getPotionLevel(itemStackInSlot);
}
ItemStack itemStackInSlot = getItemStack(desiredSlot + 35);
if (itemStackInSlot != null && itemStackInSlot.getItem() instanceof ItemPotion) {
amplifierInSlot = getPotionScore(itemStackInSlot);
}
for (int i = 9; i < 45; i++) {
ItemStack item = getItemStack(i);
if (item != null && item.getItem() instanceof ItemPotion) {
List<PotionEffect> list = ((ItemPotion) item.getItem()).getEffects(item);
if (list == null) {
continue;
}
int size = item.stackSize;
for (PotionEffect effect : list) {
int score = effect.getAmplifier() + effect.getDuration();
if (effect.getEffectName().equals("potion.moveSpeed") && score > amplifier && score > amplifierInSlot && size > biggestStack) {
bestPotion = i;
amplifier = score;
biggestStack = size;
}
}
if (item == null || !(item.getItem() instanceof ItemPotion)) {
continue;
}
int score = getPotionScore(item);
if (score <= 0) {
continue;
}
if (score > bestScore && score > amplifierInSlot) {
bestPotion = i;
bestScore = score;
bestStackSize = item.stackSize;
}
else if (score == bestScore && item.stackSize > bestStackSize && score > amplifierInSlot) {
bestPotion = i;
bestScore = score;
bestStackSize = item.stackSize;
}
}
if (inventory != null) {
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack item = inventory.getStackInSlot(i);
if (item != null && item.getItem() instanceof ItemPotion) {
List<PotionEffect> list = ((ItemPotion) item.getItem()).getEffects(item);
if (list == null) {
continue;
}
for (PotionEffect effect : list) {
if (effect.getEffectName().equals("potion.moveSpeed") && effect.getAmplifier() > amplifier && effect.getAmplifier() > amplifierInSlot) {
bestPotion = i;
amplifier = effect.getAmplifier();
}
}
if (item == null || !(item.getItem() instanceof ItemPotion)) {
continue;
}
int score = getPotionScore(item);
if (score <= 0) {
continue;
}
if (score > bestScore && score > amplifierInSlot) {
bestPotion = i;
bestScore = score;
bestStackSize = item.stackSize;
}
else if (score == bestScore && item.stackSize > bestStackSize && score > amplifierInSlot) {
bestPotion = i;
bestScore = score;
bestStackSize = item.stackSize;
}
}
}
return bestPotion;
}
private int getPotionLevel(ItemStack item) {
private int getPotionScore(ItemStack item) {
if (!(item.getItem() instanceof ItemPotion)) {
return -1;
}
List<PotionEffect> list = ((ItemPotion) item.getItem()).getEffects(item);
if (list == null) {
return -1;
}
for (PotionEffect effect : list) {
if (effect.getEffectName().equals("potion.moveSpeed")) {
if ("potion.moveSpeed".equals(effect.getEffectName())) {
return effect.getAmplifier() + effect.getDuration();
}
}
@ -649,7 +681,7 @@ public class InvManager extends Module {
int stackInSlot = -1;
if (desiredSlot != -1) {
ItemStack itemStackInSlot = getItemStack(desiredSlot + 35);
if (itemStackInSlot != null) {
if (itemStackInSlot != null && itemStackInSlot.getItem() == targetItem) {
stackInSlot = itemStackInSlot.stackSize;
}
}
@ -689,9 +721,12 @@ public class InvManager extends Module {
}
private int getMostProjectiles(int desiredSlot) {
int biggestSnowballSlot = getBiggestStack(Items.snowball, (int) projectileSlot.getInput());
int biggestEggSlot = getBiggestStack(Items.egg, (int) projectileSlot.getInput());
int biggestSlot = -1;
int biggestSnowballSlot = getBiggestStack(Items.snowball, desiredSlot);
int biggestEggSlot = getBiggestStack(Items.egg, desiredSlot);
int snowballStackSize = (biggestSnowballSlot != -1) ? getItemStack(biggestSnowballSlot).stackSize : 0;
int eggStackSize = (biggestEggSlot != -1) ? getItemStack(biggestEggSlot).stackSize : 0;
int stackInSlot = 0;
if (desiredSlot != -1) {
ItemStack itemStackInSlot = getItemStack(desiredSlot + 35);
@ -699,19 +734,23 @@ public class InvManager extends Module {
stackInSlot = itemStackInSlot.stackSize;
}
}
if (stackInSlot >= biggestEggSlot && stackInSlot >= biggestSnowballSlot) {
if (stackInSlot >= snowballStackSize && stackInSlot >= eggStackSize) {
return -1;
}
if (biggestEggSlot > biggestSnowballSlot) {
biggestSlot = biggestEggSlot;
if (eggStackSize > snowballStackSize) {
return biggestEggSlot;
}
else if (biggestSnowballSlot > biggestEggSlot) {
biggestSlot = biggestSnowballSlot;
else if (snowballStackSize > eggStackSize) {
return biggestSnowballSlot;
}
else if (biggestSnowballSlot != -1 && biggestEggSlot != -1 && biggestEggSlot == biggestSnowballSlot) {
biggestSlot = biggestSnowballSlot;
else {
if (snowballStackSize != 0 && eggStackSize != 0) {
return biggestSnowballSlot;
}
}
return biggestSlot;
return -1;
}
private int getMostBlocks() {

View File

@ -56,16 +56,16 @@ public class NoFall extends Module {
double predictedY = mc.thePlayer.posY + mc.thePlayer.motionY;
double distanceFallen = initialY - predictedY;
if (mc.thePlayer.motionY >= -1.1) {
if (mc.thePlayer.motionY >= -1.0) {
dynamic = 3;
}
if (mc.thePlayer.motionY < -1.1) {
if (mc.thePlayer.motionY < -1.0) {
dynamic = 3.5;
}
if (mc.thePlayer.motionY < -1.8) {
if (mc.thePlayer.motionY < -1.7) {
dynamic = 4;
}
if (mc.thePlayer.motionY < -2.4) {
if (mc.thePlayer.motionY < -2.6) {
dynamic = 4.5;
}
if (isFalling && mode.getInput() == 2) {

View File

@ -95,7 +95,7 @@ public class Safewalk extends Module {
return;
}
if (shift) {
final long targetShiftDelay = (long)shiftDelay.getInput();
final long targetShiftDelay = (long) shiftDelay.getInput();
if (targetShiftDelay > 0L) {
if (Utils.timeBetween(this.lastShift, System.currentTimeMillis()) < targetShiftDelay) {
return;

View File

@ -23,6 +23,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.*;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Mouse;
@ -89,12 +90,12 @@ public class Scaffold extends Module {
public boolean moduleEnabled;
public boolean isEnabled;
private boolean disabledModule;
private boolean dontDisable;
private boolean dontDisable, towerEdge;
private int disableTicks;
private int scaffoldTicks;
private long firstStroke;
private float lastEdge;
private float lastEdge, lastEdge2;
public Scaffold() {
super("Scaffold", category.player);
@ -118,6 +119,9 @@ public class Scaffold extends Module {
}
public void onDisable() {
if (ModuleManager.tower.canTower() && (ModuleManager.tower.dCount == 0 || !Utils.isMoving())) {
towerEdge = true;
}
disabledModule = true;
moduleEnabled = false;
}
@ -131,7 +135,7 @@ public class Scaffold extends Module {
lastSlot.set(-1);
}
@SubscribeEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onMouse(MouseEvent e) {
if (!isEnabled) {
return;
@ -303,22 +307,24 @@ public class Scaffold extends Module {
e.setRotations(yaw - yawOffset, pitch);
set2 = false;*/
float minPitch = 81.150F;
if (blockRotations != null) {
blockYaw = blockRotations[0];
pitch = blockRotations[1];
if (pitch < 79.150F && Utils.getHorizontalSpeed() < 0.5) {
pitch = 79.150F;
if (pitch < minPitch && Utils.getHorizontalSpeed() < 0.6) {
pitch = minPitch;
}
} else {
firstStroke = 0;
yawOffset = 40;
lastYawOffset = 50;
blockYaw = 0;
pitch = 79.150F;
pitch = minPitch;
}
//Utils.print("" + pitch);
if (firstStroke > 0 && (System.currentTimeMillis() - firstStroke) > 250) {
if (firstStroke > 0 && (System.currentTimeMillis() - firstStroke) > 275) {
firstStroke = 0;
}
@ -328,15 +334,15 @@ public class Scaffold extends Module {
float normalizedYaw = (relativeYaw % 360 + 360) % 360;
float quad = normalizedYaw % 90;
float firstStraight = 64.50f;
float secondStraight = 60.50f;
float firstStraight = 56.50f;
float secondStraight = 55.50f;
float thirdStraight = 54.50f;
float firstDiag = 50.50f;
float secondDiag = 45.50f;
float thirdDiag = 41.50f;
float fourthDiag = 34.50f;
float firstDiag = 54.50f;
float secondDiag = 52.50f;
float thirdDiag = 49.50f;
float fourthDiag = 44.50f;
if (firstStroke == 0) {
if (firstStroke == 0 || mc.thePlayer.onGround || ModuleManager.tower.speed) {
//first straight
if (quad < 5 || quad >= 85) {
if (blockRotations != null) {
@ -349,25 +355,25 @@ public class Scaffold extends Module {
yawOffset = firstStraight;
}
//second straight
//second straight
} else if (quad >= 80 && quad < 85) {
yawOffset = -secondStraight;
} else if (quad < 10) {
yawOffset = secondStraight;
//third straight
//third straight
} else if (quad >= 65 && quad < 85) {
yawOffset = -thirdStraight;
} else if (quad < 25 || quad >= 85) {
yawOffset = thirdStraight;
//first diag
//first diag
} else if (quad >= 55 && quad < 85) {
yawOffset = -firstDiag;
} else if (quad < 35 || quad >= 85) {
yawOffset = firstDiag;
//second diag
//second diag
} else if (quad >= 15 && quad < 45) {
yawOffset = secondDiag;
if (quad >= 38 && quad < 45) {
@ -385,7 +391,7 @@ public class Scaffold extends Module {
}
}
}
if (yawOffset != lastYawOffset) {
if (yawOffset != lastYawOffset || mc.thePlayer.onGround || ModuleManager.tower.speed) {
firstStroke = System.currentTimeMillis();
//Utils.print("Delay");
}
@ -394,19 +400,22 @@ public class Scaffold extends Module {
}
yaw = MathHelper.wrapAngleTo180_float((mc.thePlayer.rotationYaw - hardcodedYaw()));
if (mc.thePlayer.onGround) {
if (firstStroke == 0 || mc.thePlayer.onGround || ModuleManager.tower.speed) {
yaw = MathHelper.wrapAngleTo180_float((mc.thePlayer.rotationYaw - hardcodedYaw()));
}
else {
//yaw = yaw - (groundYaw - MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw)) / 4;
float yawDifference = getAngleDifference(lastEdge, yaw);
float smoothingFactor = (1.0f - (90.0f / 100.0f));
yaw = (lastEdge + yawDifference * smoothingFactor);
}
lastEdge = yaw;
yaw += yawOffset;
float yawDifference = getAngleDifference(lastEdge2, yaw);
float smoothingFactor = (1.0f - (27.0f / 100.0f));
yaw = (lastEdge2 + yawDifference * smoothingFactor);
lastEdge2 = yaw;
//yaw += (float) Utils.randomizeDouble(-0.00001, 0.0012);
e.setRotations(yaw, pitch);
//Utils.print("" + yaw);
break;
case 3:
if (blockRotations != null) {
@ -517,13 +526,13 @@ public class Scaffold extends Module {
if (disabledModule) {
if (hasPlaced && (ModuleManager.tower.canTower() && (ModuleManager.tower.dCount == 0 || !Utils.isMoving()) || floatStarted && Utils.isMoving() && Utils.onEdge())) {
if (hasPlaced && (towerEdge || floatStarted && Utils.isMoving() && Utils.isEdgeOfBlock())) {
dontDisable = true;
}
if (dontDisable && ++disableTicks >= 2) {
isEnabled = false;
//Utils.print("Extra tick");
Utils.print("Extra tick");
}
if (!dontDisable) {
isEnabled = false;
@ -536,7 +545,7 @@ public class Scaffold extends Module {
//Utils.print("Disabled");
if (ModuleManager.tower.speed) {
Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 2);
Utils.setSpeed(Utils.getHorizontalSpeed(mc.thePlayer) / 1.6);
}
if (lastSlot.get() != -1) {
@ -554,7 +563,7 @@ public class Scaffold extends Module {
blockInfo = null;
blockRotations = null;
startYPos = -1;
fastScaffoldKeepY = firstKeepYPlace = rotateForward = rotatingForward = lowhop = floatStarted = floatJumped = floatWasEnabled = false;
fastScaffoldKeepY = firstKeepYPlace = rotateForward = rotatingForward = lowhop = floatStarted = floatJumped = floatWasEnabled = towerEdge = false;
rotationDelay = keepYTicks = scaffoldTicks = 0;
startYPos = -1;
lookVec = null;

View File

@ -93,7 +93,7 @@ public class BedESP extends Module {
float blockHeight = getBlockHeight();
if (firstBed.isToggled() && this.bed != null) {
float customAlpha = 0.25f;
if (!(mc.theWorld.getBlockState(this.bed[0]).getBlock() instanceof BlockBed)) {
if (!isBed(bed[0]) || !isBed(bed[1])) {
if (firstBedTimer == null) {
(firstBedTimer = (new Timer(300))).start();
}
@ -116,7 +116,7 @@ public class BedESP extends Module {
float customAlpha = 0.25f;
Map.Entry<BlockPos[], Timer> entry = iterator.next();
BlockPos[] blockPos = entry.getKey();
if (!(mc.theWorld.getBlockState(blockPos[0]).getBlock() instanceof BlockBed)) {
if (!isBed(blockPos[0]) || !isBed(blockPos[1])) {
if (entry.getValue() == null) {
entry.setValue(new Timer(300));
entry.getValue().start();
@ -180,4 +180,8 @@ public class BedESP extends Module {
private float getBlockHeight() {
return (renderFullBlock.isToggled() ? 1 : 0.5625F);
}
public boolean isBed(BlockPos blockPos) {
return mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockBed;
}
}

View File

@ -1,20 +1,39 @@
package keystrokesmod.module.setting;
import com.google.gson.JsonObject;
import keystrokesmod.Raven;
import keystrokesmod.clickgui.components.impl.CategoryComponent;
import keystrokesmod.clickgui.components.impl.ModuleComponent;
import keystrokesmod.module.Module;
public abstract class Setting {
public String name;
public boolean visible = true;
public boolean isVisible = true;
public Setting(String name) {
this.name = name;
}
public String n;
public Setting(String n) {
this.n = n;
public void setVisible(boolean visible, Module module) {
if (visible == this.visible) {
return;
}
this.visible = visible;
for (CategoryComponent categoryComponent : Raven.clickGui.categories) {
if (categoryComponent.categoryName == module.moduleCategory()) {
for (ModuleComponent moduleComponent : categoryComponent.modules) {
if (moduleComponent.mod.getName().equals(module.getName())) {
moduleComponent.updateSettingPositions();
break;
}
}
}
}
}
public String getName() {
return this.n;
return this.name;
}
public abstract void loadProfile(JsonObject data);
}
}

View File

@ -34,7 +34,9 @@ public class ModuleUtils {
public static int fadeEdge;
public static int lastFaceDifference;
private int lastFace;
public static float offsetValue = 1E-13F;
public static float offsetValue = 1E-9F;
public static boolean isAttacking;
private int attackingTicks;
public static boolean isBlocked;
@ -59,6 +61,14 @@ public class ModuleUtils {
}
//
// isAttacking
if (e.getPacket() instanceof C02PacketUseEntity) {
isAttacking = true;
attackingTicks = 5;
}
//
}
@ -82,7 +92,14 @@ public class ModuleUtils {
}
//
// isAttacking
if (e.getPacket() instanceof C02PacketUseEntity) {
isAttacking = true;
attackingTicks = 5;
}
//
@ -120,6 +137,15 @@ public class ModuleUtils {
@SubscribeEvent
public void onPreUpdate(PreUpdateEvent e) {
if (isAttacking) {
if (attackingTicks <= 0) {
isAttacking = false;
}
else {
--attackingTicks;
}
}
if (LongJump.slotReset && ++LongJump.slotResetTicks >= 2) {
LongJump.stopKillAura = false;
LongJump.stopScaffold = false;

View File

@ -3,7 +3,6 @@ package keystrokesmod.utility;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import keystrokesmod.Raven;
import keystrokesmod.mixin.impl.accessor.IAccessorEntityPlayerSP;
import keystrokesmod.mixin.impl.accessor.IAccessorGuiIngame;
import keystrokesmod.mixin.impl.accessor.IAccessorItemFood;
@ -20,7 +19,6 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@ -450,7 +448,7 @@ public class Utils {
public static double ap(final EntityPlayer entityPlayer, final ItemStack itemStack) {
double n = 1.0;
if (itemStack != null && (itemStack.getItem() instanceof ItemSword || itemStack.getItem() instanceof ItemAxe)) {
n += getDamage(itemStack);
n += getDamageLevel(itemStack);
}
double n2 = 0.0;
double n3 = 0.0;
@ -1014,6 +1012,14 @@ public class Utils {
return Math.abs(n2 - n);
}
public static long time() {
return System.currentTimeMillis();
}
public static double getMotionSpeed() {
return Math.abs(mc.thePlayer.motionX) + Math.abs(mc.thePlayer.motionZ);
}
public static void sendModuleMessage(Module module, String s) {
sendRawMessage("&3" + module.getName() + "&7: &r" + s);
}
@ -1253,18 +1259,17 @@ public class Utils {
return false;
}
public static double getDamage(ItemStack itemStack) {
if (itemStack == null) {
return 0;
}
double getAmount = 0;
public static double getDamageLevel(ItemStack itemStack) {
double baseDamage = 0.0;
for (final Map.Entry<String, AttributeModifier> entry : itemStack.getAttributeModifiers().entries()) {
if (entry.getKey().equals("generic.attackDamage")) {
getAmount = entry.getValue().getAmount();
baseDamage = entry.getValue().getAmount();
break;
}
}
return getAmount + EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack) * 1.25;
int sharp_level = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack);
int fire_level = EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, itemStack);
return baseDamage + sharp_level * 1.25 + (fire_level * 4 - 1);
}