diff options
Diffstat (limited to 'src/main/java')
13 files changed, 493 insertions, 36 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index 0047b65..77efa64 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -45,6 +45,10 @@ public class Config extends Vigilant { category = "RoseGoldAddons", subcategory = "General", min = 0, max = 100) public int macroRadius = 0; + @Property(type = PropertyType.SLIDER, name = "Monkey Pet Level", description = "Level of your legendary monkey, needed to maximize foraging macro efficiency", + category = "RoseGoldAddons", subcategory = "General", min = 1, max = 100) + public int monkeyLevel = 0; + public Config() { super(new File("./config/rosegoldaddons/config.toml"), "RoseGold Addons"); initialize(); diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index 9c2a338..7a134de 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -3,9 +3,13 @@ package rosegoldaddons; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.event.ClickEvent; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.Timer; import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -18,15 +22,18 @@ import org.lwjgl.input.Keyboard; import rosegoldaddons.commands.*; import rosegoldaddons.features.BlockBreakAura; import rosegoldaddons.features.*; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.OpenSkyblockGui; +import tv.twitch.chat.Chat; import java.io.*; +import java.util.TimerTask; @Mod(modid = "timechanger", name = "RoseGold Addons", version = "2.1") public class Main { public static GuiScreen display = null; public static Config configFile = Config.INSTANCE; - public static KeyBinding[] keyBinds = new KeyBinding[11]; + public static KeyBinding[] keyBinds = new KeyBinding[14]; public static int tickCount = 0; public static boolean endermanMacro = false; public static boolean powderMacro = false; @@ -40,6 +47,11 @@ public class Main { public static boolean wartToggle = false; public static boolean autoUseItems = false; public static boolean autoHardStone = false; + public static boolean forageOnIsland = false; + public static boolean cheat = false; + public static boolean necronAimbot = false; + public static boolean bloodTriggerBot = false; + private static boolean initMessage = false; @Mod.EventHandler public void onFMLInitialization(FMLPreInitializationEvent event) { @@ -64,7 +76,9 @@ public class Main { MinecraftForge.EVENT_BUS.register(new WartMacro()); MinecraftForge.EVENT_BUS.register(new CustomItemMacro()); MinecraftForge.EVENT_BUS.register(new HardstoneMacro()); - + MinecraftForge.EVENT_BUS.register(new ForagingIslandMacro()); + MinecraftForge.EVENT_BUS.register(new NecronAimbot()); + MinecraftForge.EVENT_BUS.register(new BloodTriggerBot()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -84,6 +98,9 @@ public class Main { keyBinds[8] = new KeyBinding("Gemstone Smart Nuke", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[9] = new KeyBinding("Wart Macro", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[10] = new KeyBinding("Hardstone Macro", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[11] = new KeyBinding("Foraging Island Macro", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[12] = new KeyBinding("Necron Aimbot Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[13] = new KeyBinding("Blood Room Tiggerbot Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); @@ -91,6 +108,27 @@ public class Main { } @SubscribeEvent + public void onConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + new Thread(() -> { + try { + Thread.sleep(4000); + ChatComponentText msg1 = new ChatComponentText("§0§7Thanks to ShadyAddons:§b https://cheatersgetbanned.me"); + msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://cheatersgetbanned.me")); + ChatComponentText msg2 = new ChatComponentText("§0§7Thanks to Harry282 (SBClient):§b https://github.com/Harry282/Skyblock-Client"); + msg2.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/Harry282/Skyblock-Client")); + ChatComponentText msg3 = new ChatComponentText("RoseGoldAddons Github for updates:§b https://github.com/RoseGoldIsntGay/RoseGoldAddons"); + msg3.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/RoseGoldIsntGay/RoseGoldAddons")); + ChatUtils.sendMessage("§0§7Thanks to pizza boy (Pizza Client)"); + Minecraft.getMinecraft().thePlayer.addChatMessage(msg1); + Minecraft.getMinecraft().thePlayer.addChatMessage(msg2); + Minecraft.getMinecraft().thePlayer.addChatMessage(msg3); + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } + + @SubscribeEvent public void tick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.START) return; if (display != null) { @@ -104,55 +142,62 @@ public class Main { } @SubscribeEvent - public void connect(FMLNetworkEvent.ClientConnectedToServerEvent event) { - - } - - @SubscribeEvent public void key(InputEvent.KeyInputEvent event) { if (keyBinds[0].isPressed()) { autoUseItems = !autoUseItems; String str = autoUseItems ? "§aCustom Item Macro Activated" : "§cCustom Item Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + ChatUtils.sendMessage(str); } else if (keyBinds[1].isPressed()) { endermanMacro = !endermanMacro; String str = endermanMacro ? "§aZealot Macro Activated" : "§cZealot Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + ChatUtils.sendMessage(str); } else if (keyBinds[2].isPressed()) { ItemFrameAura.mainAura(); } else if (keyBinds[3].isPressed()) { powderMacro = !powderMacro; String str = powderMacro ? "§aPowder Macro Activated" : "§cPowder Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + ChatUtils.sendMessage(str); } else if (keyBinds[4].isPressed()) { AOTSMacro = !AOTSMacro; String str = AOTSMacro ? "§aAOTS Macro Activated" : "§cAOTS Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + ChatUtils.sendMessage(str); } else if (keyBinds[5].isPressed()) { SoulWhipMacro = !SoulWhipMacro; String str = SoulWhipMacro ? "§aSoul Whip Macro Activated" : "§cSoul Whip Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); - } else if(keyBinds[6].isPressed()) { + ChatUtils.sendMessage(str); + } else if (keyBinds[6].isPressed()) { GhostMacro = !GhostMacro; String str = GhostMacro ? "§aGhost Macro Activated" : "§cGhost Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); - } else if(keyBinds[7].isPressed()) { + ChatUtils.sendMessage(str); + } else if (keyBinds[7].isPressed()) { legitToggle = !legitToggle; String str = legitToggle ? "§aLegit Mode Activated" : "§cLegit Mode Deactivated"; SwordSwapping.tickCount = 0; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); - } else if(keyBinds[8].isPressed()) { + ChatUtils.sendMessage(str); + } else if (keyBinds[8].isPressed()) { gemNukeToggle = !gemNukeToggle; String str = gemNukeToggle ? "§aGemstone Nuke Activated" : "§cGemstone Nuke Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); - } else if(keyBinds[9].isPressed()) { + ChatUtils.sendMessage(str); + } else if (keyBinds[9].isPressed()) { wartToggle = !wartToggle; String str = wartToggle ? "§aWart Macro Activated" : "§cWart Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); - } else if(keyBinds[10].isPressed()) { + ChatUtils.sendMessage(str); + } else if (keyBinds[10].isPressed()) { autoHardStone = !autoHardStone; String str = autoHardStone ? "§aHardstone Macro Activated" : "§cHardstone Macro Deactivated"; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + ChatUtils.sendMessage(str); + } else if (keyBinds[11].isPressed()) { + forageOnIsland = !forageOnIsland; + String str = forageOnIsland ? "§aForaging Macro Activated" : "§cForaging Macro Deactivated"; + ChatUtils.sendMessage(str); + } else if (keyBinds[12].isPressed()) { + necronAimbot = !necronAimbot; + String str = necronAimbot ? "§aNecron Aimbot Activated" : "§cNecron Aimbot Deactivated"; + ChatUtils.sendMessage(str); + } else if (keyBinds[13].isPressed()) { + bloodTriggerBot = !bloodTriggerBot; + String str = bloodTriggerBot ? "§aBlood Room Triggerbot Activated" : "§cBlood Room Triggerbot Deactivated"; + ChatUtils.sendMessage(str); } } diff --git a/src/main/java/rosegoldaddons/commands/Backpack.java b/src/main/java/rosegoldaddons/commands/Backpack.java index f69cd87..24b7563 100644 --- a/src/main/java/rosegoldaddons/commands/Backpack.java +++ b/src/main/java/rosegoldaddons/commands/Backpack.java @@ -16,6 +16,7 @@ import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; import java.util.Arrays; @@ -50,7 +51,7 @@ public class Backpack implements ICommand { openBP = true; bpSlot = Integer.parseInt(args[0]); } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments.")); + ChatUtils.sendMessage("§cInvalid Arguments."); return; } } diff --git a/src/main/java/rosegoldaddons/commands/Rosedrobe.java b/src/main/java/rosegoldaddons/commands/Rosedrobe.java index 1f7fd62..d05c6be 100644 --- a/src/main/java/rosegoldaddons/commands/Rosedrobe.java +++ b/src/main/java/rosegoldaddons/commands/Rosedrobe.java @@ -16,6 +16,7 @@ import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; import scala.actors.threadpool.Arrays; import java.util.ArrayList; @@ -53,7 +54,7 @@ public class Rosedrobe implements ICommand { openWardrobe = true; slot = Integer.parseInt(args[0]); } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments.")); + ChatUtils.sendMessage("§cInvalid Arguments."); return; } } diff --git a/src/main/java/rosegoldaddons/commands/UseCooldown.java b/src/main/java/rosegoldaddons/commands/UseCooldown.java index 912c75a..45d78b0 100644 --- a/src/main/java/rosegoldaddons/commands/UseCooldown.java +++ b/src/main/java/rosegoldaddons/commands/UseCooldown.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; import java.util.HashMap; @@ -42,20 +43,20 @@ public class UseCooldown implements ICommand { int cd = Integer.parseInt(args[0]); if (cd == 0) { items.remove(curStack.getDisplayName()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§aSuccessfully Removed " + curStack.getDisplayName() + "§a.")); + ChatUtils.sendMessage("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."); return; } if (cd < 1) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Miliseconds, Minimum delay 1 Milisecond.")); + ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 1 Milisecond."); return; } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§aSuccessfully Added " + curStack.getDisplayName() + "§a with delay of " + cd + " ms.")); + ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a with delay of " + cd + " ms."); items.put(curStack.getDisplayName(), cd); } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cError getting current held item.")); + ChatUtils.sendMessage("§cError getting current held item."); } } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments.")); + ChatUtils.sendMessage("§cInvalid Arguments."); } } diff --git a/src/main/java/rosegoldaddons/commands/WartSetup.java b/src/main/java/rosegoldaddons/commands/WartSetup.java index a5cca13..a143349 100644 --- a/src/main/java/rosegoldaddons/commands/WartSetup.java +++ b/src/main/java/rosegoldaddons/commands/WartSetup.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; import java.util.List; @@ -47,7 +48,7 @@ public class WartSetup implements ICommand { wartEnd = (int) Math.floor(Double.parseDouble(args[1])); } } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments.")); + ChatUtils.sendMessage("§cInvalid Arguments."); } } diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java new file mode 100644 index 0000000..88ce213 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -0,0 +1,94 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.entity.Entity; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.RotationUtils; + +import java.awt.*; +import java.lang.reflect.Method; +import java.util.ArrayList; + +public class BloodTriggerBot { + private static String[] names = {"Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul"}; + private static ArrayList<Entity> bloodMobs = null; + private Thread thread; + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.bloodTriggerBot) return; + bloodMobs = getAllBloodMobs(); + if (thread == null || !thread.isAlive()) { + thread = new Thread(() -> { + try { + for (Entity entity : bloodMobs) { + if (isLookingAtBloodMob(entity.getEntityBoundingBox(), event)) { + click(); + Thread.sleep(100); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + }, "Blood room thingy"); + thread.start(); + } + } + + private static boolean isLookingAtBloodMob(AxisAlignedBB aabb, RenderWorldLastEvent event) { + Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); + Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); + for (int i = 0; i < 30; i++) { + if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { + return true; + } + position = position.add(look); + } + + return false; + } + + private static ArrayList<Entity> getAllBloodMobs() { + ArrayList<Entity> bloodMobs = new ArrayList<>(); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityOtherPlayerMP && !entity1.isDead) { + for (String name : names) { + if (entity1.getName().contains(name)) { + bloodMobs.add(entity1); + } + } + } + if (entity1 instanceof EntityWither) { + bloodMobs.add(entity1); + } + } + return bloodMobs; + } + + public static void click() { + try { + Method clickMouse; + try { + clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); + } catch (NoSuchMethodException e) { + clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); + } + clickMouse.setAccessible(true); + clickMouse.invoke(Minecraft.getMinecraft()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java new file mode 100644 index 0000000..3dc301e --- /dev/null +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -0,0 +1,218 @@ +package rosegoldaddons.features; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.RotationUtils; + +import java.awt.*; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Random; + +public class ForagingIslandMacro { + private Thread thread; + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (Main.forageOnIsland) { + if (thread == null || !thread.isAlive()) { + thread = new Thread(() -> { + try { + BlockPos furthestDirt = furthestEmptyDirt(); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); + int sapling = findItemInHotbar("Jungle Sapling"); + int bonemeal = findItemInHotbar("Bone Meal"); + int treecap = findItemInHotbar("Treecapitator"); + int rod = findItemInHotbar("Rod"); + if(sapling == -1) { + ChatUtils.sendMessage("§cNo jungle saplings in hotbar"); + } + if(bonemeal == -1) { + ChatUtils.sendMessage("§cNo bonemeal in hotbar"); + } + if(treecap == -1) { + ChatUtils.sendMessage("§cNo Treecapitator in hotbar"); + } + if(rod == -1) { + ChatUtils.sendMessage("§cNo Fishing Rod in hotbar"); + } + if(sapling == -1 || bonemeal == -1 || treecap == -1 || rod == -1) { + Main.forageOnIsland = false; + ChatUtils.sendMessage("§cForaging Macro Deactivated"); + return; + } + if (furthestDirt != null) { + RotationUtils.facePos(new Vec3(furthestDirt.getX() + 0.5, furthestDirt.getY() - 0.5, furthestDirt.getZ() + 0.5)); + Thread.sleep(Main.configFile.smoothLookVelocity * 2L); + if (sapling != -1) { + if (Minecraft.getMinecraft().objectMouseOver.typeOfHit.toString().equals("BLOCK")) { + BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); + Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); + if (block == Blocks.sapling) { + click(); + Thread.sleep(20); + } + } + Minecraft.getMinecraft().thePlayer.inventory.currentItem = sapling; + //Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), furthestDirt, EnumFacing.NORTH, Minecraft.getMinecraft().objectMouseOver.hitVec); + rightClick(); + } + } else { + BlockPos dirt = closestDirt(); + if (dirt != null) { + RotationUtils.facePos(new Vec3(dirt.getX() + 0.5, dirt.getY(), dirt.getZ() + 0.5)); + if (bonemeal != -1 && treecap != -1) { + Minecraft.getMinecraft().thePlayer.inventory.currentItem = bonemeal; + Thread.sleep(200); + rightClick(); + rightClick(); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = treecap; + Thread.sleep(150); + KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); + Thread.sleep(100); + KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); + Thread.sleep(25); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = rod; + Thread.sleep(200); + rightClick(); + Thread.sleep((2000 - Main.configFile.monkeyLevel * 10L)); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + }, "Island Foraging Macro"); + thread.start(); + } + } + } + + @SubscribeEvent + public void renderWorld2(RenderWorldLastEvent event) { + if (!Main.forageOnIsland) return; + BlockPos furthestDirt = furthestEmptyDirt(); + if (furthestDirt != null) { + RenderUtils.drawBlockBox(furthestDirt, Color.RED, true, event.partialTicks); + } + } + + private BlockPos furthestEmptyDirt() { + int r = 5; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> dirts = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { + dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double biggest = -1; + Vec3 furthest = null; + for (int i = 0; i < dirts.size(); i++) { + double dist = dirts.get(i).distanceTo(playerVec); + if (dist > biggest) { + biggest = dist; + furthest = dirts.get(i); + } + } + if (furthest != null && biggest < 4) { + return new BlockPos(furthest.xCoord, furthest.yCoord, furthest.zCoord); + } + return null; + } + + private BlockPos closestDirt() { + int r = 5; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> dirts = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + if (blockState.getBlock() == Blocks.dirt) { + dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < dirts.size(); i++) { + double dist = dirts.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = dirts.get(i); + } + } + if (closest != null && smallest < 4) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private static int findItemInHotbar(String name) { + InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + for (int i = 0; i < 9; i++) { + ItemStack curStack = inv.getStackInSlot(i); + if (curStack != null) { + if (curStack.getDisplayName().contains(name)) { + return i; + } + } + } + return -1; + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Minecraft.getMinecraft()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void click() { + try { + Method clickMouse; + try { + clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); + } catch (NoSuchMethodException e) { + clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); + } + clickMouse.setAccessible(true); + clickMouse.invoke(Minecraft.getMinecraft()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/rosegoldaddons/features/ItemFrameAura.java b/src/main/java/rosegoldaddons/features/ItemFrameAura.java index 0e7426f..973bd39 100644 --- a/src/main/java/rosegoldaddons/features/ItemFrameAura.java +++ b/src/main/java/rosegoldaddons/features/ItemFrameAura.java @@ -14,6 +14,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; import java.lang.reflect.Method; import java.util.ArrayList; @@ -79,7 +80,7 @@ public class ItemFrameAura { currRotationAmount = currRotationAmount - 8; toClick = endRotationAmount - currRotationAmount; } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("" + toClick)); + ChatUtils.sendMessage("" + toClick); for (int i = 0; i < toClick; i++) { //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("clicked")); rightClick(); @@ -131,7 +132,7 @@ public class ItemFrameAura { }); String patternName = getPattern(redWools, greenWools, topLeft); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(patternName)); + ChatUtils.sendMessage(patternName); clickPatternAura(patternName, topLeft); } diff --git a/src/main/java/rosegoldaddons/features/NecronAimbot.java b/src/main/java/rosegoldaddons/features/NecronAimbot.java new file mode 100644 index 0000000..59e1493 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/NecronAimbot.java @@ -0,0 +1,40 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.RotationUtils; + +import java.awt.*; +import java.util.Random; + +public class NecronAimbot { + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.necronAimbot) return; + Entity necron = getClosestWither(); + if (necron == null) return; + RenderUtils.drawEntityBox(necron, Color.RED, true, event.partialTicks); + RotationUtils.faceEntity(necron); + } + + private static Entity getClosestWither() { + Entity necron = null; + Double closest = Double.valueOf(9999); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityWither && !(((EntityWither) entity1).getHealth() == 0)) { + double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + if (dist < closest) { + closest = dist; + necron = entity1; + } + } + } + return necron; + } +} diff --git a/src/main/java/rosegoldaddons/features/WartMacro.java b/src/main/java/rosegoldaddons/features/WartMacro.java index 8b47fcb..b96f25b 100644 --- a/src/main/java/rosegoldaddons/features/WartMacro.java +++ b/src/main/java/rosegoldaddons/features/WartMacro.java @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.commands.WartSetup; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import java.awt.*; @@ -124,7 +125,7 @@ public class WartMacro { double xdiff = Math.abs(savex - Minecraft.getMinecraft().thePlayer.posX); double zdiff = Math.abs(savez - Minecraft.getMinecraft().thePlayer.posZ); if(xdiff < 2 && zdiff < 2) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("stuck detected.")); + ChatUtils.sendMessage("stuck detected."); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), true); Thread.sleep(500); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), false); diff --git a/src/main/java/rosegoldaddons/utils/ChatUtils.java b/src/main/java/rosegoldaddons/utils/ChatUtils.java new file mode 100644 index 0000000..4295c77 --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/ChatUtils.java @@ -0,0 +1,30 @@ +package rosegoldaddons.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import org.jetbrains.annotations.NotNull; + +import java.util.Iterator; +import java.util.List; + + +public class ChatUtils { + + /* § */ + + public static void sendMessage(String message) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] "+message)); + } + + public static ChatStyle createClickStyle(ClickEvent.Action action, String value) { + ChatStyle style = new ChatStyle(); + style.setChatClickEvent(new ClickEvent(action, value)); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (IChatComponent)new ChatComponentText(EnumChatFormatting.YELLOW + value))); + return style; + } +} diff --git a/src/main/java/rosegoldaddons/utils/RotationUtils.java b/src/main/java/rosegoldaddons/utils/RotationUtils.java index fb4152a..bb899e5 100644 --- a/src/main/java/rosegoldaddons/utils/RotationUtils.java +++ b/src/main/java/rosegoldaddons/utils/RotationUtils.java @@ -1,6 +1,8 @@ package rosegoldaddons.utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; @@ -17,7 +19,13 @@ public class RotationUtils { static boolean antiafking = false; public static void antiAfk() { - if(snek || Minecraft.getMinecraft().currentScreen != null) return; + if(Minecraft.getMinecraft().currentScreen != null) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) {} + else { + return; + } + } + if(snek) return; KeyBinding right = Minecraft.getMinecraft().gameSettings.keyBindRight; KeyBinding left = Minecraft.getMinecraft().gameSettings.keyBindLeft; new Thread(() -> { @@ -36,7 +44,13 @@ public class RotationUtils { } public static void shootEman() { - if(snek || Minecraft.getMinecraft().currentScreen != null) return; + if(Minecraft.getMinecraft().currentScreen != null) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) {} + else { + return; + } + } + if(snek) return; new Thread(() -> { try { snek = true; @@ -55,7 +69,13 @@ public class RotationUtils { } public static void facePos(Vec3 vector) { - if(working || Minecraft.getMinecraft().currentScreen != null) return; + if(Minecraft.getMinecraft().currentScreen != null) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) {} + else { + return; + } + } + if(working) return; new Thread(() -> { try { working = true; |