forked from RepoMirrors/kami-blue
add more options to fastuse and merge bowspam into it
This commit is contained in:
parent
f47f3f6681
commit
b4675101d5
|
@ -1,26 +0,0 @@
|
|||
package me.zeroeightsix.kami.module.modules.combat;
|
||||
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||
import net.minecraft.network.play.client.CPacketPlayerDigging.Action;
|
||||
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Code like this does not have an author, as it is literally one function. It's nothing unique.
|
||||
* This is just one thing. Anybody can write it the exact same way on accident.
|
||||
* There is nothing to credit here.
|
||||
* Updated by S-B99 on 28/01/20
|
||||
*/
|
||||
@Module.Info(name = "BowSpam", description = "Makes you spam arrows", category = Module.Category.COMBAT)
|
||||
public class BowSpam extends Module {
|
||||
|
||||
public void onUpdate() {
|
||||
if (mc.player.getHeldItemMainhand().getItem() instanceof ItemBow && mc.player.isHandActive() && mc.player.getItemInUseMaxCount() >= 3) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerDigging(Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.getHorizontalFacing()));
|
||||
mc.player.connection.sendPacket(new CPacketPlayerTryUseItem(mc.player.getActiveHand()));
|
||||
mc.player.stopActiveHand();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,9 +3,10 @@ package me.zeroeightsix.kami.module.modules.combat;
|
|||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemEndCrystal;
|
||||
import net.minecraft.item.ItemExpBottle;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Created by S-B99 on 23/10/2019
|
||||
|
@ -13,17 +14,17 @@ import net.minecraft.item.ItemExpBottle;
|
|||
* Updated by S-B99 on 03/12/19
|
||||
* Updated by d1gress/Qther on 4/12/19
|
||||
*/
|
||||
@Module.Info(category = Module.Category.COMBAT, description = "Changes delay when using items", name = "FastUse")
|
||||
@Module.Info(category = Module.Category.COMBAT, description = "Use items faster", name = "FastUse")
|
||||
public class Fastuse extends Module {
|
||||
|
||||
private Setting<Integer> delay = register(Settings.integerBuilder("Delay").withMinimum(0).withMaximum(20).withValue(0).build());
|
||||
private Setting<Mode> mode = register(Settings.e("Mode", Mode.BOTH));
|
||||
private Setting<Boolean> all = register(Settings.b("All", false));
|
||||
private Setting<Boolean> bow = register(Settings.booleanBuilder().withName("Bow").withValue(true).withVisibility(v -> !all.getValue()).build());
|
||||
private Setting<Boolean> expBottles = register(Settings.booleanBuilder().withName("Exp Bottles").withValue(true).withVisibility(v -> !all.getValue()).build());
|
||||
private Setting<Boolean> endCrystals = register(Settings.booleanBuilder().withName("End Crystals").withValue(true).withVisibility(v -> !all.getValue()).build());
|
||||
private Setting<Boolean> fireworks = register(Settings.booleanBuilder().withName("Fireworks").withValue(false).withVisibility(v -> !all.getValue()).build());
|
||||
private static long time = 0;
|
||||
|
||||
private enum Mode {
|
||||
ALL, BOTH, EXP, CRYSTAL
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
mc.rightClickDelayTimer = 4;
|
||||
|
@ -31,8 +32,16 @@ public class Fastuse extends Module {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (mc.player == null) return;
|
||||
|
||||
if (bow.getValue() && mc.player.getHeldItemMainhand().getItem() instanceof ItemBow && mc.player.isHandActive() && mc.player.getItemInUseMaxCount() >= 3) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.getHorizontalFacing()));
|
||||
mc.player.connection.sendPacket(new CPacketPlayerTryUseItem(mc.player.getActiveHand()));
|
||||
mc.player.stopActiveHand();
|
||||
}
|
||||
|
||||
if (!(delay.getValue() <= 0)) {
|
||||
if (time <= 0) time = (int) Math.round((2 * (Math.round((float) delay.getValue() / 2))));
|
||||
if (time <= 0) time = Math.round((2 * (Math.round((float) delay.getValue() / 2))));
|
||||
else {
|
||||
time--;
|
||||
mc.rightClickDelayTimer = 1;
|
||||
|
@ -40,29 +49,16 @@ public class Fastuse extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
if (mc.player == null) return;
|
||||
Item itemMain = mc.player.getHeldItemMainhand().getItem();
|
||||
Item itemOff = mc.player.getHeldItemOffhand().getItem();
|
||||
boolean doExpMain = itemMain instanceof ItemExpBottle;
|
||||
boolean doExpOff = itemOff instanceof ItemExpBottle;
|
||||
boolean doCrystalMain = itemMain instanceof ItemEndCrystal;
|
||||
boolean doCrystalOff = itemOff instanceof ItemEndCrystal;
|
||||
|
||||
switch (mode.getValue()) {
|
||||
case ALL:
|
||||
mc.rightClickDelayTimer = 0;
|
||||
case BOTH:
|
||||
if (doExpMain || doExpOff || doCrystalMain || doCrystalOff) {
|
||||
mc.rightClickDelayTimer = 0;
|
||||
}
|
||||
case EXP:
|
||||
if (doExpMain || doExpOff) {
|
||||
mc.rightClickDelayTimer = 0;
|
||||
}
|
||||
case CRYSTAL:
|
||||
if (doCrystalMain || doCrystalOff) {
|
||||
mc.rightClickDelayTimer = 0;
|
||||
}
|
||||
if (passItemCheck(mc.player.getActiveItemStack().getItem())) {
|
||||
mc.rightClickDelayTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean passItemCheck(Item item) {
|
||||
if (all.getValue()) return true;
|
||||
if (expBottles.getValue() && item instanceof ItemExpBottle) return true;
|
||||
if (endCrystals.getValue() && item instanceof ItemEndCrystal) return true;
|
||||
if (fireworks.getValue() && item instanceof ItemFirework) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue