From 19de3c3ee0582f25d8e127492d791f81a410b70a Mon Sep 17 00:00:00 2001 From: RoseGoldIsntGay Date: Mon, 22 Nov 2021 09:12:31 +0200 Subject: 2.3.0 --- src/main/java/rosegoldaddons/Config.java | 70 +++- src/main/java/rosegoldaddons/Main.java | 136 ++++--- .../java/rosegoldaddons/commands/AllEntities.java | 67 ++++ .../java/rosegoldaddons/commands/Rosedrobe.java | 1 - src/main/java/rosegoldaddons/commands/Rosepet.java | 65 ++++ .../java/rosegoldaddons/commands/UseCooldown.java | 105 +++++- .../java/rosegoldaddons/commands/WartSetup.java | 83 ----- .../java/rosegoldaddons/events/ClickEvent.java | 20 + .../rosegoldaddons/features/AutoArrowAlign.java | 333 +++++++++++++++++ .../rosegoldaddons/features/BlockBreakAura.java | 2 +- .../rosegoldaddons/features/BloodTriggerBot.java | 13 +- .../rosegoldaddons/features/CustomItemMacro.java | 31 +- .../java/rosegoldaddons/features/EntityReach.java | 125 +++++++ .../features/ForagingIslandMacro.java | 45 ++- .../rosegoldaddons/features/ItemFrameAura.java | 414 --------------------- .../java/rosegoldaddons/features/WartMacro.java | 147 -------- .../java/rosegoldaddons/mixins/MixinMinecraft.java | 27 ++ .../java/rosegoldaddons/utils/OpenSkyblockGui.java | 47 ++- .../java/rosegoldaddons/utils/RenderUtils.java | 13 + 19 files changed, 1012 insertions(+), 732 deletions(-) create mode 100644 src/main/java/rosegoldaddons/commands/AllEntities.java create mode 100644 src/main/java/rosegoldaddons/commands/Rosepet.java delete mode 100644 src/main/java/rosegoldaddons/commands/WartSetup.java create mode 100644 src/main/java/rosegoldaddons/events/ClickEvent.java create mode 100644 src/main/java/rosegoldaddons/features/AutoArrowAlign.java create mode 100644 src/main/java/rosegoldaddons/features/EntityReach.java delete mode 100644 src/main/java/rosegoldaddons/features/ItemFrameAura.java delete mode 100644 src/main/java/rosegoldaddons/features/WartMacro.java create mode 100644 src/main/java/rosegoldaddons/mixins/MixinMinecraft.java (limited to 'src/main/java') diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index 77efa64..964ae57 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -1,22 +1,26 @@ package rosegoldaddons; import gg.essential.vigilance.Vigilant; -import gg.essential.vigilance.data.Property; -import gg.essential.vigilance.data.PropertyType; +import gg.essential.vigilance.data.*; +import org.jetbrains.annotations.NotNull; -import java.awt.*; import java.io.File; -import java.util.Arrays; +import java.util.Comparator; -import java.io.File; public class Config extends Vigilant { public static Config INSTANCE = new Config(); @Property(type = PropertyType.SWITCH, name = "Auto Start Dungeon + Ready", description = "Automatically starts the dungeon and gets ready.", - category = "RoseGoldAddons", subcategory = "General") + category = "Dungeons", subcategory = "General") public boolean AutoReady = true; + public boolean autoArrowAlign = true; + + @Property(type = PropertyType.SLIDER, name = "Auto Arrow Align Delay", description = "How often to click an item frame (in miliseconds)", + category = "Dungeons", subcategory = "General", max = 500) + public int autoArrowAlignDelay = 10; + @Property(type = PropertyType.SWITCH, name = "Party Untransfer", description = "When you really dont wanna be party leader.", category = "RoseGoldAddons", subcategory = "General") public boolean AutoUntransfer = true; @@ -29,28 +33,64 @@ public class Config extends Vigilant { category = "RoseGoldAddons", subcategory = "General") public boolean UseUtility = false; + @Property(type = PropertyType.SWITCH, name = "Entity Reach", description = "Interact with entities from far away", + category = "RoseGoldAddons", subcategory = "General") + public boolean entityReach = false; + + @Property(type = PropertyType.SWITCH, name = "Entity Reach Sticky Mode", description = "Remember last entity looked at", + category = "RoseGoldAddons", subcategory = "General") + public boolean sticky = false; + @Property(type = PropertyType.SLIDER, name = "Sword Swap Delay", description = "How often to swap swords (in miliseconds)", category = "RoseGoldAddons", subcategory = "General", max = 2000) public int swapFrequency = 500; - @Property(type = PropertyType.SLIDER, name = "ItemFrame Terminal Aura Delay", description = "How often to click an item frame (in miliseconds)", - category = "RoseGoldAddons", subcategory = "General", max = 500) - public int auraDelay = 10; - @Property(type = PropertyType.SLIDER, name = "Smooth Look Velocity", description = "How fast should head rotation changes be (in miliseconds)", category = "RoseGoldAddons", subcategory = "General", min = 1, max = 200) public int smoothLookVelocity = 50; @Property(type = PropertyType.SLIDER, name = "Macro Range", description = "Look for entities only in radius of the player, 0 = unlimited", - category = "RoseGoldAddons", subcategory = "General", min = 0, max = 100) + category = "RoseGoldAddons", subcategory = "General", 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; + @Property(type = PropertyType.SLIDER, name = "Delay Before Breaking Tree", description = "Miliseconds to wait before breaking tree", + category = "Foraging", subcategory = "General", max = 2000) + public int treecapDelay = 1000; + + @Property(type = PropertyType.SLIDER, name = "Delay Before Using Rod", description = "Miliseconds to wait before using rod", + category = "Foraging", subcategory = "General", max = 500) + public int prerodDelay = 150; + + @Property(type = PropertyType.SLIDER, name = "Delay After Using Rod", description = "Miliseconds to wait after using rod (before starting over)", + category = "Foraging", subcategory = "General", max = 500) + public int postrodDelay = 150; + + @Property(type = PropertyType.SWITCH, name = "Radomize Delay", description = "Add slight randomization to delay", + category = "Foraging", subcategory = "General") + public boolean randomizeForaging = true; + + @Property(type = PropertyType.SWITCH, name = "Admin Antisus", description = "Act as if you're there when you get AFK checked (not recommended to leave on)", + category = "Foraging", subcategory = "General") + public boolean forageantisus = false; public Config() { - super(new File("./config/rosegoldaddons/config.toml"), "RoseGold Addons"); + super(new File("./config/rosegoldaddons/config.toml"), "RoseGold Addons", new JVMAnnotationPropertyCollector(), new ConfigSorting()); initialize(); } + + public static class ConfigSorting extends SortingBehavior { + @NotNull + @Override + public Comparator getCategoryComparator() { + return (o1, o2) -> { + if(o1.getName().equals("RoseGoldAddons")) { + return -1; + } else if(o2.getName().equals("RoseGoldAddons")) { + return 1; + } else { + return o1.getName().compareTo(o2.getName()); + } + }; + } + } } diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index 7a134de..c440d9b 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -5,9 +5,7 @@ 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; @@ -24,16 +22,17 @@ 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; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; @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[14]; + public static KeyBinding[] keyBinds = new KeyBinding[13]; public static int tickCount = 0; public static boolean endermanMacro = false; public static boolean powderMacro = false; @@ -42,7 +41,6 @@ public class Main { public static boolean SoulWhipMacro = false; public static boolean verified = false; public static boolean GhostMacro = false; - public static boolean legitToggle = false; public static boolean gemNukeToggle = false; public static boolean wartToggle = false; public static boolean autoUseItems = false; @@ -52,6 +50,7 @@ public class Main { public static boolean necronAimbot = false; public static boolean bloodTriggerBot = false; private static boolean initMessage = false; + private static boolean firstLoginThisSession = true; @Mod.EventHandler public void onFMLInitialization(FMLPreInitializationEvent event) { @@ -67,40 +66,79 @@ public class Main { MinecraftForge.EVENT_BUS.register(new AutoReady()); MinecraftForge.EVENT_BUS.register(new OpenSkyblockGui()); MinecraftForge.EVENT_BUS.register(new EndermanMacro()); - MinecraftForge.EVENT_BUS.register(new ItemFrameAura()); + MinecraftForge.EVENT_BUS.register(new AutoArrowAlign()); MinecraftForge.EVENT_BUS.register(new PowderMacro()); MinecraftForge.EVENT_BUS.register(new SwordSwapping()); MinecraftForge.EVENT_BUS.register(new PartyUntransfer()); MinecraftForge.EVENT_BUS.register(new GhostMacro()); MinecraftForge.EVENT_BUS.register(new BlockBreakAura()); - 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()); + MinecraftForge.EVENT_BUS.register(new EntityReach()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); ClientCommandHandler.instance.registerCommand(new LobbySwap()); ClientCommandHandler.instance.registerCommand(new Backpack()); - ClientCommandHandler.instance.registerCommand(new WartSetup()); ClientCommandHandler.instance.registerCommand(new UseCooldown()); + ClientCommandHandler.instance.registerCommand(new Rosepet()); + ClientCommandHandler.instance.registerCommand(new AllEntities()); + + try { + Reader reader = Files.newBufferedReader(Paths.get("./config/rosegoldaddons/rcmacros.json")); + int data = reader.read(); + String str = ""; + while(data != -1) { + str += (char) data; + data = reader.read(); + } + str = str.replace("\"",""); + str = str.replace("{",""); + str = str.replace("}",""); + String[] arr = str.split(","); + for(int i = 0; i < arr.length; i++) { + String[] arr2 = arr[i].split(":"); + System.out.println(arr2[0]+" "+arr2[1]); + UseCooldown.RCitems.put(arr2[0], Integer.parseInt(arr2[1])); + } + reader.close(); + Reader reader2 = Files.newBufferedReader(Paths.get("./config/rosegoldaddons/lcmacros.json")); + int data2 = reader2.read(); + String str2 = ""; + while(data2 != -1) { + str2 += (char) data2; + data2 = reader.read(); + } + str2 = str2.replace("\"",""); + str2 = str2.replace("{",""); + str2 = str2.replace("}",""); + String[] arr3 = str2.split(","); + for(int i = 0; i < arr3.length; i++) { + String[] arr4 = arr3[i].split(":"); + System.out.println(arr4[0]+" "+arr4[1]); + UseCooldown.LCitems.put(arr4[0], Integer.parseInt(arr4[1])); + } + reader2.close(); + } catch (Exception e) { + e.printStackTrace(); + } keyBinds[0] = new KeyBinding("Custom Item Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[1] = new KeyBinding("Toggle Enderman Macro", Keyboard.KEY_NONE, "RoseGold Addons"); - keyBinds[2] = new KeyBinding("Item Frame Aura", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[2] = new KeyBinding("Arrow Align Aura", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[3] = new KeyBinding("Powder Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[4] = new KeyBinding("AOTS SS Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[5] = new KeyBinding("Soul Whip SS Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); keyBinds[6] = new KeyBinding("Ghost Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); - keyBinds[7] = new KeyBinding("Item Frame Legit Mode Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); - 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"); + keyBinds[7] = new KeyBinding("Gemstone Smart Nuke", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[8] = new KeyBinding("Wart Macro", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[9] = new KeyBinding("Hardstone Macro", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[10] = new KeyBinding("Foraging Island Macro", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[11] = new KeyBinding("Necron Aimbot Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); + keyBinds[12] = new KeyBinding("Blood Room Tiggerbot Toggle", Keyboard.KEY_NONE, "RoseGold Addons"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); @@ -109,23 +147,34 @@ 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(); + if(firstLoginThisSession) { + 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("§0§7RoseGoldAddons 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); + firstLoginThisSession = false; + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Unload event) { + if(forageOnIsland) { + ChatUtils.sendMessage("§cDetected World Change, Stopping All Macros"); + forageOnIsland = false; + } } @SubscribeEvent @@ -152,7 +201,7 @@ public class Main { String str = endermanMacro ? "§aZealot Macro Activated" : "§cZealot Macro Deactivated"; ChatUtils.sendMessage(str); } else if (keyBinds[2].isPressed()) { - ItemFrameAura.mainAura(); + AutoArrowAlign.cheat(); } else if (keyBinds[3].isPressed()) { powderMacro = !powderMacro; String str = powderMacro ? "§aPowder Macro Activated" : "§cPowder Macro Deactivated"; @@ -170,31 +219,26 @@ public class Main { String str = GhostMacro ? "§aGhost Macro Activated" : "§cGhost Macro Deactivated"; ChatUtils.sendMessage(str); } else if (keyBinds[7].isPressed()) { - legitToggle = !legitToggle; - String str = legitToggle ? "§aLegit Mode Activated" : "§cLegit Mode Deactivated"; - SwordSwapping.tickCount = 0; - ChatUtils.sendMessage(str); - } else if (keyBinds[8].isPressed()) { gemNukeToggle = !gemNukeToggle; String str = gemNukeToggle ? "§aGemstone Nuke Activated" : "§cGemstone Nuke Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[9].isPressed()) { + } else if (keyBinds[8].isPressed()) { wartToggle = !wartToggle; - String str = wartToggle ? "§aWart Macro Activated" : "§cWart Macro Deactivated"; + String str = wartToggle ? "§aNothing Activated" : "§cNothing Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[10].isPressed()) { + } else if (keyBinds[9].isPressed()) { autoHardStone = !autoHardStone; String str = autoHardStone ? "§aHardstone Macro Activated" : "§cHardstone Macro Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[11].isPressed()) { + } else if (keyBinds[10].isPressed()) { forageOnIsland = !forageOnIsland; String str = forageOnIsland ? "§aForaging Macro Activated" : "§cForaging Macro Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[12].isPressed()) { + } else if (keyBinds[11].isPressed()) { necronAimbot = !necronAimbot; String str = necronAimbot ? "§aNecron Aimbot Activated" : "§cNecron Aimbot Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[13].isPressed()) { + } else if (keyBinds[12].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/AllEntities.java b/src/main/java/rosegoldaddons/commands/AllEntities.java new file mode 100644 index 0000000..ce0117b --- /dev/null +++ b/src/main/java/rosegoldaddons/commands/AllEntities.java @@ -0,0 +1,67 @@ +package rosegoldaddons.commands; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; + +import java.util.ArrayList; +import java.util.List; + +public class AllEntities implements ICommand { + @Override + public String getCommandName() { + return "allentities"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/" + getCommandName(); + } + + @Override + public List getCommandAliases() { + return new ArrayList<>(); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + ChatUtils.sendMessage(""+entity1); + } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + return new ArrayList<>(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + private boolean isNumeric(String str) { + try { + Double.parseDouble(str); + return true; + } catch (NumberFormatException e) { + return false; + } + } + + @Override + public int compareTo(@NotNull ICommand o) { + return 0; + } +} diff --git a/src/main/java/rosegoldaddons/commands/Rosedrobe.java b/src/main/java/rosegoldaddons/commands/Rosedrobe.java index d05c6be..55024df 100644 --- a/src/main/java/rosegoldaddons/commands/Rosedrobe.java +++ b/src/main/java/rosegoldaddons/commands/Rosedrobe.java @@ -25,7 +25,6 @@ import java.util.List; public class Rosedrobe implements ICommand { public static boolean openWardrobe = false; public static int slot = 0; - int windowId; @Override public String getCommandName() { diff --git a/src/main/java/rosegoldaddons/commands/Rosepet.java b/src/main/java/rosegoldaddons/commands/Rosepet.java new file mode 100644 index 0000000..800098f --- /dev/null +++ b/src/main/java/rosegoldaddons/commands/Rosepet.java @@ -0,0 +1,65 @@ +package rosegoldaddons.commands; + +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; + +import java.util.ArrayList; +import java.util.List; + +public class Rosepet implements ICommand { + public static boolean openPetS = false; + public static String name = ""; + + @Override + public String getCommandName() { + return "rosepet"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/" + getCommandName(); + } + + @Override + public List getCommandAliases() { + return new ArrayList<>(); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + openPetS = true; + } else { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + openPetS = true; + name = args[0]; + + } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + return new ArrayList<>(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(@NotNull ICommand o) { + return 0; + } +} diff --git a/src/main/java/rosegoldaddons/commands/UseCooldown.java b/src/main/java/rosegoldaddons/commands/UseCooldown.java index 45d78b0..351df9a 100644 --- a/src/main/java/rosegoldaddons/commands/UseCooldown.java +++ b/src/main/java/rosegoldaddons/commands/UseCooldown.java @@ -1,5 +1,6 @@ package rosegoldaddons.commands; +import com.google.gson.Gson; import net.minecraft.client.Minecraft; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; @@ -7,16 +8,24 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.InventoryPlayer; 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.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; + public class UseCooldown implements ICommand { - public static HashMap items = new HashMap(); + public static HashMap RCitems = new HashMap(); + public static HashMap LCitems = new HashMap(); @Override public String getCommandName() { @@ -35,6 +44,16 @@ public class UseCooldown implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) { + for (String i : RCitems.keySet()) { + ChatUtils.sendMessage("§7Right click macro set on " + i + " §7with cooldown of " + RCitems.get(i) + " ms."); + } + for (String i : LCitems.keySet()) { + ChatUtils.sendMessage("§7Left click macro set on " + i + " §7with cooldown of " + LCitems.get(i) + " ms."); + } + saveMacros(); + return; + } if (args.length == 1 && isNumeric(args[0])) { InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; @@ -42,16 +61,42 @@ public class UseCooldown implements ICommand { if (curStack != null) { int cd = Integer.parseInt(args[0]); if (cd == 0) { - items.remove(curStack.getDisplayName()); + RCitems.remove(curStack.getDisplayName()); ChatUtils.sendMessage("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."); + saveMacros(); return; } - if (cd < 1) { - ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 1 Milisecond."); + if (cd < 100) { + ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 100 Milisecond."); + saveMacros(); return; } - ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a with delay of " + cd + " ms."); - items.put(curStack.getDisplayName(), cd); + RCitems.put(curStack.getDisplayName(), cd); + ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a to right click with a delay of " + cd + " ms."); + saveMacros(); + } else { + ChatUtils.sendMessage("§cError getting current held item."); + } + } else if (args.length == 2 && isNumeric(args[0]) && args[1].equalsIgnoreCase("left")) { + InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + + ItemStack curStack = inv.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); + if (curStack != null) { + int cd = Integer.parseInt(args[0]); + if (cd == 0) { + LCitems.remove(curStack.getDisplayName()); + ChatUtils.sendMessage("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."); + saveMacros(); + return; + } + if (cd < 100) { + ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 100 Milisecond."); + saveMacros(); + return; + } + ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a to left click with a delay of " + cd + " ms."); + LCitems.put(curStack.getDisplayName(), cd); + saveMacros(); } else { ChatUtils.sendMessage("§cError getting current held item."); } @@ -84,6 +129,52 @@ public class UseCooldown implements ICommand { } } + private void saveMacros() { + try { + String rcjson = new Gson().toJson(RCitems); + Files.write(Paths.get("./config/rosegoldaddons/rcmacros.json"), rcjson.getBytes(StandardCharsets.UTF_8)); + String lcjson = new Gson().toJson(LCitems); + Files.write(Paths.get("./config/rosegoldaddons/lcmacros.json"), lcjson.getBytes(StandardCharsets.UTF_8)); + } catch(Exception error) { + System.out.println("Error saving config file"); + error.printStackTrace(); + } + /*File rcfile = new File("./config/rosegoldaddons/rcmacro.txt"); + BufferedWriter bf = null; + try { + bf = new BufferedWriter(new FileWriter(rcfile)); + for (HashMap.Entry entry : RCitems.entrySet()) { + bf.write(entry.getKey() + ":" + entry.getValue()); + bf.newLine(); + } + bf.flush(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + bf.close(); + } catch (Exception e) { + } + } + File lcfile = new File("./config/rosegoldaddons/lcmacro.txt"); + BufferedWriter bf2 = null; + try { + bf2 = new BufferedWriter(new FileWriter(lcfile)); + for (HashMap.Entry entry : LCitems.entrySet()) { + bf2.write(entry.getKey() + ":" + entry.getValue()); + bf2.newLine(); + } + bf2.flush(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + bf2.close(); + } catch (Exception e) { + } + }*/ + } + @Override public int compareTo(@NotNull ICommand o) { return 0; diff --git a/src/main/java/rosegoldaddons/commands/WartSetup.java b/src/main/java/rosegoldaddons/commands/WartSetup.java deleted file mode 100644 index a143349..0000000 --- a/src/main/java/rosegoldaddons/commands/WartSetup.java +++ /dev/null @@ -1,83 +0,0 @@ -package rosegoldaddons.commands; - -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommand; -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; - -public class WartSetup implements ICommand { - public static int wartEnd = 99999; - public static String cardinal = "west"; - - @Override - public String getCommandName() { - return "wartsetup"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName(); - } - - @Override - public List getCommandAliases() { - return new ArrayList<>(); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) throws CommandException { - if(args.length == 2) { - if(args[0].equals("west")) { - cardinal = "west"; - } else if(args[0].equals("north")) { - cardinal = "north"; - } else if(args[0].equals("east")) { - cardinal = "east"; - } else if(args[0].equals("south")) { - cardinal = "south"; - } - - if(isNumeric(args[1])) { - wartEnd = (int) Math.floor(Double.parseDouble(args[1])); - } - } else { - ChatUtils.sendMessage("§cInvalid Arguments."); - } - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { - return new ArrayList<>(); - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public int compareTo(@NotNull ICommand o) { - return 0; - } - - private boolean isNumeric(String str) { - try { - Double.parseDouble(str); - return true; - } catch (NumberFormatException e) { - return false; - } - } -} diff --git a/src/main/java/rosegoldaddons/events/ClickEvent.java b/src/main/java/rosegoldaddons/events/ClickEvent.java new file mode 100644 index 0000000..b0544c4 --- /dev/null +++ b/src/main/java/rosegoldaddons/events/ClickEvent.java @@ -0,0 +1,20 @@ +package rosegoldaddons.events; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class ClickEvent extends Event { + + + public static class Right extends ClickEvent { + } + + public static class Left extends ClickEvent { + } + + public static class Middle extends ClickEvent { + + + } +} diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java new file mode 100644 index 0000000..4744766 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -0,0 +1,333 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Items; +import net.minecraft.item.ItemCloth; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.ClickEvent; +import rosegoldaddons.utils.ChatUtils; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public class AutoArrowAlign { + private static final ArrayList itemFrames = new ArrayList<>(); + private static final ArrayList arrowItemFrames = new ArrayList<>(); + private static final Map clicksPerFrame = new HashMap<>(); + private static final Map toClickMap = new HashMap<>(); + private static boolean init = false; + private static final BlockPos topLeft = new BlockPos(196, 125, 278); + + /*@SubscribeEvent + public void debugging(TickEvent.ClientTickEvent event) { + if (!Main.configFile.autoArrowAlign) return; + if (init) { + for (int y = 126; y > 119; y--) { + String line = ""; + for (int z = 278; z < 283; z++) { + BlockPos BP = new BlockPos(topLeft.getX(), y, z); + int toClick = -1; + if (toClickMap.containsKey(BP)) { + toClick = toClickMap.get(BP); + } + line += (toClick + " "); + } + ChatUtils.sendMessage(y + ": " + line); + } + itemFrames.forEach(itemFrame -> { + BlockPos BP = new BlockPos(itemFrame.getPosition().getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + ChatUtils.sendMessage(BP+""); + }); + } + }*/ + + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + if (!Main.configFile.autoArrowAlign) return; + itemFrames.clear(); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityItemFrame) { + itemFrames.add(entity1); + } + } + arrowItemFrames.clear(); + itemFrames.forEach(itemFrame -> { + ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem(); + if (itemStack != null) { + if (itemStack.getItem() == Items.arrow) { + arrowItemFrames.add(itemFrame); + } + } + }); + } + + @SubscribeEvent + public void worldUnload(WorldEvent.Unload event) { + init = false; + toClickMap.clear(); + clicksPerFrame.clear(); + } + + public static void cheat() { + initFrame(); + arrowItemFrames.forEach(itemFrame -> { + BlockPos BP = new BlockPos(topLeft.getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + int endRotationAmount = 0; + if (clicksPerFrame.containsKey(BP)) { + endRotationAmount = clicksPerFrame.get(BP); + } + int currRotationAmount = ((EntityItemFrame) itemFrame).getRotation(); + int toClick = 0; + if (currRotationAmount < endRotationAmount) { + toClick = endRotationAmount - currRotationAmount; + } else if (currRotationAmount > endRotationAmount) { + currRotationAmount = currRotationAmount - 8; + toClick = endRotationAmount - currRotationAmount; + } + toClickMap.put(BP, toClick); + }); + if (init) { + int j = 0; + Entity save = null; + for (Entity itemFrame : arrowItemFrames) { + BlockPos BP = new BlockPos(topLeft.getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + if (toClickMap.containsKey(BP)) { + j++; + int toClick2 = toClickMap.get(BP); + if (j == arrowItemFrames.size()) { + save = itemFrame; + toClick2 -= 1; + } + for (int i = 0; i < toClick2; i++) { + interactWithEntity(itemFrame); + } + } + } + Entity finalSave = save; + new Thread(() -> { + try { + Thread.sleep(60); + if(finalSave != null) { + interactWithEntity(finalSave); + } + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } + } + + private static String findPattern() { + ArrayList redWools = new ArrayList<>(); + ArrayList greenWools = new ArrayList<>(); + + itemFrames.forEach(itemFrame -> { + ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem(); + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemCloth && itemStack.getItemDamage() == 14) { + redWools.add(itemFrame); + } + if (itemStack.getItem() instanceof ItemCloth && itemStack.getItemDamage() == 5) { + greenWools.add(itemFrame); + } + } + }); + if (redWools.size() != 0 && greenWools.size() != 0) { + int relativeR1 = topLeft.getY() - (((Entity) redWools.toArray()[0]).getPosition()).getY(); + switch (redWools.size()) { + case 1: + switch (greenWools.size()) { + case 1: + if (relativeR1 == 4) { + return "legs"; + } + if (relativeR1 == 0) { + return "N"; + } + return "spiral"; + case 2: + if (relativeR1 == 2) { + return "W"; + } + return "bottleneck"; + } + break; + case 2: + if (greenWools.size() > 1) return "zigzag"; + return "S"; + case 3: + return "lines"; + } + } + return "Unrecognized"; + } + + private static void initFrame() { + if (init) return; + String pattern = findPattern(); + ChatUtils.sendMessage("Pattern Found: " + pattern); + switch (pattern) { + case "legs": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 7); + init = true; + break; + case "N": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + init = true; + break; + case "spiral": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + init = true; + break; + case "W": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 4), 5); + init = true; + break; + case "bottleneck": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 3), 7); + init = true; + break; + case "S": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + break; + case "lines": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + init = true; + break; + case "zigzag": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + init = true; + break; + } + + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Minecraft.getMinecraft()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void interactWithEntity(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + } + + + private static boolean isInSection3() { + int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); + int z = Minecraft.getMinecraft().thePlayer.getPosition().getZ(); + return x < 218 && z > 251 && x > 196 && z < 319; + } +} diff --git a/src/main/java/rosegoldaddons/features/BlockBreakAura.java b/src/main/java/rosegoldaddons/features/BlockBreakAura.java index e8b7219..528ccc1 100644 --- a/src/main/java/rosegoldaddons/features/BlockBreakAura.java +++ b/src/main/java/rosegoldaddons/features/BlockBreakAura.java @@ -65,7 +65,7 @@ public class BlockBreakAura { } private BlockPos closestGemstone() { - int r = 4; + int r = 5; BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 88ce213..41d1f90 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -22,7 +22,7 @@ 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 String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor"}; private static ArrayList bloodMobs = null; private Thread thread; @@ -34,7 +34,7 @@ public class BloodTriggerBot { thread = new Thread(() -> { try { for (Entity entity : bloodMobs) { - if (isLookingAtBloodMob(entity.getEntityBoundingBox(), event)) { + if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { click(); Thread.sleep(100); } @@ -47,10 +47,11 @@ public class BloodTriggerBot { } } - private static boolean isLookingAtBloodMob(AxisAlignedBB aabb, RenderWorldLastEvent event) { + private static boolean isLookingAtAABB(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++) { + look = scaleVec(look, 0.5F); + for (int i = 0; i < 64; 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; } @@ -77,6 +78,10 @@ public class BloodTriggerBot { return bloodMobs; } + private static Vec3 scaleVec(Vec3 vec, float f) { + return new Vec3(vec.xCoord * (double)f, vec.yCoord * (double)f, vec.zCoord * (double)f); + } + public static void click() { try { Method clickMouse; diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 57c650f..3133cb8 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -10,7 +10,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.commands.UseCooldown; -import rosegoldaddons.commands.WartSetup; import java.lang.reflect.Method; @@ -26,9 +25,8 @@ public class CustomItemMacro { try { milis++; int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; - for (String i : UseCooldown.items.keySet()) { - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(Math.floor(UseCooldown.items.get(i)/1000) + " " + milis)); - if (milis % Math.floor(UseCooldown.items.get(i)/100) == 0) { + for (String i : UseCooldown.RCitems.keySet()) { + if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { int slot = findItemInHotbar(i); if (slot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; @@ -37,6 +35,16 @@ public class CustomItemMacro { } } } + for (String i : UseCooldown.LCitems.keySet()) { + if (milis % Math.floor(UseCooldown.LCitems.get(i)/100) == 0) { + int slot = findItemInHotbar(i); + if (slot != -1) { + Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; + Thread.sleep(100); + click(); + } + } + } Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; Thread.sleep(100); } catch (Exception e) { @@ -62,6 +70,21 @@ public class CustomItemMacro { } } + 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(); + } + } + private static int findItemInHotbar(String name) { InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; for (int i = 0; i < 9; i++) { diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java new file mode 100644 index 0000000..9db81f1 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -0,0 +1,125 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.Entity; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.Item; +import net.minecraft.item.ItemSkull; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.ClickEvent; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class EntityReach { + private Thread thread; + private static Entity toInteract; + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Main.configFile.entityReach) return; + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (toInteract != null) { + if (toInteract instanceof EntityArmorStand) { + interactWithEntity2(toInteract); + } + interactWithEntity(toInteract); + toInteract = null; + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.configFile.entityReach) return; + ArrayList entities = getAllEntitiesInRange(); + for (Entity entity : entities) { + if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { + toInteract = entity; + return; + } + } + if (!Main.configFile.sticky) { + toInteract = null; + } + } + + @SubscribeEvent + public void renderWorld2(RenderWorldLastEvent event) { + if (!Main.configFile.entityReach) return; + if (toInteract != null) { + RenderUtils.drawEnti