minor code cleanup in offhandgap

This commit is contained in:
Bella 2020-03-07 15:23:29 -05:00
parent 5896870ae0
commit 7a207f3779
No known key found for this signature in database
GPG Key ID: 03B01AC937D1C89C
1 changed files with 5 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.module.modules.combat;
import me.zero.alpine.listener.EventHandler; import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener; import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.event.events.PacketEvent; import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module; import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager; import me.zeroeightsix.kami.module.ModuleManager;
@ -18,7 +19,7 @@ import static me.zeroeightsix.kami.module.modules.gui.InfoOverlay.getItems;
* @author polymer (main listener switch function xd) * @author polymer (main listener switch function xd)
* @author S-B99 (made epic and smooth and cleaned up code <3) (why did i rewrite this 4 times) * @author S-B99 (made epic and smooth and cleaned up code <3) (why did i rewrite this 4 times)
* Created by polymer on 21/02/20 * Created by polymer on 21/02/20
* Updated by S-B99 on 06/03/20 * Updated by S-B99 on 07/03/20
*/ */
@Module.Info(name = "OffhandGap", category = Module.Category.COMBAT, description = "Holds a God apple when right clicking your sword!") @Module.Info(name = "OffhandGap", category = Module.Category.COMBAT, description = "Holds a God apple when right clicking your sword!")
public class OffhandGap extends Module { public class OffhandGap extends Module {
@ -76,15 +77,12 @@ public class OffhandGap extends Module {
@Override @Override
public void onUpdate() { public void onUpdate() {
if (mc.player == null) return; if (mc.player == null) return;
/* If your health doesn't meet the cutoff then set it to true */ /* If your health doesn't meet the cutoff then set it to true */
cancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue(); cancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue();
if (cancelled) { disableGaps(); return; }
toUseItem = Items.GOLDEN_APPLE; toUseItem = Items.GOLDEN_APPLE;
if (cancelled) {
disableGaps();
return;
}
if (mc.player.getHeldItemOffhand().getItem() != Items.GOLDEN_APPLE) { if (mc.player.getHeldItemOffhand().getItem() != Items.GOLDEN_APPLE) {
for (int i = 0; i < 45; i++) { for (int i = 0; i < 45; i++) {
if (mc.player.inventory.getStackInSlot(i).getItem() == Items.GOLDEN_APPLE) { if (mc.player.inventory.getStackInSlot(i).getItem() == Items.GOLDEN_APPLE) {