This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
forked from Strangerrrs/Raven-bS
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds more feature to MiddleClick.java
- Loading branch information
1 parent
19d69ee
commit 0f29bf2
Showing
4 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/keystrokesmod/module/impl/client/MiddleClick.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package keystrokesmod.module.impl.client; | ||
|
||
import keystrokesmod.module.Module; | ||
import keystrokesmod.module.impl.world.AntiBot; | ||
import keystrokesmod.module.setting.impl.ModeSetting; | ||
import keystrokesmod.utility.Utils; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.item.ItemEnderPearl; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent; | ||
import org.lwjgl.input.Mouse; | ||
|
||
public class MiddleClick extends Module { | ||
int prevSlot; | ||
public static ModeSetting middleClick; | ||
private boolean hasClicked; | ||
private int pearlEvent; | ||
|
||
public MiddleClick() { | ||
super("MiddleClick", category.client, 0); | ||
this.registerSetting(middleClick = new ModeSetting("Middle Click", new String[]{"Toggle Friend", "Throw Pearl"}, 0)); | ||
} | ||
|
||
public void onEnable() { | ||
pearlEvent = 4; | ||
hasClicked = false; | ||
} | ||
|
||
@SubscribeEvent | ||
public void onTick(TickEvent.RenderTickEvent e) { | ||
if (!Utils.nullCheck()) | ||
return; | ||
if (pearlEvent < 4) { | ||
if (pearlEvent == 3) { | ||
mc.thePlayer.inventory.currentItem = prevSlot; | ||
} | ||
pearlEvent++; | ||
} | ||
if (Mouse.isButtonDown(2) && !hasClicked) { | ||
switch ((int) middleClick.getInput()) { | ||
case 0: { | ||
EntityLivingBase g = Utils.raytrace(30); | ||
if (g != null && !AntiBot.isBot(g) && !Utils.addFriend(g.getName())) { | ||
Utils.removeFriend(g.getName()); | ||
} | ||
break; | ||
} | ||
case 1: { | ||
for (int slot = 0; slot <= 8; slot++) { | ||
ItemStack itemInSlot = mc.thePlayer.inventory.getStackInSlot(slot); | ||
if (itemInSlot != null && itemInSlot.getItem() instanceof ItemEnderPearl) { | ||
prevSlot = mc.thePlayer.inventory.currentItem; | ||
mc.thePlayer.inventory.currentItem = slot; | ||
mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, itemInSlot); | ||
pearlEvent = 0; | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
hasClicked = true; | ||
} else if (!Mouse.isButtonDown(2) && hasClicked) { | ||
hasClicked = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters