forked from RepoMirrors/kami-blue
make offhandgap way safer
This commit is contained in:
parent
3daf3dcb56
commit
a344f516a8
|
@ -34,14 +34,14 @@ public class OffhandGap extends Module {
|
||||||
|
|
||||||
int gaps = -1;
|
int gaps = -1;
|
||||||
boolean autoTotemWasEnabled = false;
|
boolean autoTotemWasEnabled = false;
|
||||||
boolean notCancelled = false;
|
boolean cancelled = false;
|
||||||
Item usedItem;
|
Item usedItem;
|
||||||
Item toUseItem;
|
Item toUseItem;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private Listener<PacketEvent.Send> sendListener = new Listener<>(e ->{
|
private Listener<PacketEvent.Send> sendListener = new Listener<>(e ->{
|
||||||
if (e.getPacket() instanceof CPacketPlayerTryUseItem) {
|
if (e.getPacket() instanceof CPacketPlayerTryUseItem) {
|
||||||
if (mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue()) {
|
if (cancelled) {
|
||||||
disableGaps();
|
disableGaps();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,14 @@ public class OffhandGap extends Module {
|
||||||
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 */
|
||||||
notCancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue();
|
cancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue();
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue