make offhandgap way safer

This commit is contained in:
Bella 2020-03-07 14:57:04 -05:00
parent 3daf3dcb56
commit a344f516a8
No known key found for this signature in database
GPG Key ID: 03B01AC937D1C89C
1 changed files with 8 additions and 3 deletions

View File

@ -34,14 +34,14 @@ public class OffhandGap extends Module {
int gaps = -1;
boolean autoTotemWasEnabled = false;
boolean notCancelled = false;
boolean cancelled = false;
Item usedItem;
Item toUseItem;
@EventHandler
private Listener<PacketEvent.Send> sendListener = new Listener<>(e ->{
if (e.getPacket() instanceof CPacketPlayerTryUseItem) {
if (mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue()) {
if (cancelled) {
disableGaps();
return;
}
@ -77,9 +77,14 @@ public class OffhandGap extends Module {
public void onUpdate() {
if (mc.player == null) return;
/* If your health doesn't meet the cutoff then set it to true */
notCancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue();
cancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue();
toUseItem = Items.GOLDEN_APPLE;
if (cancelled) {
disableGaps();
return;
}
if (mc.player.getHeldItemOffhand().getItem() != Items.GOLDEN_APPLE) {
for (int i = 0; i < 45; i++) {
if (mc.player.inventory.getStackInSlot(i).getItem() == Items.GOLDEN_APPLE) {