Skip to content

Commit

Permalink
Enhance triggerbot
Browse files Browse the repository at this point in the history
  • Loading branch information
TangyKiwi committed Mar 10, 2024
1 parent db8eed1 commit 6ce94e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 49 deletions.
46 changes: 0 additions & 46 deletions src/main/java/com/tangykiwi/kiwiclient/KiwiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,55 +90,9 @@ public void onInitialize() {
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("kiwiclient:kiwitweaks"), "resourcepacks/kiwitweaks", modContainer, true);
});

// UseItemCallback.EVENT.register((player, world, hand) -> {
// MinecraftClient mc = MinecraftClient.getInstance();
// ClientPlayerInteractionManager interactionManager = mc.interactionManager;
// if (mc.mouse.wasRightButtonClicked() && moduleManager.getModule(ArmorSwap.class).isEnabled()) {
// ItemStack stack = player.getMainHandStack();
// int currentItemIndex = player.getInventory().main.indexOf(stack);
// EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(stack);
// int armorIndexSlot = determineIndex(equipmentSlot);
//
// if (hand == Hand.MAIN_HAND && armorIndexSlot != -1) {
// SoundEvent sound = determineSound(stack.getItem());
// player.playSound(sound, 1.0F, 1.0F);
// interactionManager.clickSlot(player.playerScreenHandler.syncId, armorIndexSlot, currentItemIndex, SlotActionType.SWAP, player);
// return TypedActionResult.success(stack);
// }
// }
// return TypedActionResult.pass(ItemStack.EMPTY);
// });

KeyBindingHelper.registerKeyBinding(zoomKey);
}

private static SoundEvent determineSound(Item item) {
String name = item.toString();
if(name.contains("turtle")) return SoundEvents.ITEM_ARMOR_EQUIP_TURTLE;
else if(name.contains("leather")) return SoundEvents.ITEM_ARMOR_EQUIP_LEATHER;
else if(name.contains("chain")) return SoundEvents.ITEM_ARMOR_EQUIP_CHAIN;
else if(name.contains("iron")) return SoundEvents.ITEM_ARMOR_EQUIP_IRON;
else if(name.contains("gold")) return SoundEvents.ITEM_ARMOR_EQUIP_GOLD;
else if(name.contains("diamond")) return SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND;
else if(name.contains("netherite")) return SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE;
else if(name.contains("elytra")) return SoundEvents.ITEM_ARMOR_EQUIP_ELYTRA;
return SoundEvents.ITEM_ARMOR_EQUIP_GENERIC;
}

private static int determineIndex(EquipmentSlot type) {
switch (type) {
case HEAD:
return 5;
case CHEST:
return 6;
case LEGS:
return 7;
case FEET:
return 8;
default:
return -1;
}
}

public static void startRPC() {
DiscordEventHandlers handlers = new DiscordEventHandlers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import com.tangykiwi.kiwiclient.event.TickEvent;
import com.tangykiwi.kiwiclient.modules.Category;
import com.tangykiwi.kiwiclient.modules.Module;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.EntityHitResult;
import org.lwjgl.glfw.GLFW;

public class TriggerBot extends Module {
Expand All @@ -22,12 +23,18 @@ public TriggerBot() {
public void onTick(TickEvent event)
{
ClientPlayerEntity player = mc.player;
if(!player.isAlive() || player.isSpectator()) return;

if(player.getAttackCooldownProgress(0) < 1)
return;

if(mc.crosshairTarget == null || !(mc.crosshairTarget instanceof EntityHitResult)) return;
if(mc.currentScreen instanceof HandledScreen)
return;

Entity target = mc.targetedEntity;
if(target == null) return;
if ((target instanceof LivingEntity && ((LivingEntity) target).isDead()) || !target.isAlive()) return;

Entity target = ((EntityHitResult) mc.crosshairTarget).getEntity();
if(KiwiClient.moduleManager.getModule(Criticals.class).isEnabled()) ((Criticals) KiwiClient.moduleManager.getModule(Criticals.class)).doCritical();
mc.interactionManager.attackEntity(player, target);
player.swingHand(Hand.MAIN_HAND);
Expand Down

0 comments on commit 6ce94e1

Please sign in to comment.