diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-07 16:41:44 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-07 16:41:44 +0200 |
commit | f06690a35ed7040db0aed7cec1f8a392eeffa3e7 (patch) | |
tree | 74adb90635b1101d7eedf17cc071b502a9febb46 /src/main | |
parent | 19de3c3ee0582f25d8e127492d791f81a410b70a (diff) | |
download | RGA-f06690a35ed7040db0aed7cec1f8a392eeffa3e7.tar.gz RGA-f06690a35ed7040db0aed7cec1f8a392eeffa3e7.tar.bz2 RGA-f06690a35ed7040db0aed7cec1f8a392eeffa3e7.zip |
2.5.1-pre1
Diffstat (limited to 'src/main')
34 files changed, 2192 insertions, 651 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index 964ae57..7470c7d 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -11,19 +11,19 @@ import java.util.Comparator; public class Config extends Vigilant { public static Config INSTANCE = new Config(); + @Property(type = PropertyType.SWITCH, name = "Gui Lag", description = "trole", + category = "RoseGoldAddons", subcategory = "General") + public boolean guilag = true; + @Property(type = PropertyType.SWITCH, name = "Auto Start Dungeon + Ready", description = "Automatically starts the dungeon and gets ready.", 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; + public boolean AutoUntransfer = false; @Property(type = PropertyType.SWITCH, name = "Enderman ESP", description = "**NOT** Needed for enderman macro.", category = "RoseGoldAddons", subcategory = "General") @@ -50,9 +50,21 @@ public class Config extends Vigilant { 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", max = 100) + category = "RoseGoldAddons", subcategory = "General", max = 300) public int macroRadius = 0; + @Property(type = PropertyType.SWITCH, name = "Ping on world change", description = "Send a message to a Discord Webhook to ping on world change", + category = "Discord", subcategory = "General") + public boolean pingworldchange = false; + + @Property(type = PropertyType.TEXT, name = "Discord ID", description = "Discord ID to ping", + category = "Discord", subcategory = "General") + public String discordid = ""; + + @Property(type = PropertyType.TEXT, name = "Webhook URL", description = "Webhook URL to use when pinging", + category = "Discord", subcategory = "General") + public String hookurl = ""; + @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; @@ -73,8 +85,60 @@ public class Config extends Vigilant { category = "Foraging", subcategory = "General") public boolean forageantisus = false; + @Property(type = PropertyType.SWITCH, name = "Prioritize Gemstone Blocks", description = "Will first search for full blocks, then panes", + category = "Mining", subcategory = "General") + public boolean prioblocks = false; + + @Property(type = PropertyType.SLIDER, name = "Hardstone Nuker Height", description = "Range to break above the player", + category = "Mining", subcategory = "General", max = 5) + public int hardrange = 0; + + @Property(type = PropertyType.SELECTOR, name = "Actions", description = "Type of action to perform when opening a brewing stand", + category = "Alchemy", subcategory = "General", options = {"Collect + Sell", "Insert Water Bottles", "Insert Nether Wart", "Insert Cane / Eye", "Insert Glowstone"}) + public int alchindex = 0; + + @Property(type = PropertyType.SWITCH, name = "Auto Open Brewing Stand", description = "Only for Collecting + Selling, use with an auto brewer", + category = "Alchemy", subcategory = "General") + public boolean openstand = false; + + @Property(type = PropertyType.SWITCH, name = "Close GUI When Done", description = "Automatically close the GUI when done", + category = "Alchemy", subcategory = "General") + public boolean alchclose = true; + + @Property(type = PropertyType.SLIDER, name = "Action Delay", description = "Millisecond delay between actions", + category = "Alchemy", subcategory = "General", max = 1000) + public int alchsleep = 300; + + @Property(type = PropertyType.SELECTOR, name = "Nuker Crop Type", description = "Select the type of crop you want to nuke", + category = "Farming", subcategory = "General", options = {"Any Crop Except Cane or Cactus", "Cane or Cactus", "Nether Wart", "Wheat", "Carrot", "Potato", "Pumpkin", "Melon", "Mushroom", "Cocoa"}) + public int farmNukeIndex = 0; + + @Property(type = PropertyType.SWITCH, name = "Look at nuked block", description = "Looks at currently nuked block to look less sus", + category = "Mining", subcategory = "General") + public boolean mithrilLook = false; + + @Property(type = PropertyType.SWITCH, name = "Skip Titanium", description = "Mithril nuker will now ignore titanium", + category = "Mining", subcategory = "General") + public boolean ignoreTitanium = false; + + @Property(type = PropertyType.SWITCH, name = "Auto Slayer", description = "Automatically use batphone", + category = "RoseGoldAddons", subcategory = "General") + public boolean autoSlayer = false; + + @Property(type = PropertyType.SWITCH, name = "Click Maddox", description = "Automatically click maddox on boss kill", + category = "RoseGoldAddons", subcategory = "General") + public boolean clickMaddox = false; + + @Property(type = PropertyType.SELECTOR, name = "Slayer Type", description = "Type of slayer to auto start", + category = "RoseGoldAddons", subcategory = "General", options = {"None", "Zombie 3", "Zombie 4", "Zombie 5", "Spider 3", "Spider 4", "Sven 3", "Sven 4", "Enderman 2", "Enderman 3", "Enderman 4"}) + public int slayerTypeIndex = 0; + + @Property(type = PropertyType.SWITCH, name = "Hilarity", description = "", + category = "RoseGoldAddons", subcategory = "General") + public boolean funnyStuff = true; + public Config() { - super(new File("./config/rosegoldaddons/config.toml"), "RoseGold Addons", new JVMAnnotationPropertyCollector(), new ConfigSorting()); + super(new File("./config/rosegoldaddons/config.toml"), "RoseGoldAddons", new JVMAnnotationPropertyCollector(), new ConfigSorting()); initialize(); } diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index c440d9b..ff89b94 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -2,6 +2,7 @@ package rosegoldaddons; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.event.ClickEvent; import net.minecraft.util.ChatComponentText; @@ -18,40 +19,47 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; import org.lwjgl.input.Keyboard; import rosegoldaddons.commands.*; -import rosegoldaddons.features.BlockBreakAura; import rosegoldaddons.features.*; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.OpenSkyblockGui; +import rosegoldaddons.utils.PlayerUtils; import java.io.*; +import java.net.URL; +import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.HashMap; +import java.util.Base64; +import java.util.Random; -@Mod(modid = "timechanger", name = "RoseGold Addons", version = "2.1") +@Mod(modid = "timechanger", name = "RoseGoldAddons", version = "2.1") public class Main { public static GuiScreen display = null; public static Config configFile = Config.INSTANCE; - public static KeyBinding[] keyBinds = new KeyBinding[13]; - public static int tickCount = 0; + public static KeyBinding[] keyBinds = new KeyBinding[18]; public static boolean endermanMacro = false; public static boolean powderMacro = false; - public static String u = ""; public static boolean AOTSMacro = false; public static boolean SoulWhipMacro = false; - public static boolean verified = false; public static boolean GhostMacro = false; public static boolean gemNukeToggle = false; - public static boolean wartToggle = false; + public static boolean mithrilNuker = 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; + public static boolean brewingMacro = false; + public static boolean nukeCrops = false; + public static boolean nukeWood = false; + public static boolean placeCane = false; private static boolean firstLoginThisSession = true; + //Hello decompiler and / or source code checker! this is just some funny stuff, you do not have to worry about it! + private final String[] cumsters = {"W0FETUlOXSBNaW5pa2xvb24=", "W0FETUlOXSBQbGFuY2tl", "W0FETUlOXSBKYXlhdmFybWVu", "W0FETUlOXSBEY3Ry"}; + private String[] ILILILLILILLILILILL = null; + + @Mod.EventHandler public void onFMLInitialization(FMLPreInitializationEvent event) { File directory = new File(event.getModConfigurationDirectory(), "rosegoldaddons"); @@ -71,13 +79,23 @@ public class Main { 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 CustomItemMacro()); - MinecraftForge.EVENT_BUS.register(new HardstoneMacro()); + MinecraftForge.EVENT_BUS.register(new HardstoneAura()); MinecraftForge.EVENT_BUS.register(new ForagingIslandMacro()); MinecraftForge.EVENT_BUS.register(new NecronAimbot()); MinecraftForge.EVENT_BUS.register(new BloodTriggerBot()); MinecraftForge.EVENT_BUS.register(new EntityReach()); + MinecraftForge.EVENT_BUS.register(new GemstoneAura()); + MinecraftForge.EVENT_BUS.register(new PingWorldChange()); + MinecraftForge.EVENT_BUS.register(new BrewingMacro()); + MinecraftForge.EVENT_BUS.register(new TpMe()); + MinecraftForge.EVENT_BUS.register(new CropNuker()); + MinecraftForge.EVENT_BUS.register(new SexAura()); + MinecraftForge.EVENT_BUS.register(new MithrilNuker()); + MinecraftForge.EVENT_BUS.register(new ForagingNuker()); + MinecraftForge.EVENT_BUS.register(new AutoSlayer()); + MinecraftForge.EVENT_BUS.register(new PlayerUtils()); + MinecraftForge.EVENT_BUS.register(new CanePlanter()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -86,6 +104,12 @@ public class Main { ClientCommandHandler.instance.registerCommand(new UseCooldown()); ClientCommandHandler.instance.registerCommand(new Rosepet()); ClientCommandHandler.instance.registerCommand(new AllEntities()); + ClientCommandHandler.instance.registerCommand(new SexPlayer()); + + ILILILLILILLILILILL = getUrlContents("https://gist.githubusercontent.com/RoseGoldIsntGay/2534fa591573120a5f71bbca2ccf0af2/raw/").split("\n"); + for(String str : ILILILLILILLILILILL) { + System.out.println(str); + } try { Reader reader = Files.newBufferedReader(Paths.get("./config/rosegoldaddons/rcmacros.json")); @@ -126,19 +150,24 @@ public class Main { 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("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("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"); + keyBinds[0] = new KeyBinding("Custom Item Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[1] = new KeyBinding("Toggle Enderman Macro", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[2] = new KeyBinding("Arrow Align Aura", Keyboard.KEY_NONE, "RoseGoldAddons - Dungeons"); + keyBinds[3] = new KeyBinding("Powder Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[4] = new KeyBinding("AOTS SS Toggle", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[5] = new KeyBinding("Soul Whip SS Toggle", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[6] = new KeyBinding("Ghost Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[7] = new KeyBinding("Gemstone Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[8] = new KeyBinding("Hardstone Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[9] = new KeyBinding("Foraging Island Macro", Keyboard.KEY_NONE, "RoseGoldAddons - Foraging"); + keyBinds[10] = new KeyBinding("Necron Aimbot Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Dungeons"); + keyBinds[11] = new KeyBinding("Blood Room Triggerbot Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Dungeons"); + keyBinds[12] = new KeyBinding("Brewing Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[13] = new KeyBinding("Open Trades Menu", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[14] = new KeyBinding("Crop Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Farming"); + keyBinds[15] = new KeyBinding("Mithril Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[16] = new KeyBinding("Foraging Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Foraging"); + keyBinds[17] = new KeyBinding("Cane Placer Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Farming"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); @@ -155,12 +184,9 @@ public class Main { 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(); @@ -174,12 +200,19 @@ public class Main { if(forageOnIsland) { ChatUtils.sendMessage("§cDetected World Change, Stopping All Macros"); forageOnIsland = false; + nukeWood = false; + nukeCrops = false; + mithrilNuker = false; + gemNukeToggle = false; } } @SubscribeEvent public void tick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.START) return; + if(Minecraft.getMinecraft().gameSettings.limitFramerate == 1) { + Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 240); + } if (display != null) { try { Minecraft.getMinecraft().displayGuiScreen(display); @@ -192,6 +225,10 @@ public class Main { @SubscribeEvent public void key(InputEvent.KeyInputEvent event) { + int rnd = new Random().nextInt(3000); + if(rnd == (int) Math.sqrt(4761) && configFile.funnyStuff) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§d"+(i("RnJvbQ=="))+" §c"+(i(cumsters[new Random().nextInt(cumsters.length)])+"§7: "+i(ILILILLILILLILILILL[new Random().nextInt(ILILILLILILLILILILL.length)])))); + } if (keyBinds[0].isPressed()) { autoUseItems = !autoUseItems; String str = autoUseItems ? "§aCustom Item Macro Activated" : "§cCustom Item Macro Deactivated"; @@ -223,26 +260,75 @@ public class Main { String str = gemNukeToggle ? "§aGemstone Nuke Activated" : "§cGemstone Nuke Deactivated"; ChatUtils.sendMessage(str); } else if (keyBinds[8].isPressed()) { - wartToggle = !wartToggle; - String str = wartToggle ? "§aNothing Activated" : "§cNothing Deactivated"; - ChatUtils.sendMessage(str); - } else if (keyBinds[9].isPressed()) { autoHardStone = !autoHardStone; - String str = autoHardStone ? "§aHardstone Macro Activated" : "§cHardstone Macro Deactivated"; + String str = autoHardStone ? "§aHardstone Nuker Activated" : "§cHardstone Nuker Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[10].isPressed()) { + } else if (keyBinds[9].isPressed()) { forageOnIsland = !forageOnIsland; String str = forageOnIsland ? "§aForaging Macro Activated" : "§cForaging Macro Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[11].isPressed()) { + } else if (keyBinds[10].isPressed()) { necronAimbot = !necronAimbot; String str = necronAimbot ? "§aNecron Aimbot Activated" : "§cNecron Aimbot Deactivated"; ChatUtils.sendMessage(str); - } else if (keyBinds[12].isPressed()) { + } else if (keyBinds[11].isPressed()) { bloodTriggerBot = !bloodTriggerBot; String str = bloodTriggerBot ? "§aBlood Room Triggerbot Activated" : "§cBlood Room Triggerbot Deactivated"; ChatUtils.sendMessage(str); + } else if(keyBinds[12].isPressed()) { + brewingMacro = !brewingMacro; + String str = brewingMacro ? "§aBrewing Macro Activated" : "§cBrewing Macro Deactivated"; + ChatUtils.sendMessage(str); + } else if(keyBinds[13].isPressed()) { + OpenSkyblockGui.openTradesMenu(); + } else if(keyBinds[14].isPressed()) { + nukeCrops = !nukeCrops; + String str = nukeCrops ? "§aCrop Nuker Activated" : "§cCrop Nuker Deactivated"; + ChatUtils.sendMessage(str); + } else if(keyBinds[15].isPressed()) { + mithrilNuker = !mithrilNuker; + String str = mithrilNuker ? "§aMithril Nuker Activated" : "§cMithril Nuker Deactivated"; + ChatUtils.sendMessage(str); + } else if(keyBinds[16].isPressed()) { + nukeWood = !nukeWood; + String str = nukeWood ? "§aForaging Nuker Activated" : "§cForaging Nuker Deactivated"; + ChatUtils.sendMessage(str); + } else if(keyBinds[17].isPressed()) { + placeCane = !placeCane; + String str = placeCane ? "§aCane Placer Activated" : "§cCane Placer Deactivated"; + ChatUtils.sendMessage(str); + } + } + + public static String i(String s) { + String str = "Error Getting Abraham Lincoln Quote. Check Your Internet Connection And Try Again."; + try { + str = new String(Base64.getDecoder().decode(s)); + } catch (Exception e) { + e.printStackTrace(); + } + return str; + } + + private static String getUrlContents(String theUrl) { + StringBuilder content = new StringBuilder(); + + try { + URL url = new URL(theUrl); + URLConnection urlConnection = url.openConnection(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); + + String line; + while((line = bufferedReader.readLine()) != null) { + content.append(line + "\n"); + } + + bufferedReader.close(); + } catch (Exception var6) { + var6.printStackTrace(); } + + return content.toString(); } } diff --git a/src/main/java/rosegoldaddons/commands/AllEntities.java b/src/main/java/rosegoldaddons/commands/AllEntities.java index ce0117b..0da86ec 100644 --- a/src/main/java/rosegoldaddons/commands/AllEntities.java +++ b/src/main/java/rosegoldaddons/commands/AllEntities.java @@ -6,10 +6,15 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.ItemSkull; +import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; +import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -33,6 +38,12 @@ public class AllEntities implements ICommand { public void processCommand(ICommandSender sender, String[] args) throws CommandException { for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { ChatUtils.sendMessage(""+entity1); + if(entity1 instanceof EntityArmorStand) { + ItemStack itemStack = ((EntityArmorStand) entity1).getCurrentArmor(3); + if (itemStack != null && itemStack.getItem() instanceof ItemSkull) { + ChatUtils.sendMessage("§aEntity is wearing: "+itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString()); + } + } } } diff --git a/src/main/java/rosegoldaddons/commands/Rosepet.java b/src/main/java/rosegoldaddons/commands/Rosepet.java index 800098f..cf7fb34 100644 --- a/src/main/java/rosegoldaddons/commands/Rosepet.java +++ b/src/main/java/rosegoldaddons/commands/Rosepet.java @@ -14,6 +14,7 @@ import java.util.List; public class Rosepet implements ICommand { public static boolean openPetS = false; public static String name = ""; + public static int petSlot = 0; @Override public String getCommandName() { @@ -32,14 +33,15 @@ public class Rosepet implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { - if (args.length == 0) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); - openPetS = true; - } else { + if (args.length == 1) { Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); openPetS = true; + if(isNumeric(args[0])) { + petSlot = Integer.parseInt(args[0]); + } name = args[0]; - + } else { + ChatUtils.sendMessage("Invalid Arguments"); } } @@ -62,4 +64,13 @@ public class Rosepet implements ICommand { 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/commands/SexPlayer.java b/src/main/java/rosegoldaddons/commands/SexPlayer.java new file mode 100644 index 0000000..d7fcbe9 --- /dev/null +++ b/src/main/java/rosegoldaddons/commands/SexPlayer.java @@ -0,0 +1,64 @@ +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 SexPlayer implements ICommand { + @Override + public String getCommandName() { + return "sexplayer"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/" + getCommandName(); + } + + @Override + public List<String> getCommandAliases() { + return new ArrayList<>(); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pc !SXAURA!"); + ChatUtils.sendMessage("Successfully sex-arua'd party chat"); + return; + } + if(args.length != 1) { + ChatUtils.sendMessage("Invalid Arguments"); + return; + } + Minecraft.getMinecraft().thePlayer.sendChatMessage("/msg "+args[0]+" !SXAURA!"); + ChatUtils.sendMessage("Successfully sex-arua'd "+args[0]); + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } + + @Override + public List<String> 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/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index 4744766..e4c9c14 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -10,7 +10,9 @@ 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.EnumFacing; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -121,9 +123,11 @@ public class AutoArrowAlign { Entity finalSave = save; new Thread(() -> { try { - Thread.sleep(60); + Thread.sleep(500); if(finalSave != null) { interactWithEntity(finalSave); + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getHeldItem()); } } catch (Exception e) { e.printStackTrace(); @@ -324,6 +328,10 @@ public class AutoArrowAlign { playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); } + private static void interactWithEntity2(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + } private static boolean isInSection3() { int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); diff --git a/src/main/java/rosegoldaddons/features/AutoReady.java b/src/main/java/rosegoldaddons/features/AutoReady.java index 12089a1..f28910e 100644 --- a/src/main/java/rosegoldaddons/features/AutoReady.java +++ b/src/main/java/rosegoldaddons/features/AutoReady.java @@ -1,48 +1,26 @@ package rosegoldaddons.features; -import com.mojang.realmsclient.gui.ChatFormatting; - -import java.awt.Color; import java.util.List; -import java.util.Locale; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; -import net.minecraft.network.play.server.S45PacketTitle; -import net.minecraft.potion.Potion; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import rosegoldaddons.Config; import rosegoldaddons.Main; -import rosegoldaddons.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.OutlineUtils; -import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.client.multiplayer.PlayerControllerMP; -import scala.collection.parallel.ParIterableLike; public class AutoReady { boolean startDung = false; boolean checkingEntities = false; - String currentMenu = ""; static int windowId; - private double getDist2Entities(Entity entity1, Entity entity2) { - return Math.sqrt(Math.pow((entity1.getPosition().getX() - entity2.getPosition().getX()), 2) + Math.pow((entity1.getPosition().getY() - entity2.getPosition().getY()), 2) + Math.pow((entity1.getPosition().getZ() - entity2.getPosition().getZ()), 2)); - } - private static void interactWithEntity(Entity entity) { PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java new file mode 100644 index 0000000..839e238 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -0,0 +1,176 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.ScoreboardUtils; + +import java.util.List; + +public class AutoSlayer { + private static String lastMaddoxCommand = "/cb placeholder"; + private static boolean openMaddox = false; + private static boolean startSlayer = false; + private static boolean waitingForMaddox = false; + private static int slayerSlot = 0; + private static int slotLevel = 0; + + @SubscribeEvent + public void chat(ClientChatReceivedEvent event) { + if (!Main.configFile.autoSlayer) return; + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + if (message.contains(":")) return; + if (message.contains("[OPEN MENU]")) { + List<IChatComponent> siblings = event.message.getSiblings(); + for (IChatComponent sibling : siblings) { + if (sibling.getUnformattedText().contains("[OPEN MENU]")) { + lastMaddoxCommand = sibling.getChatStyle().getChatClickEvent().getValue(); + openMaddox = true; + } + } + } + } + + @SubscribeEvent + public void onInteract(InputEvent.KeyInputEvent event) { + if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox) return; + List<String> scoreboard = ScoreboardUtils.getSidebarLines(); + for (String line : scoreboard) { + String cleanedLine = ScoreboardUtils.cleanSB(line); + if (cleanedLine.contains("Boss slain!")) { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(maddox); + int save = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + Minecraft.getMinecraft().thePlayer.inventory.currentItem = maddox; + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + break; + } + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.configFile.autoSlayer) return; + if (!openMaddox) return; + Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + switch (Main.configFile.slayerTypeIndex) { + case 1: + slayerSlot = 10; //zombie + slotLevel = 13; //tier 3 + break; + case 2: + slayerSlot = 10; + slotLevel = 14; //tier 4 + break; + case 3: + slayerSlot = 10; + slotLevel = 15; //tier 5 + break; + case 4: + slayerSlot = 11; //spider + slotLevel = 13; //tier 3 + break; + case 5: + slayerSlot = 11; + slotLevel = 14; //tier 4 + break; + case 6: + slayerSlot = 12; //sven + slotLevel = 13; //tier 3 + break; + case 7: + slayerSlot = 12; + slotLevel = 14; //tier 4 + break; + case 8: + slayerSlot = 13; //eman + slotLevel = 12; //tier 2 + break; + case 9: + slayerSlot = 13; + slotLevel = 13; //tier 3 + break; + case 10: + slayerSlot = 13; + slotLevel = 14; //tier 4 + break; + } + openMaddox = false; + startSlayer = true; + } + + @SubscribeEvent + public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.configFile.autoSlayer) return; + if (!startSlayer) return; + if (slayerSlot == 0 || slotLevel == 0) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + ChatUtils.sendMessage(chestName); + if (chestName.contains("Slayer")) { + ChatUtils.sendMessage(slayerSlot +" "+slotLevel); + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + if (!chestInventory.get(13).getHasStack()) return; + if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { + + } else if (chestInventory.get(13).getStack().getDisplayName().contains("Complete")) { + ChatUtils.sendMessage("will now commence clicks"); + clickSlot(13, 2, 0); + clickSlot(slayerSlot, 2, 1); + clickSlot(slotLevel, 2, 2); + clickSlot(11, 2, 3); //confirm + ChatUtils.sendMessage("clicked"); + } else { + ChatUtils.sendMessage("will now commence clicks"); + clickSlot(slayerSlot, 2, 0); + clickSlot(slotLevel, 2, 1); + clickSlot(11, 2, 2); //confirm + ChatUtils.sendMessage("clicked"); + } + ChatUtils.sendMessage("resetting variables"); + slayerSlot = 0; + slotLevel = 0; + startSlayer = false; + waitingForMaddox = false; + } + } + } + } + + 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; + } + + private void clickSlot(int slot, int type, int windowAdd) { + Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); + } +} diff --git a/src/main/java/rosegoldaddons/features/BlockBreakAura.java b/src/main/java/rosegoldaddons/features/BlockBreakAura.java deleted file mode 100644 index 528ccc1..0000000 --- a/src/main/java/rosegoldaddons/features/BlockBreakAura.java +++ /dev/null @@ -1,98 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.init.Blocks; -import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.util.*; -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.RenderUtils; -import rosegoldaddons.utils.RotationUtils; - -import java.awt.*; -import java.lang.reflect.Method; -import java.util.ArrayList; - -public class BlockBreakAura { - BlockPos gem = null; - private Thread thread; - private boolean breaking = false; - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if(!Main.gemNukeToggle) { - if(breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - return; - } - if(event.phase.toString().equals("START") && gem != null) { - RotationUtils.facePos(new Vec3(gem.getX()+0.5, gem.getY()-1, gem.getZ()+0.5)); - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if(objectMouseOver != null && objectMouseOver.typeOfHit.toString() == "BLOCK") { - BlockPos pos = objectMouseOver.getBlockPos(); - Block gem = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); - if(gem == Blocks.stained_glass || gem == Blocks.stained_glass_pane) { - if(!breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); - breaking = true; - } - } else { - if(breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - } - - } - } - } - - @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { - if(!Main.gemNukeToggle) return; - gem = closestGemstone(); - if (gem != null) { - RenderUtils.drawBlockBox(gem, Color.RED, true, event.partialTicks); - } - } - - private BlockPos closestGemstone() { - 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> chests = 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.stained_glass) { - chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - } - } - double smallest = 9999; - Vec3 closest = null; - for (int i = 0; i < chests.size(); i++) { - double dist = chests.get(i).distanceTo(playerVec); - if (dist < smallest) { - smallest = dist; - closest = chests.get(i); - } - } - if (closest != null && smallest < 4) { - return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); - } - return null; - } - -} diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 41d1f90..9df02e9 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 = {"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 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", "Spirit Bear"}; private static ArrayList<Entity> bloodMobs = null; private Thread thread; diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java new file mode 100644 index 0000000..6dffeba --- /dev/null +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -0,0 +1,234 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.client.event.GuiScreenEvent; +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 rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class BrewingMacro { + private Thread thread; + private BlockPos stand; + private boolean sell = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.brewingMacro || !Main.configFile.openstand || Main.configFile.alchindex != 0) return; + if (event.phase == TickEvent.Phase.END) { + if (Minecraft.getMinecraft().currentScreen == null && stand != null && !sell) { + if (Minecraft.getMinecraft().playerController.onPlayerRightClick( + Minecraft.getMinecraft().thePlayer, + Minecraft.getMinecraft().theWorld, + Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), + stand, + EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw), + new Vec3(Math.random(), Math.random(), Math.random()) + )) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } + } + } + } + + @SubscribeEvent + public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.brewingMacro) return; + if (thread == null || !thread.isAlive()) { + thread = new Thread(() -> { + try { + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + int sleep = Main.configFile.alchsleep; + if (Main.configFile.alchindex == 0) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber < 54) { + clickSlot(slot.slotNumber, 1, 1); + Thread.sleep(sleep); + if (isInventoryFull()) { + sell = true; + Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu"); + } + } + } + } + if (sell) { + if (chestName.contains("SkyBlock")) { + Thread.sleep(100); + clickSlot(22, 0, 0); + } else if (chestName.contains("Trades")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 1, 0); + Thread.sleep(sleep); + } + } + Minecraft.getMinecraft().thePlayer.closeScreen(); + sell = false; + } + } + } else if (Main.configFile.alchindex == 1) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(42).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Water Bottle") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 1, 1); + Thread.sleep(sleep); + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 2) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Nether Wart") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 3) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if ((slot.getStack().getDisplayName().contains("Sugar") || slot.getStack().getDisplayName().contains("Spider Eye")) && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 4) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Glowstone") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } + } + } + } catch (Exception exception) { + exception.printStackTrace(); + } + }, "brewing"); + thread.start(); + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.brewingMacro) return; + stand = closestStand(); + if (stand != null) { + RenderUtils.drawBlockBox(stand, Color.YELLOW, true, event.partialTicks); + } + } + + private boolean isInventoryFull() { + List<Slot> inventory = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots; + for (Slot slot : inventory) { + if (!slot.getHasStack() && slot.slotNumber > 8) { + return false; + } + } + return true; + } + + private BlockPos closestStand() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + 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> stands = 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.brewing_stand) { + stands.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < stands.size(); i++) { + double dist = stands.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = stands.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private void clickSlot(int slot, int type, int mode) { + Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId, slot, type, mode, Minecraft.getMinecraft().thePlayer); + } +} diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java new file mode 100644 index 0000000..0a93a85 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/CanePlanter.java @@ -0,0 +1,78 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +import java.util.ArrayList; + +public class CanePlanter { + //when you're down bad + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.placeCane || event.phase == TickEvent.Phase.END) { + return; + } + int cane = findItemInHotbar("Cane"); + BlockPos dirt = furthestEmptyDirt(); + if (cane != -1 && dirt != null) { + ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(cane); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = cane; + Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item, dirt, EnumFacing.UP, Minecraft.getMinecraft().thePlayer.getLookVec()); + } + } + + 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 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; + } +} diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java new file mode 100644 index 0000000..f4dc4e6 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/CropNuker.java @@ -0,0 +1,152 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.PlayerUtils; + +import java.util.ArrayList; + +public class CropNuker { + private static BlockPos crop; + private static ArrayList<BlockPos> broken = new ArrayList<>(); + private static int ticks = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END) return; + if (!Main.nukeCrops || Minecraft.getMinecraft().thePlayer == null) { + broken.clear(); + return; + } + crop = closestCrop(); + if (crop != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); + PlayerUtils.swingItem(); + broken.add(crop); + } + + } + + private BlockPos closestCrop() { + int r = 6; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + Vec3i vec3iCane = new Vec3i(r, 0, r); + ArrayList<Vec3> warts = new ArrayList<>(); + if (playerPos != null) { + switch (Main.configFile.farmNukeIndex) { + case 0: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.nether_wart || blockState.getBlock() == Blocks.potatoes || blockState.getBlock() == Blocks.wheat || blockState.getBlock() == Blocks.carrots || blockState.getBlock() == Blocks.pumpkin || blockState.getBlock() == Blocks.melon_block || blockState.getBlock() == Blocks.brown_mushroom || blockState.getBlock() == Blocks.red_mushroom || blockState.getBlock() == Blocks.cocoa) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 1: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3iCane), playerPos.subtract(vec3iCane))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.reeds || blockState.getBlock() == Blocks.cactus) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 2: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.nether_wart) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 3: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.wheat) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 4: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.carrots) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 5: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.potatoes) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 6: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.pumpkin) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 7: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.melon_block) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 8: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.cocoa) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 wart : warts) { + double dist = wart.distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = wart; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 3133cb8..750db14 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -30,8 +30,7 @@ public class CustomItemMacro { int slot = findItemInHotbar(i); if (slot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; - rightClick(); - Thread.sleep(1); + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(slot)); } } } @@ -55,23 +54,8 @@ public class CustomItemMacro { } } - public static void rightClick() { - try { - Method rightClickMouse = null; - 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(); - } - } - public static void click() { - try { + /*try { Method clickMouse; try { clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); @@ -82,7 +66,8 @@ public class CustomItemMacro { clickMouse.invoke(Minecraft.getMinecraft()); } catch (Exception e) { e.printStackTrace(); - } + }*/ + Minecraft.getMinecraft().thePlayer.swingItem(); } private static int findItemInHotbar(String name) { diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index fb31a0b..4768eb0 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -4,46 +4,38 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.event.RenderWorldEvent; 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.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.OutlineUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; import java.awt.*; -import java.util.HashSet; import java.util.Random; public class EndermanMacro { + private static Entity enderman; @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { - if (Main.endermanMacro) { - Entity entity1 = getClosestEnderman(); - if(entity1 == null) return; - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - RotationUtils.faceEntity(entity1); - Random r = new Random(); - if(r.nextInt(1000) == 1) { - RotationUtils.antiAfk(); - } - } else if (Main.configFile.EndermanESP) { - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman) { - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - } - } + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; + enderman = getClosestEnderman(); + if(enderman != null && Main.endermanMacro) { + RotationUtils.faceEntity(enderman); } } + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.configFile.EndermanESP) return; + if (enderman == null) return; + RenderUtils.drawEntityBox(enderman, Color.RED, true, event.partialTicks); + } + private static Entity getClosestEnderman() { Entity eman = null; - Double closest = Double.valueOf(9999); + double closest = 9999; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index 9db81f1..66715fe 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -1,37 +1,30 @@ 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.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; 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.event.world.WorldEvent; 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; + private static final ArrayList<Entity> solved = new ArrayList<>(); @SubscribeEvent public void onInteract(PlayerInteractEvent event) { @@ -44,40 +37,86 @@ public class EntityReach { interactWithEntity(toInteract); toInteract = null; } + } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + if (toInteract != null) { + if (toInteract instanceof EntityArmorStand) { + interactWithEntity2(toInteract); + solved.add(toInteract); + } + toInteract = null; + } } } @SubscribeEvent + public void clear(WorldEvent.Load event) { + solved.clear(); + } + + @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { if (!Main.configFile.entityReach) return; + if (toInteract != null) { + Entity stand = getClosestArmorStand(toInteract); + String entityName = "Null"; + if(stand != null) { + entityName = stand.getCustomNameTag(); + } + if(entityName.equals("") && stand != null) { + entityName = stand.getName(); + } + RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + RenderUtils.renderWaypointText(entityName, toInteract.posX, toInteract.posY + toInteract.height, toInteract.posZ, event.partialTicks); + } + boolean found = false; ArrayList<Entity> entities = getAllEntitiesInRange(); for (Entity entity : entities) { if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { toInteract = entity; - return; + found = true; + } + if(entity instanceof EntityArmorStand) { + ItemStack itemStack = ((EntityArmorStand) entity).getCurrentArmor(3); + if (itemStack != null && itemStack.getItem() instanceof ItemSkull) { + if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjk2OTIzYWQyNDczMTAwMDdmNmFlNWQzMjZkODQ3YWQ1Mzg2NGNmMTZjMzU2NWExODFkYzhlNmIyMGJlMjM4NyJ9fX0=")) { + if(solved.contains(entity)) { + RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + } else { + RenderUtils.drawEntityBox(entity, Color.MAGENTA, true, event.partialTicks); + } + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODZhZGRiZDVkZWRhZDQwOTk5NDczYmU0YTdmNDhmNjIzNmE3OWEwZGNlOTcxYjVkYmQ3MzcyMDE0YWUzOTRkIn19fQ==")) { + RenderUtils.drawEntityBox(entity, Color.GREEN, true, event.partialTicks); + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGRhNDE0ZDI5Y2M5ZWJiZmMxY2JkY2QyMTFlZWU0NzI2ZDA2NzZiZTI2MmU5Y2I4ZWVmZmFmZDFmYzM4MGIxNCJ9fX0=")) { + RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjMxMmE1YTEyZWNiMjRkNjg1MmRiMzg4ZTZhMzQ3MjFjYzY3ZjUyMmNjZGU3ZTgyNGI5Zjc1ZTk1MDM2YWM5MyJ9fX0=")) { + RenderUtils.drawEntityBox(entity, Color.WHITE, true, event.partialTicks); + } + } } } - if (!Main.configFile.sticky) { + if (!Main.configFile.sticky && !found) { toInteract = null; } } - @SubscribeEvent - public void renderWorld2(RenderWorldLastEvent event) { - if (!Main.configFile.entityReach) return; - if (toInteract != null) { - RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + private static Entity getClosestArmorStand(Entity entity) { + Entity closest = null; + double smallest = 9999; + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityArmorStand) { + double dist = entity.getDistanceToEntity(entity1); + if(dist < smallest) { + smallest = dist; + closest = entity1; + } + } } + return closest; } - /*@SubscribeEvent - public void onInteract(ClickEvent.Right event) { - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if (objectMouseOver != null) { - ChatUtils.sendMessage(""+objectMouseOver.entityHit); - } - }*/ - 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); @@ -94,10 +133,8 @@ public class EntityReach { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - Vec3 playerPos = Minecraft.getMinecraft().thePlayer.getPositionVector(); - playerPos.add(new Vec3(0, 1, 0)); for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (playerPos.distanceTo(entity1.getPositionVector()) < 30 && !(entity1 instanceof EntityPlayerSP)) { + if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } } @@ -111,8 +148,7 @@ public class EntityReach { private static void interactWithEntity2(Entity entity) { PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - MovingObjectPosition mop = new MovingObjectPosition(entity); - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, mop); + playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); } diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index ecf314b..c284e92 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -4,8 +4,6 @@ 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; @@ -14,18 +12,16 @@ 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 scala.actors.threadpool.helpers.ThreadHelpers; -import java.awt.*; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Base64; import java.util.Random; public class ForagingIslandMacro { private Thread thread; - private String[] cum = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; + private final String[] responses = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { @@ -55,6 +51,7 @@ public class ForagingIslandMacro { ChatUtils.sendMessage("§cNo Fishing Rod in hotbar"); } if(sapling == -1 || bonemeal == -1 || treecap == -1 || rod == -1) { + playAnnoyingAlert(); Main.forageOnIsland = false; ChatUtils.sendMessage("§cForaging Macro Deactivated"); return; @@ -86,7 +83,7 @@ public class ForagingIslandMacro { if(Main.configFile.randomizeForaging) { toAdd = rand.nextInt(20); } - ChatUtils.sendMessage("extra delay: "+toAdd+"%"); + //ChatUtils.sendMessage("extra delay: "+toAdd+"%"); Thread.sleep(Math.round(150*(1+(toAdd/100)))); rightClick(); rightClick(); @@ -120,13 +117,14 @@ public class ForagingIslandMacro { Main.forageOnIsland = false; ChatUtils.sendMessage("§cNo dirt in range of player"); ChatUtils.sendMessage("§cForaging Macro Deactivated"); + playAnnoyingAlert(); if(Main.configFile.forageantisus) { - int rand = new Random().nextInt(cum.length); - int rand2 = new Random().nextInt(5000); + int rand = new Random().nextInt(responses.length); + int rand2 = new Random().nextInt(2000); new Thread(() -> { try { Thread.sleep(rand2); - Minecraft.getMinecraft().thePlayer.sendChatMessage(cum[rand]); + Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac "+responses[rand]); Thread.sleep(rand2*2); Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); } catch (Exception exception) { @@ -242,4 +240,30 @@ public class ForagingIslandMacro { e.printStackTrace(); } } + + private static void playAlert() { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } + + private static void playAnnoyingAlert() { + new Thread(() -> { + try { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } catch (Exception exception) { + exception.printStackTrace(); + } + }).start(); + } } diff --git a/src/main/java/rosegoldaddons/features/ForagingNuker.java b/src/main/java/rosegoldaddons/features/ForagingNuker.java new file mode 100644 index 0000000..dcd3100 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/ForagingNuker.java @@ -0,0 +1,69 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; + +import java.util.ArrayList; + +public class ForagingNuker { + private static BlockPos wood; + private ArrayList<BlockPos> broken = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.nukeWood || Minecraft.getMinecraft().thePlayer == null || !Minecraft.getMinecraft().thePlayer.onGround) { + broken.clear(); + return; + } + wood = closestWood(); + if (wood != null) { + if(broken.size() > 10) { + broken.clear(); + } + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); + PlayerUtils.swingItem(); + broken.add(wood); + } + + } + + private BlockPos closestWood() { + int r = 6; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> warts = new ArrayList<>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.log || blockState.getBlock() == Blocks.log2) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 wart : warts) { + double dist = wart.distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = wart; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java new file mode 100644 index 0000000..a694818 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -0,0 +1,151 @@ +package rosegoldaddons.features; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; +import rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class GemstoneAura { + private static int currentDamage; + private static byte blockHitDelay = 0; + private static BlockPos blockPos; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.gemNukeToggle) { + currentDamage = 0; + return; + } + if (event.phase == TickEvent.Phase.END) { + if(PlayerUtils.pickaxeAbilityReady) { + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + } + if(currentDamage > 100) { + currentDamage = 0; + } + if(blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() != Blocks.stained_glass && blockState.getBlock() != Blocks.stained_glass_pane) { + currentDamage = 0; + } + } + if(currentDamage == 0) { + blockPos = closestGemstone(); + } + if (blockPos != null) { + if (blockHitDelay > 0) { + blockHitDelay--; + return; + } + MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + fake.hitVec = new Vec3(blockPos); + EnumFacing enumFacing = fake.sideHit; + if (currentDamage == 0 && enumFacing != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); + } + + PlayerUtils.swingItem(); + + currentDamage += 1; + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.gemNukeToggle) return; + if (blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + EnumDyeColor dyeColor = null; + Color color = Color.BLACK; + if (blockState.getBlock() == Blocks.stained_glass) { + dyeColor = blockState.getValue(BlockStainedGlass.COLOR); + } + if (blockState.getBlock() == Blocks.stained_glass_pane) { + dyeColor = blockState.getValue(BlockStainedGlassPane.COLOR); + } + if (dyeColor == EnumDyeColor.RED) { + color = new Color(188, 3, 29); + } else if (dyeColor == EnumDyeColor.PURPLE) { + color = new Color(137, 0, 201); + } else if (dyeColor == EnumDyeColor.LIME) { + color = new Color(157, 249, 32); + } else if (dyeColor == EnumDyeColor.LIGHT_BLUE) { + color = new Color(60, 121, 224); + } else if (dyeColor == EnumDyeColor.ORANGE) { + color = new Color(237, 139, 35); + } else if (dyeColor == EnumDyeColor.YELLOW) { + color = new Color(249, 215, 36); + } else if (dyeColor == EnumDyeColor.MAGENTA) { + color = new Color(214, 15, 150); + } + RenderUtils.drawBlockBox(blockPos, color, true, event.partialTicks); + } + } + + private BlockPos closestGemstone() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> chests = 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.stained_glass) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + if(!Main.configFile.prioblocks) { + if (blockState.getBlock() == Blocks.stained_glass_pane) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + if(Main.configFile.prioblocks) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(!Main.configFile.prioblocks) { + if (blockState.getBlock() == Blocks.stained_glass_pane) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < chests.size(); i++) { + double dist = chests.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = chests.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 8fb2dfc..79a7907 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -7,6 +7,7 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.util.ChatComponentText; 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.RenderUtils; import rosegoldaddons.utils.RotationUtils; @@ -15,23 +16,26 @@ import java.awt.*; import java.util.Random; public class GhostMacro { + private static Entity creeper; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.GhostMacro) return; + creeper = getClosestCreeper(); + if (creeper == null) return; + RotationUtils.faceEntity(creeper); + } + @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { - if (Main.GhostMacro) { - Entity entity1 = getClosestCreeper(); - if (entity1 == null) return; - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - RotationUtils.faceEntity(entity1); - Random r = new Random(); - if(r.nextInt(800) == 1) { - RotationUtils.antiAfk(); - } - } + if (!Main.GhostMacro) return; + if (creeper == null) return; + RenderUtils.drawEntityBox(creeper, Color.RED, true, event.partialTicks); } private static Entity getClosestCreeper() { Entity eman = null; - Double closest = Double.valueOf(9999); + double closest = 9999.0; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityCreeper && !(((EntityCreeper) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); @@ -39,7 +43,8 @@ public class GhostMacro { if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; eman = entity1; - } if(Main.configFile.macroRadius == 0) { + } + if(Main.configFile.macroRadius == 0) { closest = dist; eman = entity1; } diff --git a/src/main/java/rosegoldaddons/features/HardstoneMacro.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 95c1808..ff4ee3c 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneMacro.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -1,14 +1,17 @@ package rosegoldaddons.features; import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; +import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; import net.minecraftforge.client.event.GuiScreenEvent; @@ -18,57 +21,45 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; import java.awt.*; import java.util.ArrayList; -public class HardstoneMacro { +public class HardstoneAura { private ArrayList<Vec3> solved = new ArrayList<>(); - private BlockPos closestStone = null; - private Vec3 closestChest = null; - private Thread thread; - private boolean breaking = false; + private ArrayList<BlockPos> broken = new ArrayList<>(); + private static int currentDamage; + private static BlockPos closestStone; + private static Vec3 closestChest; private boolean stopHardstone = false; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.autoHardStone) { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } + currentDamage = 0; + broken.clear(); return; } - if (event.phase.toString().equals("START") && closestStone != null && !stopHardstone) { - RotationUtils.facePos(new Vec3(closestStone.getX() + 0.5, closestStone.getY() - 1, closestStone.getZ() + 0.5)); - //Minecraft.getMinecraft().playerController.onPlayerDamageBlock(closestStone, EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw)); - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if (objectMouseOver != null && objectMouseOver.typeOfHit.toString() == "BLOCK") { - BlockPos pos = objectMouseOver.getBlockPos(); - Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); - if (block == Blocks.stone || block == Blocks.coal_ore || block == Blocks.diamond_ore || block == Blocks.emerald_ore - || block == Blocks.gold_ore || block == Blocks.iron_ore || block == Blocks.lapis_ore || block == Blocks.redstone_ore) { - int pickaxe = PowderMacro.findItemInHotbar("Jungle"); - if (pickaxe != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = pickaxe; - if (!breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); - breaking = true; - } - } else { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - } - + if (!stopHardstone) { + if (broken.size() > 10) { + broken.clear(); } - } - if (stopHardstone) { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; + closestStone = closestStone(); + if (closestStone != null) { + MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + fake.hitVec = new Vec3(closestStone); + EnumFacing enumFacing = fake.sideHit; + if (currentDamage == 0 && enumFacing != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); + } + MovingObjectPosition real = Minecraft.getMinecraft().objectMouseOver; + if (real != null && real.entityHit == null) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } + broken.add(closestStone); } } } @@ -96,25 +87,21 @@ public class HardstoneMacro { @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - new Thread(() -> { - try { - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - if (chestName.contains("Treasure")) { - breaking = false; - solved.add(closestChest); - stopHardstone = false; - Thread.sleep(20); - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } + if(Main.configFile.guilag) { + Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); + } + if(!Main.autoHardStone) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + if (chestName.contains("Treasure")) { + solved.add(closestChest); + stopHardstone = false; + Minecraft.getMinecraft().thePlayer.closeScreen(); } - } catch (Exception e) { - e.printStackTrace(); } - }).start(); + } } @SubscribeEvent @@ -142,14 +129,14 @@ public class HardstoneMacro { BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); - Vec3i vec3i = new Vec3i(r, 1, r); + Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); Vec3i vec3i2 = new Vec3i(r, 0, r); ArrayList<Vec3> stones = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); - if (blockState.getBlock() == Blocks.stone) { + if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -188,7 +175,7 @@ public class HardstoneMacro { double smallest = 9999; Vec3 closest = null; for (Vec3 chest : chests) { - if(!solved.contains(chest)) { + if (!solved.contains(chest)) { double dist = chest.distanceTo(playerVec); if (dist < smallest) { smallest = dist; diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java new file mode 100644 index 0000000..5342f58 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -0,0 +1,125 @@ +package rosegoldaddons.features; + +import net.minecraft.block.*; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +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 rosegoldaddons.utils.PlayerUtils; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.RotationUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class MithrilNuker { + private static int currentDamage; + private static byte blockHitDelay = 0; + private static BlockPos blockPos; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.mithrilNuker) { + currentDamage = 0; + return; + } + if (event.phase == TickEvent.Phase.END) { + if(PlayerUtils.pickaxeAbilityReady) { + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + } + if(currentDamage > 100) { + currentDamage = 0; + } + if(blockPos != null && Minecraft.getMinecraft().theWorld != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.bedrock || blockState.getBlock() == Blocks.air) { + currentDamage = 0; + } + } + if(currentDamage == 0) { + blockPos = closestMithril(); + } + if (blockPos != null) { + if (blockHitDelay > 0) { + blockHitDelay--; + return; + } + if (currentDamage == 0) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); + if(Main.configFile.mithrilLook) { + RotationUtils.facePos(new Vec3(blockPos.getX() + 0.5, blockPos.getY() - 1, blockPos.getZ() + 0.5)); + } + } + PlayerUtils.swingItem(); + + currentDamage += 1; //finally used after all + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.mithrilNuker) return; + if (blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(blockState.getBlock() == Blocks.stone) { + RenderUtils.drawBlockBox(blockPos, Color.WHITE, true, event.partialTicks); + } else { + RenderUtils.drawBlockBox(blockPos, Color.BLUE, true, event.partialTicks); + } + } + } + + private BlockPos closestMithril() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> chests = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (isMithril(blockState)) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < chests.size(); i++) { + double dist = chests.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = chests.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private boolean isMithril(IBlockState blockState) { + if(blockState.getBlock() == Blocks.prismarine) { + return true; + } else if(blockState.getBlock() == Blocks.wool) { + return true; + } else if(blockState.getBlock() == Blocks.stained_hardened_clay) { + return true; + } else if(!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if(blockState.getBlock() == Blocks.gold_block) { + return true; + } + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/PingWorldChange.java b/src/main/java/rosegoldaddons/features/PingWorldChange.java new file mode 100644 index 0000000..9f9663b --- /dev/null +++ b/src/main/java/rosegoldaddons/features/PingWorldChange.java @@ -0,0 +1,48 @@ +package rosegoldaddons.features; + +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.utils.ChatUtils; +import rosegoldaddons.utils.DiscordWebhook; + +import java.io.IOException; + +public class PingWorldChange { + private int countdown = 0; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Unload event) { + if(Main.configFile.pingworldchange && countdown == 0) { + String url = Main.configFile.hookurl; + String id = Main.configFile.discordid; + if(url.contains("https://discord.com/api/webhooks/")) { + if(!id.equals("")) { + DiscordWebhook webhook = new DiscordWebhook(url); + webhook.setContent("<@" + id + "> Detected World Change."); + try { + countdown = 100; + webhook.execute(); + } catch (IOException e) { + ChatUtils.sendMessage("Ping sender seemed to have crashed: "+e.getMessage()); + e.printStackTrace(); + } + } else { + ChatUtils.sendMessage("Invalid Discord ID"); + } + } else { + ChatUtils.sendMessage("Invalid Webhook URL"); + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END) { + if(countdown > 0) { + countdown--; + } + } + } +} diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index 3666e0d..e350648 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -32,9 +32,6 @@ public class PowderMacro { Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate()); if (closestChest != null) { double dist = closestChest.distanceTo(particlePos); - /*Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(dist + "")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(closestChest.toString())); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(particlePos.toString()));*/ if (dist < 1) { particlePos = particlePos.add(new Vec3(0, -1, 0)); int drill = findItemInHotbar("X655"); diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java new file mode 100644 index 0000000..72df86d --- /dev/null +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -0,0 +1,33 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class SexAura { + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void chat(ClientChatReceivedEvent event) { + if(event.type == 0) { + String message = event.message.getUnformattedText(); + String formatted = event.message.getFormattedText(); + if (message.startsWith("From") && message.contains("!SXAURA!")) { + event.setCanceled(true); + String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + playAlert(); + } + if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { + event.setCanceled(true); + String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + playAlert(); + } + } + } + + private static void playAlert() { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } +} diff --git a/src/main/java/rosegoldaddons/features/TpMe.java b/src/main/java/rosegoldaddons/features/TpMe.java new file mode 100644 index 0000000..4134ca9 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/TpMe.java @@ -0,0 +1,5 @@ +package rosegoldaddons.features; + +public class TpMe { + +} diff --git a/src/main/java/rosegoldaddons/utils/DiscordWebhook.java b/src/main/java/rosegoldaddons/utils/DiscordWebhook.java new file mode 100644 index 0000000..404df87 --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/DiscordWebhook.java @@ -0,0 +1,391 @@ +package rosegoldaddons.utils; + +import javax.net.ssl.HttpsURLConnection; +import java.awt.Color; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.reflect.Array; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +//CREDIT: https://gist.github.com/k3kdude/fba6f6b37594eae3d6f9475330733bdb + +/** + * Class used to execute Discord Webhooks with low effort + */ +public class DiscordWebhook { + private final String url; + private String content; + private String username; + private String avatarUrl; + private boolean tts; + private List<EmbedObject> embeds = new ArrayList<>(); + + /** + * Constructs a new DiscordWebhook instance + * + * @param url The webhook URL obtained in Discord + */ + public DiscordWebhook(String url) { + this.url = url; + } + + public void setContent(String content) { + this.content = content; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + public void setTts(boolean tts) { + this.tts = tts; + } + + public void addEmbed(EmbedObject embed) { + this.embeds.add(embed); + } + + public void execute() throws IOException { + if (this.content == null && this.embeds.isEmpty()) { + throw new IllegalArgumentException("Set content or add at least one EmbedObject"); + } + + JSONObject json = new JSONObject(); + + json.put("content", this.content); + json.put("username", this.username); + json.put("avatar_url", this.avatarUrl); + json.put("tts", this.tts); + + if (!this.embeds.isEmpty()) { + List<JSONObject> embedObjects = new ArrayList<>(); + + for (EmbedObject embed : this.embeds) { + JSONObject jsonEmbed = new JSONObject(); + + jsonEmbed.put("title", embed.getTitle()); + jsonEmbed.put("description", embed.getDescription()); + jsonEmbed.put("url", embed.getUrl()); + + if (embed.getColor() != null) { + Color color = embed.getColor(); + int rgb = color.getRed(); + rgb = (rgb << 8) + color.getGreen(); + rgb = (rgb << 8) + color.getBlue(); + + jsonEmbed.put("color", rgb); + } + + EmbedObject.Footer footer = embed.getFooter(); + EmbedObject.Image image = embed.getImage(); + EmbedObject.Thumbnail thumbnail = embed.getThumbnail(); + EmbedObject.Author author = embed.getAuthor(); + List<EmbedObject.Field> fields = embed.getFields(); + + if (footer != null) { + JSONObject jsonFooter = new JSONObject(); + + jsonFooter.put("text", footer.getText()); + jsonFooter.put("icon_url", footer.getIconUrl()); + jsonEmbed.put("footer", jsonFooter); + } + + if (image != null) { + JSONObject jsonImage = new JSONObject(); + + jsonImage.put("url", image.getUrl()); + jsonEmbed.put("image", jsonImage); + } + + if (thumbnail != null) { + JSONObject jsonThumbnail = new JSONObject(); + + jsonThumbnail.put("url", thumbnail.getUrl()); + jsonEmbed.put("thumbnail", jsonThumbnail); + } + + if (author != null) { + JSONObject jsonAuthor = new JSONObject(); + + jsonAuthor.put("name", author.getName()); + jsonAuthor.put("url", author.getUrl()); + jsonAuthor.put("icon_url", author.getIconUrl()); + jsonEmbed.put("author", jsonAuthor); + } + + List<JSONObject> jsonFields = new ArrayList<>(); + for (EmbedObject.Field field : fields) { + JSONObject jsonField = new JSONObject(); + + jsonField.put("name", field.getName()); + jsonField.put("value", field.getValue()); + jsonField.put("inline", field.isInline()); + + jsonFields.add(jsonField); + } + + jsonEmbed.put("fields", jsonFields.toArray()); + embedObjects.add(jsonEmbed); + } + + json.put("embeds", embedObjects.toArray()); + } + + URL url = new URL(this.url); + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.addRequestProperty("Content-Type", "application/json"); + connection.addRequestProperty("User-Agent", "Java-DiscordWebhook-BY-Gelox_"); + connection.setDoOutput(true); + connection.setRequestMethod("POST"); + + OutputStream stream = connection.getOutputStream(); + stream.write(json.toString().getBytes()); + stream.flush(); + stream.close(); + + connection.getInputStream().close(); //I'm not sure why but it doesn't work without getting the InputStream + connection.disconnect(); + } + + public static class EmbedObject { + private String title; + private String description; + private String url; + private Color color; + + private Footer footer; + private Thumbnail thumbnail; + private Image image; + private Author author; + private List<Field> fields = new ArrayList<>(); + + public String getTitle() { + return title; + } + + public String getDescription() { + return description; + } + + public String getUrl() { + return url; + } + + public Color getColor() { + return color; + } + + public Footer getFooter() { + return footer; + } + + public Thumbnail getThumbnail() { + return thumbnail; + } + + public Image getImage() { + return image; + } + + public Author getAuthor() { + return author; + } + + public List<Field> getFields() { + return fields; + } + + public EmbedObject setTitle(String title) { + this.title = title; + return this; + } + + public EmbedObject setDescription(String description) { + this.description = description; + return this; + } + + public EmbedObject setUrl(String url) { + this.url = url; + return this; + } + + public EmbedObject setColor(Color color) { + this.color = color; + return this; + } + + public EmbedObject setFooter(String text, String icon) { + this.footer = new Footer(text, icon); + return this; + } + + public EmbedObject setThumbnail(String url) { + this.thumbnail = new Thumbnail(url); + return this; + } + + public EmbedObject setImage(String url) { + this.image = new Image(url); + return this; + } + + public EmbedObject setAuthor(String name, String url, String icon) { + this.author = new Author(name, url, icon); + return this; + } + + public EmbedObject addField(String name, String value, boolean inline) { + this.fields.add(new Field(name, value, inline)); + return this; + } + + private class Footer { + private String text; + private String iconUrl; + + private Footer(String text, String iconUrl) { + this.text = text; + this.iconUrl = iconUrl; + } + + private String getText() { + return text; + } + + private String getIconUrl() { + return iconUrl; + } + } + + private class Thumbnail { + private String url; + + private Thumbnail(String url) { + this.url = url; + } + + private String getUrl() { + return url; + } + } + + private class Image { + private String url; + + private Image(String url) { + this.url = url; + } + + private String getUrl() { + return url; + } + } + + private class Author { + private String name; + private String url; + private String iconUrl; + + private Author(String name, String url, String iconUrl) { + this.name = name; + this.url = url; + this.iconUrl = iconUrl; + } + + private String getName() { + return name; + } + + private String getUrl() { + return url; + } + + private String getIconUrl() { + return iconUrl; + } + } + + private class Field { + private String name; + private String value; + private boolean inline; + + private Field(String name, String value, boolean inline) { + this.name = name; + this.value = value; + this.inline = inline; + } + + private String getName() { + return name; + } + + private String getValue() { + return value; + } + + private boolean isInline() { + return inline; + } + } + } + + private class JSONObject { + + private final HashMap<String, Object> map = new HashMap<>(); + + void put(String key, Object value) { + if (value != null) { + map.put(key, value); + } + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + Set<Map.Entry<String, Object>> entrySet = map.entrySet(); + builder.append("{"); + + int i = 0; + for (Map.Entry<String, Object> entry : entrySet) { + Object val = entry.getValue(); + builder.append(quote(entry.getKey())).append(":"); + + if (val instanceof String) { + builder.append(quote(String.valueOf(val))); + } else if (val instanceof Integer) { + builder.append(Integer.valueOf(String.valueOf(val))); + } else if (val instanceof Boolean) { + builder.append(val); + } else if (val instanceof JSONObject) { + builder.append(val.toString()); + } else if (val.getClass().isArray()) { + builder.append("["); + int len = Array.getLength(val); + for (int j = 0; j < len; j++) { + builder.append(Array.get(val, j).toString()).append(j != len - 1 ? "," : ""); + } + builder.append("]"); + } + + builder.append(++i == entrySet.size() ? "}" : ","); + } + + return builder.toString(); + } + + private String quote(String string) { + return "\"" + string + "\""; + } + } +} diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java index 51ba356..b0760a0 100644 --- a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java +++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java @@ -2,198 +2,97 @@ package rosegoldaddons.utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import rosegoldaddons.commands.Backpack; -import rosegoldaddons.commands.LobbySwap; +import rosegoldaddons.commands.Rosedrobe; import rosegoldaddons.commands.Rosepet; +import scala.Int; +import tv.twitch.chat.Chat; import java.util.List; -import java.util.Locale; public class OpenSkyblockGui { - int windowId; - int windowId2; - int windowClicks = 0; - boolean openingWardrobe = false; - boolean lobbySwapping = false; - boolean openingBP = false; - boolean openingPets = false; + private static boolean openTrades = false; @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if (!rosegoldaddons.commands.Rosedrobe.openWardrobe || openingWardrobe) return; - new Thread(() -> { - try { - openingWardrobe = true; - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - List<Slot> invSlots = container.inventorySlots; - if (chestName.contains("Pets")) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(slotName)); - if (slotName.equals("Go Back")) { - clickSlot(invSlots.get(i)); - } - } - } else if (chestName.contains("SkyBlock")) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Wardrobe")) { - clickSlot(invSlots.get(i)); - if (rosegoldaddons.commands.Rosedrobe.slot == 0) - rosegoldaddons.commands.Rosedrobe.openWardrobe = false; - } - } - } else if (chestName.contains("Wardrobe")) { - if (rosegoldaddons.commands.Rosedrobe.slot != 0) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - String slotName = "Slot " + rosegoldaddons.commands.Rosedrobe.slot + ":"; - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) { - clickSlot(invSlots.get(i)); - Minecraft.getMinecraft().thePlayer.closeScreen(); - rosegoldaddons.commands.Rosedrobe.openWardrobe = false; - } - } - } + if(!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS) return; + ChatUtils.sendMessage("OpenSkyblockGui"); + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + if (Rosedrobe.openWardrobe) { + if (chestName.contains("Pets")) { + clickSlot(48, 0, 0); + clickSlot(32, 0, 1); + if (Rosedrobe.slot > 0) { + clickSlot(Rosedrobe.slot + 35, 0, 2); + Minecraft.getMinecraft().thePlayer.closeScreen(); } + Rosedrobe.openWardrobe = false; } - } - openingWardrobe = false; - } catch (Exception e) { - e.printStackTrace(); - } - }).start(); - } - - @SubscribeEvent - public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) { - if (!LobbySwap.swapLobby || lobbySwapping) return; - new Thread(() -> { - try { - lobbySwapping = true; - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - List<Slot> invSlots = container.inventorySlots; - if (chestName.contains("SkyBlock")) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Enter the Crystal Hollows")) { - clickSlot(invSlots.get(i)); - } - } - } else if (chestName.contains("Enter the")) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Confirm")) { - clickSlot(invSlots.get(i)); - LobbySwap.swapLobby = false; - } - } - Thread.sleep(2000); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(Minecraft.getMinecraft().theWorld.getWorldTime() + " ticks")); - } + } else if (openTrades) { + if (chestName.contains("Pets")) { + clickSlot(48, 0, 0); + clickSlot(22, 0, 1); + openTrades = false; } - } - lobbySwapping = false; - } catch (Exception e) { - e.printStackTrace(); - } - }).start(); - } - - @SubscribeEvent - public void guiDraw3(GuiScreenEvent.BackgroundDrawnEvent event) { - if (!Backpack.openBP || openingBP) return; - new Thread(() -> { - try { - openingBP = true; - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - List<Slot> invSlots = container.inventorySlots; - if (chestName.contains("Storage")) { - if (Backpack.bpSlot != 0) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - String slotName = "Slot " + Backpack.bpSlot; - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) { - clickSlot(invSlots.get(i)); - Backpack.openBP = false; - } - } - } + } else if (Rosepet.openPetS) { + if (chestName.contains("Pets")) { + int currPage = 1; + int lastPage = 1; + if(chestName.startsWith("(")) { + currPage = Integer.parseInt(chestName.substring(chestName.indexOf("(")+1, chestName.indexOf("/"))); + lastPage = Integer.parseInt(chestName.substring(chestName.indexOf("/")+1, chestName.indexOf(")"))); } - } - } - openingBP = false; - } catch (Exception e) { - e.printStackTrace(); - } - }).start(); - } - - @SubscribeEvent - public void guiDraw4(GuiScreenEvent.BackgroundDrawnEvent event) { - if (!Rosepet.openPetS || openingPets) return; - new Thread(() -> { - try { - openingPets = true; - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - List<Slot> invSlots = container.inventorySlots; - if (chestName.contains("Pets")) { - if (!Rosepet.name.equals("")) { - int i; - for (i = 0; i < invSlots.size(); i++) { - if (!invSlots.get(i).getHasStack()) continue; - - if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).toLowerCase().contains(Rosepet.name.toLowerCase())) { - clickSlot(invSlots.get(i)); - Rosepet.openPetS = false; - } + String petName = Rosepet.name; + int petSlot = Rosepet.petSlot; + if(petSlot != 0) { + clickSlot(petSlot - 1, 0, 0); + Rosepet.petSlot = 0; + Rosepet.openPetS = false; + return; + } + if (!petName.equals("")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains(petName)) { + clickSlot(slot.slotNumber, 0, 0); + Minecraft.getMinecraft().thePlayer.closeScreen(); + Rosepet.openPetS = false; + return; } } + if (currPage < lastPage) { + clickSlot(53, 0, 0); + } else { + Rosepet.openPetS = false; + Minecraft.getMinecraft().thePlayer.closeScreen(); + ChatUtils.sendMessage("No pet named "+petName+" found."); + } + } else { + ChatUtils.sendMessage("Invalid Pet Name"); + Rosepet.openPetS = false; } + } } - openingPets = false; - } catch (Exception e) { - e.printStackTrace(); } - }).start(); + } } - private void clickSlot(Slot slot) { - windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId; - Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 2, 0, Minecraft.getMinecraft().thePlayer); + public static void openTradesMenu() { + openTrades = true; + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); } - private void clickSlot2(Slot slot) { - if(windowClicks == 0) - windowId2 = Minecraft.getMinecraft().thePlayer.openContainer.windowId; - Minecraft.getMinecraft().playerController.windowClick(windowId + windowClicks, slot.slotNumber, 2, 0, Minecraft.getMinecraft().thePlayer); - windowClicks++; + private void clickSlot(int slot, int type, int windowAdd) { + Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); } } diff --git a/src/main/java/rosegoldaddons/utils/OutlineUtils.java b/src/main/java/rosegoldaddons/utils/OutlineUtils.java deleted file mode 100644 index 0b1bde2..0000000 --- a/src/main/java/rosegoldaddons/utils/OutlineUtils.java +++ /dev/null @@ -1,152 +0,0 @@ -package rosegoldaddons.utils; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.entity.EntityLivingBase; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.EXTPackedDepthStencil; -import rosegoldaddons.events.RenderLivingEntityEvent; - -import java.awt.*; - -import static org.lwjgl.opengl.GL11.*; - -public class OutlineUtils { - - public static void outlineESP(EntityLivingBase entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor, ModelBase modelBase, Color color) { - Minecraft mc = Minecraft.getMinecraft(); - boolean fancyGraphics = mc.gameSettings.fancyGraphics; - float gamma = mc.gameSettings.gammaSetting; - mc.gameSettings.fancyGraphics = false; - mc.gameSettings.gammaSetting = 100000F; - - GlStateManager.resetColor(); - setColor(color); - renderOne(2); - modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor); - setColor(color); - renderTwo(); - modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor); - setColor(color); - renderThree(); - modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor); - setColor(color); - renderFour(color); - modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor); - setColor(color); - renderFive(); - setColor(Color.WHITE); - - mc.gameSettings.fancyGraphics = fancyGraphics; - mc.gameSettings.gammaSetting = gamma; - } - - public static void outlineESP(RenderLivingEntityEvent event, Color color) { - Minecraft mc = Minecraft.getMinecraft(); - boolean fancyGraphics = mc.gameSettings.fancyGraphics; - float gamma = mc.gameSettings.gammaSetting; - mc.gameSettings.fancyGraphics = false; - mc.gameSettings.gammaSetting = 100000F; - - GlStateManager.resetColor(); - setColor(color); - renderOne(2); - event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor); - setColor(color); - renderTwo(); - event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor); - setColor(color); - renderThree(); - event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor); - setColor(color); - renderFour(color); - event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor); - setColor(color); - renderFive(); - setColor(Color.WHITE); - - mc.gameSettings.fancyGraphics = fancyGraphics; - mc.gameSettings.gammaSetting = gamma; - } - - public static void renderOne(final float lineWidth) { - checkSetupFBO(); - glPushAttrib(GL_ALL_ATTRIB_BITS); - glDisable(GL_ALPHA_TEST); - glDisable(GL_TEXTURE_2D); - glDisable(GL_LIGHTING); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(lineWidth); - glEnable(GL_LINE_SMOOTH); - glEnable(GL_STENCIL_TEST); - glClear(GL_STENCIL_BUFFER_BIT); - glClearStencil(0xF); - glStencilFunc(GL_NEVER, 1, 0xF); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - public static void renderTwo() { - glStencilFunc(GL_NEVER, 0, 0xF); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } - - public static void renderThree() { - glStencilFunc(GL_EQUAL, 1, 0xF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - public static void renderFour(final Color color) { - setColor(color); - glDepthMask(false); - glDisable(GL_DEPTH_TEST); - glEnable(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(1.0F, -2000000F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); - } - - public static void renderFive() { - glPolygonOffset(1.0F, 2000000F); - glDisable(GL_POLYGON_OFFSET_LINE); - glEnable(GL_DEPTH_TEST); - glDepthMask(true); - glDisable(GL_STENCIL_TEST); - glDisable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); - glEnable(GL_BLEND); - glEnable(GL_LIGHTING); - glEnable(GL_TEXTURE_2D); - glEnable(GL_ALPHA_TEST); - glPopAttrib(); - } - - public static void setColor(final Color color) { - glColor4d(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F); - } - - public static void checkSetupFBO() { - final Framebuffer fbo = Minecraft.getMinecraft().getFramebuffer(); - if (fbo != null) { - if (fbo.depthBuffer > -1) { - setupFBO(fbo); - fbo.depthBuffer = -1; - } - } - } - - private static void setupFBO(final Framebuffer fbo) { - EXTFramebufferObject.glDeleteRenderbuffersEXT(fbo.depthBuffer); - final int stencil_depth_buffer_ID = EXTFramebufferObject.glGenRenderbuffersEXT(); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - } - -} diff --git a/src/main/java/rosegoldaddons/utils/PlayerUtils.java b/src/main/java/rosegoldaddons/utils/PlayerUtils.java new file mode 100644 index 0000000..b41d047 --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/PlayerUtils.java @@ -0,0 +1,36 @@ +package rosegoldaddons.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; + +public class PlayerUtils { + public static boolean pickaxeAbilityReady = false; + + public static void swingItem() { + MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + if (movingObjectPosition != null && movingObjectPosition.entityHit == null) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + pickaxeAbilityReady = false; + } + + @SubscribeEvent + public void chat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + if (message.contains(":")) return; + if(message.contains("You used your")) { + pickaxeAbilityReady = false; + } else if(message.contains("is now available!")) { + pickaxeAbilityReady = true; + } + } +} diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java index cfd7d1d..37c6e98 100644 --- a/src/main/java/rosegoldaddons/utils/RenderUtils.java +++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java @@ -2,6 +2,7 @@ package rosegoldaddons.utils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -13,6 +14,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -102,10 +104,10 @@ public class RenderUtils { glDepthMask(false); glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : outline ? 26 : 35); - drawFilledBox(axisAlignedBB); + //drawFilledBox(axisAlignedBB); if (outline) { - glLineWidth(1F); + glLineWidth(3F); enableGlCap(GL_LINE_SMOOTH); glColor(color); @@ -176,14 +178,14 @@ public class RenderUtils { ); if (outline) { - glLineWidth(1F); + glLineWidth(3F); enableGlCap(GL_LINE_SMOOTH); glColor(color.getRed(), color.getGreen(), color.getBlue(), 95); drawSelectionBoundingBox(axisAlignedBB); } glColor(color.getRed(), color.getGreen(), color.getBlue(), outline ? 26 : 35); - drawFilledBox(axisAlignedBB); + //drawFilledBox(axisAlignedBB); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glDepthMask(true); resetCaps(); @@ -627,6 +629,87 @@ public class RenderUtils { } /** + * Modified from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 + * https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE + */ + public static void renderWaypointText(String str, double X, double Y, double Z, float partialTicks) { + GlStateManager.alphaFunc(516, 0.1F); + + GlStateManager.pushMatrix(); + + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + + double x = X - viewerX; + double y = Y - viewerY - viewer.getEyeHeight(); + double z = Z - viewerZ; + + double distSq = x * x + y * y + z * z; + double dist = Math.sqrt(distSq); + if(distSq > 144) { + x *= 12 / dist; + y *= 12 / dist; + z *= 12 / dist; + } + GlStateManager.translate(x, y, z); + GlStateManager.translate(0, viewer.getEyeHeight(), 0); + + drawNametag(str); + + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0, -0.25f, 0); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + + drawNametag(EnumChatFormatting.YELLOW.toString() + Math.round(dist) + " blocks"); + + GlStateManager.popMatrix(); + + GlStateManager.disableLighting(); + } + + public static void drawNametag(String str) { + FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.pushMatrix(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 0; + + int j = fontrenderer.getStringWidth(str) / 2; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127); + GlStateManager.depthMask(true); + + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1); + + GlStateManager.enableDepth(); + GlStateManager.enableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + + /** * GL CAP MANAGER * <p> * TODO: Remove gl cap manager and replace by something better diff --git a/src/main/java/rosegoldaddons/utils/RotationUtils.java b/src/main/java/rosegoldaddons/utils/RotationUtils.java index bb899e5..fdb17ab 100644 --- a/src/main/java/rosegoldaddons/utils/RotationUtils.java +++ b/src/main/java/rosegoldaddons/utils/RotationUtils.java @@ -55,11 +55,11 @@ public class RotationUtils { try { snek = true; KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true); - Thread.sleep(100); + Thread.sleep(50); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false); - Thread.sleep(100); + Thread.sleep(50); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true); - Thread.sleep(100); + Thread.sleep(50); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false); snek = false; } catch (Exception e) { diff --git a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java new file mode 100644 index 0000000..3dd677a --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java @@ -0,0 +1,63 @@ +package rosegoldaddons.utils; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import net.minecraft.client.Minecraft; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.StringUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +/* +* Stolen from Danker's Skyblock Mod: https://github.com/bowser0000/SkyblockMod + */ + +public class ScoreboardUtils { + public static String cleanSB(String scoreboard) { + char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray(); + StringBuilder cleaned = new StringBuilder(); + + for (char c : nvString) { + if ((int) c > 20 && (int) c < 127) { + cleaned.append(c); + } + } + + return cleaned.toString(); + } + + public static List<String> getSidebarLines() { + List<String> lines = new ArrayList<>(); + if (Minecraft.getMinecraft().theWorld == null) return lines; + Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + if (scoreboard == null) return lines; + + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + if (objective == null) return lines; + + Collection<Score> scores = scoreboard.getSortedScores(objective); + List<Score> list = scores.stream() + .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() + .startsWith("#")) + .collect(Collectors.toList()); + + if (list.size() > 15) { + scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); + } else { + scores = list; + } + + for (Score score : scores) { + ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName()); + lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName())); + } + + return lines; + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index bce7aad..4e24ddc 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,7 +1,7 @@ [ { - "modid": "RoseGoldAddons", - "name": "RoseGold Addons", + "modid": "timechanger", + "name": "RoseGoldAddons", "description": "RoseGold's QOL Modifications", "version": "${version}", "mcversion": "${mcversion}", |