diff options
Diffstat (limited to 'src/main/java')
36 files changed, 2000 insertions, 235 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index f9e11d0..ab13719 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -3,6 +3,8 @@ package rosegoldaddons; import gg.essential.vigilance.Vigilant; import gg.essential.vigilance.data.*; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.OpenSkyblockGui; import java.io.File; import java.util.Comparator; @@ -97,7 +99,7 @@ public class Config extends Vigilant { category = "Foraging", subcategory = "General", max = 500) public int postrodDelay = 150; - @Property(type = PropertyType.SWITCH, name = "Radomize Delay", description = "Add slight randomization to delay", + @Property(type = PropertyType.SWITCH, name = "Randomize Delay", description = "Add slight randomization to delay", category = "Foraging", subcategory = "General") public boolean randomizeForaging = false; @@ -121,6 +123,10 @@ public class Config extends Vigilant { category = "Mining", subcategory = "General", options = {"Closest Block", "Facing Axis"}) public int hardIndex = 0; + @Property(type = PropertyType.SWITCH, name = "Server Side Rotations", description = "Hardstone nuker's chest solver will use server side rotations for opening treasure chests", + category = "Mining", subcategory = "General") + public boolean serverSideChest = false; + @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; @@ -149,7 +155,6 @@ public class Config extends Vigilant { category = "Farming", subcategory = "General", options = {"40 BPS", "80 BPS"}) public int farmSpeedIndex = 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; @@ -183,17 +188,89 @@ public class Config extends Vigilant { public int pinglessSpeed = 0; @Property(type = PropertyType.SWITCH, name = "Auto Slayer", description = "Automatically use batphone", - category = "RoseGoldAddons", subcategory = "General") + category = "Slayer", subcategory = "General") public boolean autoSlayer = false; @Property(type = PropertyType.SWITCH, name = "Click Maddox", description = "Automatically click maddox on boss kill", - category = "RoseGoldAddons", subcategory = "General") + category = "Slayer", 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"}) + category = "Slayer", 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 = "Force Slayer", description = "Starts a slayer quest if you dont have one, restarts if it is not done after 5 minutes", + category = "Slayer", subcategory = "General") + public boolean forceSlayer = false; + + @Property(type = PropertyType.SELECTOR, name = "Anti Racism", description = "Prevent racist messages from showing up in chat", + category = "RoseGoldAddons", subcategory = "General", options = {"Censor", "Block", "None"}) + public int antiRacism = 0; + + @Property(type = PropertyType.SWITCH, name = "Pause All Macros", description = "Pause all macros on world change", + category = "Macros", subcategory = "General") + public boolean pauseAllWorldChange = false; + + @Property(type = PropertyType.SWITCH, name = "Auto Leave Limbo", description = "Automatically leaves limbo", + category = "Macros", subcategory = "General") + public boolean autoLeaveLimbo = false; + + @Property(type = PropertyType.SWITCH, name = "Join SkyBlock", description = "Automatically joins skyblock after leaving limbo", + category = "Macros", subcategory = "General") + public boolean autoLimboSB = true; + + @Property(type = PropertyType.SWITCH, name = "Enderman Move Macro", description = "Add primitive movement to enderman macro", + category = "Macros", subcategory = "Enderman") + public boolean endermanMove = false; + + @Property(type = PropertyType.SWITCH, name = "Enderman Lobby", description = "Go to lobby instead of island when switching lobbies", + category = "Macros", subcategory = "Enderman") + public boolean endermanLobby = false; + + @Property(type = PropertyType.SWITCH, name = "Randomization", description = "Random head movements when not shooting endermen", + category = "Macros", subcategory = "Enderman") + public boolean endermanRandom = false; + + @Property(type = PropertyType.SWITCH, name = "Right Click", description = "Right click instead of shifting", + category = "Macros", subcategory = "Enderman") + public boolean endermanRC = false; + + @Property(type = PropertyType.SWITCH, name = "Special Zealot Right Click", description = "Right click on special zealots (spirit sceptre recommended)", + category = "Macros", subcategory = "Enderman") + public boolean zealotRC = false; + + @Property(type = PropertyType.SWITCH, name = "Zealot Only", description = "Only target zealots", + category = "Macros", subcategory = "Enderman") + public boolean zealotOnly = false; + + @Property(type = PropertyType.SLIDER, name = "Lobby Swap Timer", description = "How many minutes to wait until finding a new lobby", + category = "Macros", subcategory = "Enderman", max = 30) + public int endermanTimer = 10; + + @Property(type = PropertyType.SWITCH, name = "Ironman Mode", description = "Lobby swap without using the bazaar", + category = "Macros", subcategory = "Enderman") + public boolean endermanIronman = false; + + @Property(type = PropertyType.SELECTOR, name = "Shifting / Right Click Speed", description = "Determine the speed of the enderman macro", + category = "Macros", subcategory = "Enderman", options = {"x2", "x1", "x0.5", "x0.25"}) + public int endermanSpeed = 1; + + @Property(type = PropertyType.SLIDER, name = "Stuck Distance", description = "Distance to block to turn away (square)", + category = "Macros", subcategory = "Enderman", max = 10) + public int endermanStuckDist = 3; + + @Property(type = PropertyType.SELECTOR, name = "Type", description = "Choose a type", + category = "Macros", subcategory = "Stranded Villagers", options = {"Cocoa", "Potato", "Sugar Cane", "Ender Pearls"}) + public int strandedType = 0; + + @Property(type = PropertyType.SLIDER, name = "Interaction Delay", description = "How many ticks to wait next interaction", + category = "Macros", subcategory = "Stranded Villagers", max = 20) + public int strandedCropDebounc = 10; + + @Property(type = PropertyType.SLIDER, name = "GUI Interaction Delay", description = "How many ticks to wait next GUI interaction", + category = "Macros", subcategory = "Stranded Villagers", max = 10) + public int strandedGUIDebounc = 5; + @Property(type = PropertyType.SELECTOR, name = "Custom Name Type", description = "ignore if you dont know what these mean", category = "RoseGoldAddons", subcategory = "General", options = {"MixinEntityPlayer", "MixinEntityPlayer + MixinEntity"}) public int nameRenderType = 0; @@ -218,6 +295,38 @@ public class Config extends Vigilant { category = "ESP", subcategory = "General") public boolean nucleusESP = false; + @Property(type = PropertyType.SWITCH, name = "Big Blocks", description = "Change levers, buttons, chests and Redstone Key skulls to 1x1x1", + category = "Dungeons", subcategory = "General") + public boolean dungeonBlocksBig = false; + + @Property(type = PropertyType.SWITCH, name = "Auto 3 Weirdos", description = "beta", + category = "Dungeons", subcategory = "General") + public boolean autoThreeWeirdos = false; + + @Property(type = PropertyType.SWITCH, name = "Force Dungeon", description = "", + category = "testing", subcategory = "General") + public boolean forceDungeon = false; + + @Property(type = PropertyType.BUTTON, name = "Sell All", description = "", + category = "testing", subcategory = "General") + public void sellAllTest() { + ChatUtils.sendMessage("Selling All!"); + Main.mc.thePlayer.sendChatMessage("/bz"); + OpenSkyblockGui.sellAll = true; + } + + @Property(type = PropertyType.SWITCH, name = "KeyBoard Event Cancel", description = "", + category = "testing", subcategory = "General") + public boolean stopKeyboard = false; + + @Property(type = PropertyType.SELECTOR, name = "Auto Click Mode", description = "", + category = "Macros", subcategory = "General", options = {"Right Click", "Left Click"}) + public int autoClickerMode = 0; + + @Property(type = PropertyType.SLIDER, name = "Auto Click CPS", description = "", + category = "Macros", subcategory = "General", min = 1, max = 1000) + public int autoClickerCPS = 10; + public Config() { 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 ebdb7d7..5a6d256 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -6,6 +6,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.event.ClickEvent; @@ -24,6 +25,7 @@ import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import rosegoldaddons.commands.*; +import rosegoldaddons.events.MillisecondEvent; import rosegoldaddons.features.*; import rosegoldaddons.utils.*; @@ -32,10 +34,18 @@ import java.net.URL; import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Paths; +import java.time.Duration; +import java.time.LocalDateTime; import java.util.*; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; -@Mod(modid = "timechanger", name = "RoseGoldAddons", version = "2.1") +@Mod(modid = Main.MOD_ID, name = "RoseGoldAddons", version = "2.9.0") public class Main { + public static final String MOD_ID = "RoseGoldAddons"; + + private static final boolean stranded = false; + public static GuiScreen display = null; public static Config configFile = Config.INSTANCE; public static KeyBinding[] keyBinds = new KeyBinding[20]; @@ -54,13 +64,14 @@ public class Main { 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; private static boolean oldanim = false; + public static boolean oringo = false; public static boolean init = false; public static boolean mithrilMacro = false; private boolean issue = false; public static boolean pauseCustom = false; + public static boolean strandedVillagers = false; public static final Minecraft mc = Minecraft.getMinecraft(); public static JsonObject rga; @@ -69,6 +80,9 @@ public class Main { private String[] cumsters = null; private String[] ILILILLILILLILILILL = null; + public static String[] cheatar = null; + public static ArrayList<String> blacklist = new ArrayList<>(); + public static HashMap<String, String> nameCache = new HashMap<>(); public static HashMap<String, String> rankCache = new HashMap<>(); public static ArrayList<String> hashedCache = new ArrayList<>(); @@ -79,6 +93,7 @@ public class Main { public void onFMLInitialization(FMLPreInitializationEvent event) { File directory = new File(event.getModConfigurationDirectory(), "rosegoldaddons"); if (!directory.exists()) { + directory.mkdirs(); } @@ -92,7 +107,6 @@ public class Main { @Mod.EventHandler public void init(FMLInitializationEvent event) { - if (issue) return; MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new AutoReady()); MinecraftForge.EVENT_BUS.register(new OpenSkyblockGui()); @@ -124,6 +138,11 @@ public class Main { MinecraftForge.EVENT_BUS.register(new ShadyRotation()); MinecraftForge.EVENT_BUS.register(new DungeonESP()); MinecraftForge.EVENT_BUS.register(new ScoreboardUtils()); + MinecraftForge.EVENT_BUS.register(new PrecEyeMacro()); + MinecraftForge.EVENT_BUS.register(new StrandedVillagerMacro()); + MinecraftForge.EVENT_BUS.register(new AutoLeaveLimbo()); + MinecraftForge.EVENT_BUS.register(new AutoThreeWeirdos()); + MinecraftForge.EVENT_BUS.register(new AutoClicker()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -134,41 +153,58 @@ public class Main { ClientCommandHandler.instance.registerCommand(new AllEntities()); ClientCommandHandler.instance.registerCommand(new SexPlayer()); - JsonArray funnynames = rga.get("funnynames").getAsJsonArray(); - cumsters = new String[funnynames.size()]; - Iterator<JsonElement> fn = funnynames.iterator(); - int count = 0; - while(fn.hasNext()) { - JsonElement name = fn.next(); - cumsters[count] = name.getAsString(); - count++; - } - JsonArray funnymessages = rga.get("funnymessages").getAsJsonArray(); - ILILILLILILLILILILL = new String[funnymessages.size()]; - Iterator<JsonElement> fm = funnymessages.iterator(); - count = 0; - while(fm.hasNext()) { - JsonElement message = fm.next(); - ILILILLILILLILILILL[count] = message.getAsString(); - count++; - } + if(!issue) { + JsonArray funnynames = rga.get("funnynames").getAsJsonArray(); + cumsters = new String[funnynames.size()]; + Iterator<JsonElement> fn = funnynames.iterator(); + int count = 0; + while (fn.hasNext()) { + JsonElement name = fn.next(); + cumsters[count] = name.getAsString(); + count++; + } + JsonArray funnymessages = rga.get("funnymessages").getAsJsonArray(); + ILILILLILILLILILILL = new String[funnymessages.size()]; + Iterator<JsonElement> fm = funnymessages.iterator(); + count = 0; + while (fm.hasNext()) { + JsonElement message = fm.next(); + ILILILLILILLILILILL[count] = message.getAsString(); + count++; + } - JsonObject replacions = rga.get("replacions").getAsJsonObject(); - Set<Map.Entry<String, JsonElement>> set = replacions.entrySet(); + JsonArray cheaters = rga.get("cheaters").getAsJsonArray(); + cheatar = new String[cheaters.size()]; + Iterator<JsonElement> ch = cheaters.iterator(); + count = 0; + while (ch.hasNext()) { + JsonElement name = ch.next(); + cheatar[count] = name.getAsString(); + count++; + } - set.forEach(stringJsonElementEntry -> { - names.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - }); + JsonObject replacions = rga.get("replacions").getAsJsonObject(); + Set<Map.Entry<String, JsonElement>> set = replacions.entrySet(); - replacions = rga.get("ranks").getAsJsonObject(); - set = replacions.entrySet(); + set.forEach(stringJsonElementEntry -> { + names.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + System.out.println(stringJsonElementEntry.getKey() + ": " + stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + }); - set.forEach(stringJsonElementEntry -> { - ranks.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - }); - init = true; + replacions = rga.get("ranks").getAsJsonObject(); + set = replacions.entrySet(); + + set.forEach(stringJsonElementEntry -> { + ranks.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + System.out.println(stringJsonElementEntry.getKey() + ": " + stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + }); + + JsonArray jsonArray = rga.get("blacklist").getAsJsonArray(); + for(JsonElement jsonElement : jsonArray) { + blacklist.add(jsonElement.getAsString()); + } + init = true; + } try { Reader reader = Files.newBufferedReader(Paths.get("./config/rosegoldaddons/rcmacros.json")); @@ -208,7 +244,7 @@ public class Main { 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[3] = new KeyBinding("Powder Chest 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"); @@ -222,13 +258,15 @@ public class Main { 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"); - keyBinds[18] = new KeyBinding("Mithril Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); - keyBinds[19] = new KeyBinding("Peek Custom Names", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[17] = new KeyBinding("Mithril Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[18] = new KeyBinding("Toggle Custom Names", Keyboard.KEY_NONE, "RoseGoldAddons"); + keyBinds[19] = new KeyBinding("Toggle Stranded Villager Trading", Keyboard.KEY_NONE, "RoseGoldAddons"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); } + + AutoClicker.init(); } @Mod.EventHandler @@ -237,19 +275,36 @@ public class Main { if (modContainer.getModId().equals("oldanimations")) { oldanim = true; } + if (modContainer.getModId().equals("examplemod")) { + oringo = true; + } }); + + LocalDateTime now = LocalDateTime.now(); + LocalDateTime firstRun = now.withSecond(0).plusMinutes(1); + Duration initialDelay = Duration.between(now, firstRun); + Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> { + System.out.println("Reset hashed cache!"); + hashedCache.clear(); + }, initialDelay.getSeconds(), 600, TimeUnit.SECONDS); + + Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> MinecraftForge.EVENT_BUS.post(new MillisecondEvent()), initialDelay.getSeconds(), 1, TimeUnit.MILLISECONDS); + } @SubscribeEvent public void onWorldChange(WorldEvent.Unload event) { - if(forageOnIsland || nukeWood || nukeCrops || mithrilNuker || gemNukeToggle || mithrilMacro) { - ChatUtils.sendMessage("§cDetected World Change, Stopping All Macros"); - forageOnIsland = false; - nukeWood = false; - nukeCrops = false; - mithrilNuker = false; - gemNukeToggle = false; - mithrilMacro = false; + if(configFile.pauseAllWorldChange) { + if (forageOnIsland || nukeWood || nukeCrops || mithrilNuker || gemNukeToggle || mithrilMacro || autoHardStone) { + ChatUtils.sendMessage("§cDetected World Change, Stopping All Macros"); + forageOnIsland = false; + nukeWood = false; + nukeCrops = false; + mithrilNuker = false; + gemNukeToggle = false; + mithrilMacro = false; + autoHardStone = false; + } } } @@ -258,8 +313,8 @@ public class Main { if (event.phase != TickEvent.Phase.START) return; if(mc.thePlayer == null || mc.theWorld == null) return; if(firstLoginThisSession) { - ChatComponentText msg1 = new ChatComponentText("§0§7Thanks to ShadyAddons:§b https://cheatersgetbanned.me"); - msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://cheatersgetbanned.me")); + ChatComponentText msg1 = new ChatComponentText("§0§7Thanks to ShadyAddons:§b https://shadyaddons.com/"); + msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://shadyaddons.com/")); 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§7Thanks to pizza boy (Pizza Client):§b https://github.com/PizzaboiBestLegit/Pizza-Client"); @@ -271,7 +326,13 @@ public class Main { mc.thePlayer.addChatMessage(msg3); mc.thePlayer.addChatMessage(msg4); if(oldanim) { - ChatUtils.sendMessage("§l§4Old Animations Mod was detected in your mods folder. This mod breaks some key RoseGoldAddons features, please uninstall it before asking for support as it is known to cause a lot of issues. Thanks."); + ChatUtils.sendMessage("§l§cOld Animations Mod was detected in your mods folder. This mod breaks some key RoseGoldAddons features, please uninstall it before asking for support as it is known to cause a lot of issues. Thanks."); + } + if(oringo) { + ChatUtils.sendMessage("§l§cDetected Oringo Client loaded, server side rotations will not work during this session if oringo version is before 1.7.0."); + } + if(issue) { + ChatUtils.sendMessage("§l§cAn error has occurred while retrieving info from the RoseGoldAddons database, certain features will not work during this session"); } firstLoginThisSession = false; } @@ -289,14 +350,9 @@ public class Main { } @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - pauseCustom = keyBinds[19].isKeyDown(); - } - - @SubscribeEvent public void key(InputEvent.KeyInputEvent event) { int rnd = new Random().nextInt(configFile.skiblock); - if(rnd == 0 && configFile.funnyStuff) { + if(rnd == 0 && configFile.funnyStuff && init) { mc.thePlayer.addChatMessage(new ChatComponentText((cumsters[new Random().nextInt(cumsters.length)].replace("&","§")+"§7: "+i(ILILILLILILLILILILL[new Random().nextInt(ILILILLILILLILILILL.length)])))); } if (keyBinds[0].isPressed()) { @@ -306,12 +362,30 @@ public class Main { } else if (keyBinds[1].isPressed()) { endermanMacro = !endermanMacro; String str = endermanMacro ? "§aZealot Macro Activated" : "§cZealot Macro Deactivated"; + EndermanMacro.ticks = 0; ChatUtils.sendMessage(str); + if(endermanMacro) { + EndermanMacro.ms = System.currentTimeMillis(); + if(configFile.endermanMove) { + if(Main.configFile.endermanIronman) { + ChatUtils.sendMessage("Needed: " + "§6Precursor Eye§f, §b/warp drag§f, Chest near island spawn"); + } else { + if (Main.configFile.endermanTimer != 0) { + ChatUtils.sendMessage("Needed: " + "§6Precursor Eye§f, §b/warp drag§f, §b/bz"); + } else { + ChatUtils.sendMessage("Needed: " + "§6Precursor Eye§f"); + } + } + ChatUtils.sendMessage("Recommended to hold a §6Spirit Sceptre"); + } else { + ChatUtils.sendMessage("Needed: "+"§6Precursor Eye"); + } + } } else if (keyBinds[2].isPressed()) { AutoArrowAlign.cheat(); } else if (keyBinds[3].isPressed()) { powderMacro = !powderMacro; - String str = powderMacro ? "§aPowder Macro Activated" : "§cPowder Macro Deactivated"; + String str = powderMacro ? "§aPowder Chest Macro Activated" : "§cPowder Chest Macro Deactivated"; ChatUtils.sendMessage(str); } else if (keyBinds[4].isPressed()) { AOTSMacro = !AOTSMacro; @@ -364,13 +438,23 @@ public class Main { 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); - } else if(keyBinds[18].isPressed()) { mithrilMacro = !mithrilMacro; String str = mithrilMacro ? "§aMithril Macro Activated" : "§cMithril Macro Deactivated"; ChatUtils.sendMessage(str); + } else if(keyBinds[18].isPressed()) { + pauseCustom = !pauseCustom; + ChatUtils.sendMessage(pauseCustom ? "§cCustom Names Deactivated" : "§aCustom Names Activated"); + } else if(keyBinds[19].isPressed()) { + if(stranded) { + strandedVillagers = !strandedVillagers; + StrandedVillagerMacro.drop = false; + StrandedVillagerMacro.dropped = false; + StrandedVillagerMacro.trade = false; + StrandedVillagerMacro.traded = false; + StrandedVillagerMacro.emptySack = false; + StrandedVillagerMacro.emptied = false; + ChatUtils.sendMessage(strandedVillagers ? "§aStranded Villager Trading Activated" : "§cStranded Villager Trading Deactivated"); + } } } diff --git a/src/main/java/rosegoldaddons/events/MillisecondEvent.java b/src/main/java/rosegoldaddons/events/MillisecondEvent.java new file mode 100644 index 0000000..4ea5160 --- /dev/null +++ b/src/main/java/rosegoldaddons/events/MillisecondEvent.java @@ -0,0 +1,13 @@ +package rosegoldaddons.events; + +import net.minecraftforge.fml.common.eventhandler.Event; + +import java.time.LocalDateTime; + +public class MillisecondEvent extends Event { + public LocalDateTime dateTime; + + public MillisecondEvent() { + dateTime = LocalDateTime.now(); + } +}
\ No newline at end of file diff --git a/src/main/java/rosegoldaddons/events/PlayerMoveEvent.java b/src/main/java/rosegoldaddons/events/PlayerMoveEvent.java new file mode 100644 index 0000000..cab6637 --- /dev/null +++ b/src/main/java/rosegoldaddons/events/PlayerMoveEvent.java @@ -0,0 +1,12 @@ +package rosegoldaddons.events; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class PlayerMoveEvent extends Event { + @Cancelable + public static class Pre extends Event {} + + public static class Post extends Event {} +} diff --git a/src/main/java/rosegoldaddons/events/ScreenClosedEvent.java b/src/main/java/rosegoldaddons/events/ScreenClosedEvent.java new file mode 100644 index 0000000..bee57c4 --- /dev/null +++ b/src/main/java/rosegoldaddons/events/ScreenClosedEvent.java @@ -0,0 +1,10 @@ +package rosegoldaddons.events; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class ScreenClosedEvent extends Event { + + public ScreenClosedEvent() {} +} diff --git a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java index f726052..b937f8a 100644 --- a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java +++ b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java @@ -1,6 +1,5 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityWither; diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index db9650f..de502c4 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -32,7 +32,7 @@ public class AutoArrowAlign { private static final Map<BlockPos, Integer> clicksPerFrame = new HashMap<>(); private static final Map<BlockPos, Integer> toClickMap = new HashMap<>(); private static boolean init = false; - private static final BlockPos topLeft = new BlockPos(196, 125, 278); + private static final BlockPos topLeft = new BlockPos(196 - 100, 125, 278 - 100); /*@SubscribeEvent public void debugging(TickEvent.ClientTickEvent event) { @@ -336,6 +336,6 @@ public class AutoArrowAlign { private static boolean isInSection3() { int x = Main.mc.thePlayer.getPosition().getX(); int z = Main.mc.thePlayer.getPosition().getZ(); - return x < 218 && z > 251 && x > 196 && z < 319; + return x < (218 - 200) && z > (251 - 200) && x > (196 - 200) && z < (319 - 200); } } diff --git a/src/main/java/rosegoldaddons/features/AutoClicker.java b/src/main/java/rosegoldaddons/features/AutoClicker.java new file mode 100644 index 0000000..0411df3 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoClicker.java @@ -0,0 +1,80 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import org.lwjgl.input.Keyboard; +import rosegoldaddons.Main; +import rosegoldaddons.events.MillisecondEvent; +import rosegoldaddons.utils.ChatUtils; + +import java.lang.reflect.Method; + +public class AutoClicker { + private static final KeyBinding keyBinding = new KeyBinding("Auto Clicker", Keyboard.KEY_NONE, "RoseGoldAddons - Combat"); + private boolean toggled = false; + private int count = 0; + private long startedAt = 0; + private long lastClickTime = 0; + + @SubscribeEvent + public void onMillisecond(MillisecondEvent event) { + if(!toggled) return; + if(System.currentTimeMillis() - lastClickTime < (long) (1000 / Main.configFile.autoClickerCPS)) return; + switch (Main.configFile.autoClickerMode) { + case 1: + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; + if (movingObjectPosition != null && movingObjectPosition.entityHit != null) { + Main.mc.playerController.attackEntity(Main.mc.thePlayer, movingObjectPosition.entityHit); + Main.mc.thePlayer.swingItem(); + count++; + } else if (movingObjectPosition != null) { + Main.mc.thePlayer.swingItem(); + } + break; + case 0: + rightClick(); + count++; + break; + } + lastClickTime = System.currentTimeMillis(); + } + + @SubscribeEvent + public void onKeyInput(InputEvent.KeyInputEvent event) { + int eventKey = Keyboard.getEventKey(); + if(eventKey != keyBinding.getKeyCode()) return; + if(Keyboard.isKeyDown(eventKey)) { + if(!toggled) { + toggled = true; + count = 0; + startedAt = System.currentTimeMillis(); + } + } else { + toggled = false; + ChatUtils.sendMessage(String.format("%s Clicks in %s milliseconds", count, System.currentTimeMillis() - startedAt)); + } + } + + public static void init() { + ClientRegistry.registerKeyBinding(keyBinding); + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java b/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java new file mode 100644 index 0000000..407965f --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java @@ -0,0 +1,37 @@ +package rosegoldaddons.features; + +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ScoreboardUtils; + +public class AutoLeaveLimbo { + private int deb = 0; + private boolean playSb = false; + private int prev = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(!Main.configFile.autoLeaveLimbo || Main.endermanMacro) return; + if(event.phase == TickEvent.Phase.END) return; + if(deb > 0) deb--; + if(deb != 0) return; + deb = 20; + if(ScoreboardUtils.inLimbo) { + if(prev < 10) { + prev++; + } else { + Main.mc.thePlayer.sendChatMessage("/l"); + prev = 0; + playSb = true; + return; + } + } else { + prev = 0; + } + if(!ScoreboardUtils.inSkyblock && playSb && Main.configFile.autoLimboSB) { + Main.mc.thePlayer.sendChatMessage("/play sb"); + playSb = false; + } + } +} diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java index 64b173a..09c7c51 100644 --- a/src/main/java/rosegoldaddons/features/AutoSlayer.java +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -25,6 +25,8 @@ public class AutoSlayer { private static boolean openMaddox = false; private static boolean startSlayer = false; private static boolean waitingForMaddox = false; + private static boolean restart = false; + private static int countdown = 0; private static int slayerSlot = 0; private static int slotLevel = 0; private static int debounce = 0; @@ -46,12 +48,12 @@ public class AutoSlayer { } @SubscribeEvent - public void onInteract(InputEvent.KeyInputEvent event) { + public void interactHandler(TickEvent.ClientTickEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(ScoreboardUtils.inPrivateIsland) return; if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox || debounce != 0) return; - List<String> scoreboard = ScoreboardUtils.getSidebarLines(); - for (String line : scoreboard) { - String cleanedLine = ScoreboardUtils.cleanSB(line); - if (cleanedLine.contains("Boss slain!")) { + if (Main.configFile.forceSlayer) { + if (!ScoreboardUtils.scoreboardContains("Slay the boss!") && !ScoreboardUtils.scoreboardContains("Kills") && !ScoreboardUtils.scoreboardContains("Combat XP")) { int maddox = findItemInHotbar("Batphone"); if (maddox != -1) { ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); @@ -60,7 +62,44 @@ public class AutoSlayer { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); Main.mc.thePlayer.inventory.currentItem = save; waitingForMaddox = true; - break; + restart = false; + } + } + if (ScoreboardUtils.scoreboardContains("Slay the boss!")) { + if (!restart) { + countdown = 800; + restart = true; + } else { + if (countdown > 0) { + if (countdown % 40 == 0) { + ChatUtils.sendMessage("§ccountdown: " + countdown / 40); + } + countdown--; + } else { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); + int save = Main.mc.thePlayer.inventory.currentItem; + Main.mc.thePlayer.inventory.currentItem = maddox; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); + Main.mc.thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + restart = false; + } + } + } + } + } else { + if (ScoreboardUtils.scoreboardContains("Boss slain!")) { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); + int save = Main.mc.thePlayer.inventory.currentItem; + Main.mc.thePlayer.inventory.currentItem = maddox; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); + Main.mc.thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + restart = false; } } } @@ -133,13 +172,26 @@ public class AutoSlayer { List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; if (!chestInventory.get(13).getHasStack()) return; if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { - + if (Main.configFile.forceSlayer) { + clickSlot(13, 2, 0); + clickSlot(11, 2, 1); + clickSlot(slayerSlot, 2, 2); + clickSlot(slotLevel, 2, 3); + clickSlot(11, 2, 4); //confirm + debounce = 80; + } } else if (chestInventory.get(13).getStack().getDisplayName().contains("Complete")) { clickSlot(13, 2, 0); clickSlot(slayerSlot, 2, 1); clickSlot(slotLevel, 2, 2); clickSlot(11, 2, 3); //confirm debounce = 80; + } else if (chestInventory.get(13).getStack().getDisplayName().contains("Failed")) { + clickSlot(13, 2, 0); + clickSlot(slayerSlot, 2, 1); + clickSlot(slotLevel, 2, 2); + clickSlot(11, 2, 3); //confirm + debounce = 80; } else { clickSlot(slayerSlot, 2, 0); clickSlot(slotLevel, 2, 1); diff --git a/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java b/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java new file mode 100644 index 0000000..d96e804 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java @@ -0,0 +1,169 @@ +package rosegoldaddons.features; + +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StringUtils; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +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.ScoreboardUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +/* + * Solver blatantly copied from DSM: https://github.com/bowser0000/SkyblockMod + */ + +public class AutoThreeWeirdos { + private static final ArrayList<String> solutions = new ArrayList<>(Arrays.asList( + "The reward is not in my chest!", + "At least one of them is lying, and the reward is not in", + "My chest doesn't have the reward. We are all telling the truth", + "My chest has the reward and I'm telling the truth", + "The reward isn't in any of our chests", + "Both of them are telling the truth." + )); + + private static final ArrayList<String> weirdos = new ArrayList<>(Arrays.asList( + "Baxter", "Benson", "Eveleth", "Hope", "Luverne", "Madelia", "Rose", "Victoria", "Morris", "Carver", "Ardis", "Lino", + "Elmo", "Virginia", "Montgomery", "Winona", "Melrose", "Marshall", "Hugo", "Willmar", "Ramsey" + )); + + private static BlockPos riddleChest = null; + private static boolean talked = false; + private static boolean opened = false; + private static int debounce = 0; + + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if(!Main.configFile.autoThreeWeirdos || opened || !ScoreboardUtils.inDungeon) return; + String message = removeFormatting(event.message.getUnformattedText()); + if (message.startsWith("[NPC]")) { + for (String solution : solutions) { + if (message.contains(solution)) { + String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); + if (riddleChest == null) { + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (Main.mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + ChatUtils.sendMessage("Could not find correct riddle chest."); + } + break; + } + } + } + break; + } + } + } + else if(message.startsWith("PUZZLE") && message.contains("wasn't fooled by")) { + opened = true; + talked = true; + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(!Main.configFile.autoThreeWeirdos || opened || !ScoreboardUtils.inDungeon) return; + if(Main.mc.theWorld == null || Main.mc.thePlayer == null) return; + if(event.phase == TickEvent.Phase.END) return; + if(debounce > 0) debounce--; + if(debounce != 0) return; + if(!talked) { + debounce = 5; + if(!allWeirdosInRange()) return; + interactWithWeirdos(); + talked = true; + } else { + if(riddleChest != null) { + debounce = 10; + interactWithChest(); + } + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + riddleChest = null; + opened = false; + talked = false; + } + + private static boolean allWeirdosInRange() { + int count = 0; + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + String name = removeFormatting(entity.getCustomNameTag()); + if(weirdos.contains(name)) { + float range = entity.getDistanceToEntity(Main.mc.thePlayer); + if(range < 4) { + count++; + } + } + } + if(count == 1 || count == 2) { + ChatUtils.sendMessage("Detected an incorrect amount of weirdos in range, try moving closer or DMing RoseGold#5441 the names of the weirdos"); + } + return count == 3 || count == 2; + } + + private static void interactWithWeirdos() { + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + String name = removeFormatting(entity.getCustomNameTag()); + if(weirdos.contains(name)) { + interactWithEntity(entity); + } + } + } + + private static void interactWithChest() { + Vec3 playerPos = Main.mc.thePlayer.getPositionEyes(1f); + if(playerPos.distanceTo(new Vec3(riddleChest.getX() + 0.5, riddleChest.getY() + 0.5, riddleChest.getZ() + 0.5)) > 5) { + ChatUtils.sendMessage("§cWalk closer to chest!"); + } + if(Main.mc.playerController.onPlayerRightClick( + Main.mc.thePlayer, + Main.mc.theWorld, + Main.mc.thePlayer.inventory.getCurrentItem(), + riddleChest, + EnumFacing.fromAngle(Main.mc.thePlayer.rotationYaw), + new Vec3(Math.random(), Math.random(), Math.random()) + )) { + Main.mc.thePlayer.swingItem(); + opened = true; + } + } + + private static void interactWithEntity(Entity entity) { + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); + } + + private static String removeFormatting(String input) { + return input.replaceAll("§[0-9a-fk-or]", ""); + } + +} diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 37b4ce3..7f6e179 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -1,18 +1,12 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -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.commands.UseCooldown; -import java.lang.reflect.Method; - public class CustomItemMacro { private Thread thread; private int milis = 0; diff --git a/src/main/java/rosegoldaddons/features/DungeonESP.java b/src/main/java/rosegoldaddons/features/DungeonESP.java index b611fe9..958a5e3 100644 --- a/src/main/java/rosegoldaddons/features/DungeonESP.java +++ b/src/main/java/rosegoldaddons/features/DungeonESP.java @@ -1,7 +1,6 @@ package rosegoldaddons.features; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.player.EntityPlayer; @@ -9,9 +8,9 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.ScoreboardUtils; @@ -23,6 +22,7 @@ import java.util.List; public class DungeonESP { private static HashMap<Entity, Color> highlightedEntities = new HashMap<>(); private static HashSet<Entity> checkedStarNameTags = new HashSet<>(); + private int ticks = 0; private static void highlightEntity(Entity entity, Color color) { highlightedEntities.put(entity, color); @@ -55,11 +55,10 @@ public class DungeonESP { @SubscribeEvent public void onRenderEntityLiving(RenderLivingEntityEvent event) { - if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity)) - return; + if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity)) return; if (event.entity instanceof EntityArmorStand) { - if (event.entity.hasCustomName() && event.entity.getCustomNameTag().contains("✯")) { - List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().expand(0, 3, 0), entity -> !(entity instanceof EntityArmorStand)); + if (event.entity.hasCustomName() && (event.entity.getCustomNameTag().contains("✯") || event.entity.getCustomNameTag().contains("__rga"))) { + List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().offset(0, -1, 0), entity -> !(entity instanceof EntityArmorStand)); if (!possibleEntities.isEmpty()) { highlightEntity(possibleEntities.get(0), Color.ORANGE); } @@ -80,6 +79,15 @@ public class DungeonESP { } @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(ticks % 40 == 0) { + checkedStarNameTags.clear(); + ticks = 0; + } + ticks++; + } + + @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { highlightedEntities.clear(); checkedStarNameTags.clear(); diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index 0e99af4..ecd82d2 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -1,62 +1,280 @@ package rosegoldaddons.features; -import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBanner; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; 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.ShadyRotation; +import rosegoldaddons.utils.*; import java.awt.*; +import java.util.List; +import java.util.Random; public class EndermanMacro { + private final KeyBinding sneak = Minecraft.getMinecraft().gameSettings.keyBindSneak; + private final KeyBinding walkForward = Minecraft.getMinecraft().gameSettings.keyBindForward; + private final KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump; + private final KeyBinding sprint = Minecraft.getMinecraft().gameSettings.keyBindSprint; + public static long ms = -1; private static Entity enderman; + public static int ticks = 0; + public static int pausedTicks = 0; + private boolean sneaking = false; + private boolean moving = false; + private boolean pauseMacro = false; + private boolean sold = false; + private boolean stored = false; + private boolean sentl = false; + private int totalShifts = 0; + private int mainDeb = 0; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) return; + ticks++; if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; - if(event.phase == TickEvent.Phase.END) return; + if (ticks % Math.pow(2, Main.configFile.endermanSpeed) != 0) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if(mainDeb != 0) return; + sold = false; + stored = false; enderman = getClosestEnderman(); - if(enderman != null && Main.endermanMacro && !ShadyRotation.running) { - ShadyRotation.smoothLook(ShadyRotation.getRotationToEntity(enderman), Main.configFile.smoothLookVelocity, () -> { - KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); - KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); + if (Main.endermanMacro && !ShadyRotation.running) { + if (enderman != null) { + ShadyRotation.smoothLook( + ShadyRotation.getRotationToEntity(enderman), + Main.configFile.smoothLookVelocity, + () -> { + if (!sneaking && totalShifts % 2 == 0) { + if(Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem) != null) { + if(Main.configFile.endermanRC || (Main.configFile.zealotRC && enderman instanceof EntityEnderman && ((EntityEnderman) enderman).getHeldBlockState().getBlock() == Blocks.end_portal_frame)) + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + } + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), true); + KeyBinding.setKeyBindState(jump.getKeyCode(), true); + totalShifts++; + sneaking = true; + } + }); + } else { + KeyBinding.setKeyBindState(jump.getKeyCode(), true); + if(Main.configFile.zealotOnly) { + if(ScoreboardUtils.inLimbo) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/l"); + return; + } + if(!ScoreboardUtils.inSkyblock) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/play sb"); + return; + } + if (!ScoreboardUtils.inDragonNest) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/warp drag"); + return; + } + } + if(Main.configFile.endermanRandom && !ShadyRotation.runningAsync) { + ShadyRotation.smoothLook( + new ShadyRotation.Rotation(new Random().nextInt(30), Main.mc.thePlayer.rotationYaw + new Random().nextInt(80)-40), + 10, + () -> {}, + true + ); + } + } + } + } - if(!Main.mc.thePlayer.movementInput.sneak) { - Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); - Main.mc.thePlayer.movementInput.sneak = true; + @SubscribeEvent + public void movementControl(TickEvent.ClientTickEvent event) { + if (!Main.configFile.endermanMove) return; + if (event.phase == TickEvent.Phase.END) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if (Main.endermanMacro) { + if (pausedTicks % 40 != 0) return; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), true); + KeyBinding.setKeyBindState(sprint.getKeyCode(), true); + moving = true; + if (Main.configFile.endermanTimer != 0 && ticks > Main.configFile.endermanTimer * 1200) { + pauseMacro = true; + moving = false; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), false); + KeyBinding.setKeyBindState(jump.getKeyCode(), false); + KeyBinding.setKeyBindState(sprint.getKeyCode(), false); + KeyBinding.setKeyBindState(sneak.getKeyCode(), false); + if (OpenSkyblockGui.selling || OpenSkyblockGui.storing) return; + if(!Main.configFile.endermanIronman) { + if (!sold) { + OpenSkyblockGui.sellAll = true; + OpenSkyblockGui.selling = true; + Main.mc.thePlayer.sendChatMessage("/bz"); + sold = true; + return; + } + } + if (Main.configFile.endermanLobby) { + if (ScoreboardUtils.inDragonNest) { + if(!sentl) { + Main.mc.thePlayer.sendChatMessage("/l"); + sentl = true; + return; + } else { + ChatUtils.sendMessage("Successfully rejoined a new lobby, macro uptime: "+millisToHours(ms)); + pauseMacro = false; + ticks = 0; + sentl = false; + } + } else { + if(ScoreboardUtils.inSkyblock && !ScoreboardUtils.inPrivateIsland) { + Main.mc.thePlayer.sendChatMessage("/is"); + } + if(ScoreboardUtils.inPrivateIsland) { + if(Main.configFile.endermanIronman && !stored) { + OpenSkyblockGui.storeInChest = true; + stored = true; + return; + } + Main.mc.thePlayer.sendChatMessage("/warp drag"); + } + } + if (!ScoreboardUtils.inSkyblock) { + Main.mc.thePlayer.sendChatMessage("/play sb"); + } } else { - Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); - Main.mc.thePlayer.movementInput.sneak = false; + if (ScoreboardUtils.inDragonNest) { + Main.mc.thePlayer.sendChatMessage("/is"); + } + if (ScoreboardUtils.inPrivateIsland) { + if(Main.configFile.endermanIronman && !stored) { + OpenSkyblockGui.storeInChest = true; + stored = true; + return; + } + Main.mc.thePlayer.sendChatMessage("/warp drag"); + pauseMacro = false; + ticks = 0; + } } - }); + } + } else { + if (!moving) return; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), false); + KeyBinding.setKeyBindState(jump.getKeyCode(), false); + KeyBinding.setKeyBindState(sprint.getKeyCode(), false); + moving = false; + } + } + + @SubscribeEvent + public void debounce(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) pausedTicks++; + if(mainDeb > 0) mainDeb--; + } + + @SubscribeEvent + public void stuckControl(TickEvent.ClientTickEvent event) { + if (!Main.endermanMacro || !Main.configFile.endermanMove) return; + if(event.phase == TickEvent.Phase.END) return; + if (Main.mc.objectMouseOver != null && Main.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + BlockPos lookingAt = Main.mc.objectMouseOver.getBlockPos(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + if(playerPos.distanceSq(lookingAt) > Main.configFile.endermanStuckDist) return; + switch (Main.mc.thePlayer.getHorizontalFacing()) { + case NORTH: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 270), Main.configFile.smoothLookVelocity, () -> {}); + break; + case EAST: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 0), Main.configFile.smoothLookVelocity, () -> {}); + break; + case SOUTH: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 90), Main.configFile.smoothLookVelocity, () -> {}); + break; + case WEST: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 180), Main.configFile.smoothLookVelocity, () -> {}); + break; + } + } + } + + @SubscribeEvent + public void sneakControl(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if (ticks % Math.pow(2, Main.configFile.endermanSpeed) != 0) return; + if(totalShifts % 2 == 1) { + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), true); + totalShifts++; + sneaking = true; + return; + } + if (sneaking) { + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), false); + sneaking = false; } } @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { if (!Main.configFile.EndermanESP) return; - if (enderman == null) return; - RenderUtils.drawEntityBox(enderman, Color.RED, Main.configFile.lineWidth, event.partialTicks); + if (enderman != null) { + RenderUtils.drawEntityBox(enderman, Color.RED, Main.configFile.lineWidth, event.partialTicks); + } + } + + private static String millisToHours(long millis) { + long curr = System.currentTimeMillis(); + int seconds = (int) ((curr - millis)/1000); + return String.format("%02d:%02d:%02d", seconds/3600, (seconds%3600)/60, seconds%60); } private static Entity getClosestEnderman() { Entity eman = null; double closest = 9999; - if(Main.mc.theWorld == null) return null; + if (Main.mc.theWorld == null) return null; for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0) && Main.mc.thePlayer.canEntityBeSeen(entity1)) { + if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0)) { + if(((EntityEnderman) entity1).getHeldBlockState().getBlock() == Blocks.end_portal_frame) { + double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); + if(dist < 40) return entity1; + } + if(!Main.mc.thePlayer.canEntityBeSeen(entity1)) continue; + if(Main.configFile.zealotOnly) { + Entity armorStand = null; + List<Entity> possibleEntities = entity1.getEntityWorld().getEntitiesInAABBexcluding(entity1, entity1.getEntityBoundingBox().expand(0, 4, 0), entity -> !(entity instanceof EntityEnderman)); + for (Entity en : possibleEntities) { + if (en instanceof EntityArmorStand) { + armorStand = en; + break; + } + } + if (armorStand == null) return null; + if (!armorStand.getCustomNameTag().contains("Zealot")) continue; + } double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { - if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { + 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/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index bf37569..d5c0fa4 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -37,11 +37,14 @@ public class ForagingIslandMacro { if(sapling == -1) { sapling = findItemInHotbar("Oak Sapling"); } + if(sapling == -1) { + sapling = findItemInHotbar("Spruce Sapling"); + } int bonemeal = findItemInHotbar("Bone Meal"); int treecap = findItemInHotbar("Treecapitator"); int rod = findItemInHotbar("Rod"); if(sapling == -1) { - ChatUtils.sendMessage("§cNo jungle saplings in hotbar"); + ChatUtils.sendMessage("§cNo saplings in hotbar"); } if(bonemeal == -1) { ChatUtils.sendMessage("§cNo bonemeal in hotbar"); diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 62a10dc..8a35e06 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -14,13 +14,17 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; +import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.events.PlayerMoveEvent; import rosegoldaddons.events.ReceivePacketEvent; +import rosegoldaddons.events.ScreenClosedEvent; import rosegoldaddons.utils.*; import scala.concurrent.impl.CallbackRunnable; @@ -33,6 +37,7 @@ public class HardstoneAura { private static int currentDamage; private static BlockPos closestStone; private static Vec3 closestChest; + private static Vec3 particlePos; private boolean stopHardstone = false; private static int ticks = 0; private static BlockPos gemstone; @@ -46,24 +51,28 @@ public class HardstoneAura { return; } if (!stopHardstone) { + particlePos = null; ticks++; - if(Main.configFile.hardIndex == 0) { + if (Main.configFile.hardIndex == 0) { if (broken.size() > 10) { broken.clear(); } } - if(Main.configFile.hardIndex == 1) { + if (Main.configFile.hardIndex == 1) { if (broken.size() > 6) { broken.clear(); } } - if(ticks > 20) { + if (ticks > 30) { broken.clear(); ticks = 0; } closestStone = closestStone(); - if(gemstone != null && Main.mc.thePlayer != null) { - if(lastGem != null && !lastGem.equals(gemstone)) { + if (currentDamage > 200) { + currentDamage = 0; + } + if (gemstone != null && Main.mc.thePlayer != null) { + if (lastGem != null && !lastGem.equals(gemstone)) { currentDamage = 0; } lastGem = gemstone; @@ -98,25 +107,52 @@ public class HardstoneAura { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> {}); + if (!Main.configFile.serverSideChest) { + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> { + }); + } else { + HardstoneAura.particlePos = particlePos; + } } } } } } + @SubscribeEvent(priority = EventPriority.NORMAL) + public void onUpdatePre(PlayerMoveEvent.Pre pre) { + if (particlePos != null && Main.configFile.serverSideChest) { + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), 0, () -> { + }); + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void chat(ClientChatReceivedEvent event) { + if (event.type != 0) return; + String message = event.message.getUnformattedText(); + if(message.contains("You have successfully picked the lock on this chest!")) { + if(particlePos != null && stopHardstone) { + solved.add(closestChest); + particlePos = null; + stopHardstone = false; + } + } + } + @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if(Main.configFile.guilag) { + if (Main.configFile.guilag) { Main.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); } - if(!Main.autoHardStone) return; + 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); + particlePos = null; stopHardstone = false; Main.mc.thePlayer.closeScreen(); } @@ -172,9 +208,9 @@ public class HardstoneAura { } private BlockPos closestStone() { - if(Main.mc.theWorld == null) return null; - if(Main.mc.thePlayer == null) return null; - int r = 5; + if (Main.mc.theWorld == null) return null; + if (Main.mc.thePlayer == null) return null; + int r = 4; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); @@ -185,7 +221,7 @@ public class HardstoneAura { if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - if(Main.configFile.hardIndex == 0) { + if (Main.configFile.hardIndex == 0) { if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -193,40 +229,41 @@ public class HardstoneAura { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } } - if(Main.configFile.hardIndex == 1) { + if (Main.configFile.hardIndex == 1) { EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); int x = (int) Math.floor(Main.mc.thePlayer.posX); - int z = (int) Math.floor(Main.mc.thePlayer.posZ); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: - if(blockPos.getZ() <= z && blockPos.getX() == x) { - if(isSlow(blockState)) { + if (blockPos.getZ() <= z && blockPos.getX() == x) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -234,23 +271,23 @@ public class HardstoneAura { } break; case SOUTH: - if(blockPos.getZ() >= z && blockPos.getX() == x) { - if(isSlow(blockState)) { + if (blockPos.getZ() >= z && blockPos.getX() == x) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -258,23 +295,23 @@ public class HardstoneAura { } break; case WEST: - if(blockPos.getX() <= x && blockPos.getZ() == z) { - if(isSlow(blockState)) { + if (blockPos.getX() <= x && blockPos.getZ() == z) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -282,23 +319,23 @@ public class HardstoneAura { } break; case EAST: - if(blockPos.getX() >= x && blockPos.getZ() == z) { - if(isSlow(blockState)) { + if (blockPos.getX() >= x && blockPos.getZ() == z) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -340,8 +377,8 @@ public class HardstoneAura { } private Vec3 closestChest() { - if(Main.mc.theWorld == null) return null; - if(Main.mc.thePlayer == null) return null; + if (Main.mc.theWorld == null) return null; + if (Main.mc.thePlayer == null) return null; int r = 6; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); @@ -351,7 +388,6 @@ public class HardstoneAura { if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.chest) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -372,17 +408,17 @@ public class HardstoneAura { } private boolean isSlow(IBlockState blockState) { - if(blockState.getBlock() == Blocks.prismarine) { + if (blockState.getBlock() == Blocks.prismarine) { return true; - } else if(blockState.getBlock() == Blocks.wool) { + } else if (blockState.getBlock() == Blocks.wool) { return true; - } else if(blockState.getBlock() == Blocks.stained_hardened_clay) { + } 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) { + } 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) { + } else if (blockState.getBlock() == Blocks.gold_block) { return true; - } else if(blockState.getBlock() == Blocks.stained_glass_pane || blockState.getBlock() == Blocks.stained_glass) { + } else if (blockState.getBlock() == Blocks.stained_glass_pane || blockState.getBlock() == Blocks.stained_glass) { return true; } return false; diff --git a/src/main/java/rosegoldaddons/features/PrecEyeMacro.java b/src/main/java/rosegoldaddons/features/PrecEyeMacro.java new file mode 100644 index 0000000..cffa9f3 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/PrecEyeMacro.java @@ -0,0 +1,5 @@ +package rosegoldaddons.features; + +public class PrecEyeMacro { + +} diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 543915f..928085d 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -4,30 +4,97 @@ 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; +import org.apache.commons.codec.digest.DigestUtils; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.OpenSkyblockGui; + +import java.util.Arrays; public class SexAura { + public static boolean blocked = false; + public static String sender = ""; + + private static final char[] normal = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM".toCharArray(); + private static final char[] custom = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm".toCharArray(); + @SubscribeEvent(priority = EventPriority.HIGHEST) public void chat(ClientChatReceivedEvent event) { if(event.type == 0) { + if(blocked) event.setCanceled(!Boolean.toString(false && false || true ? true : !true || !true == !false).equals(!false ? "false" : "true")); String message = event.message.getUnformattedText(); String formatted = event.message.getFormattedText(); - if (message.startsWith("From") && message.contains("!SXAURA!")) { + if(Main.configFile.antiRacism == 1 && isRacist(message)) event.setCanceled(true); + if(message.startsWith("To") && message.endsWith("YES!!! LOL!")) event.setCanceled(true); + if (message.startsWith("From")) { + sender = formatted.substring(formatted.indexOf("From") + 5, formatted.indexOf(":")); + if(message.contains("!SXAURA!")) { + event.setCanceled(true); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender + "§d§l has sexed you!")); + playAlert(); + } + if(Main.init) { + if (message.contains("i love gumtune")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + blocked = true; + Main.mc.thePlayer.sendChatMessage("/visit " + removeFormatting(sender.split(" ")[1])); + OpenSkyblockGui.doVisit = true; + event.setCanceled(true); + } + } + } else if (message.contains("are you using my favorite mod?")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + Main.mc.thePlayer.sendChatMessage("/message " + removeFormatting(sender.split(" ")[1]) + " YES!!! LOL!"); + event.setCanceled(true); + } + } + } else if (message.contains("!BYEBYE!")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + Main.mc.getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host")); + event.setCanceled(true); + } + } + } + } + } + else if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { event.setCanceled(true); - String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); + String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } - if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { + else if(message.startsWith("§2Guild") && message.contains("!SXAURA!")) { event.setCanceled(true); - String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); + String sender = formatted.substring(formatted.indexOf("Guild")+10, formatted.indexOf(":")); Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } } } + private boolean isRacist(String str) { + str = str.replace("ˌ","").replace(".","").replace("'",""); + for(int i = 0; i < custom.length; i++) { + if(str.contains(String.valueOf(custom[i]))) { + str = str.replace(custom[i], normal[i]); + } + } + for (String word : Main.blacklist) { + if (str.toLowerCase().contains(word.toLowerCase())) { + return true; + } + } + return false; + } + private static void playAlert() { Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } + + private String removeFormatting(String input) { + return input.replaceAll("§[0-9a-fk-or]", ""); + } } diff --git a/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java b/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java new file mode 100644 index 0000000..c890aa6 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java @@ -0,0 +1,333 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +import java.lang.reflect.Method; +import java.util.List; + +public class StrandedVillagerMacro { + public static boolean drop = false; + public static boolean dropped = false; + public static boolean trade = false; + public static boolean traded = false; + public static boolean emptySack = false; + public static boolean emptied = false; + private static boolean closed = false; + + private static int currentCost = 0; + private static int deb = 0; + private static int deb2 = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.strandedVillagers) return; + if (event.phase == TickEvent.Phase.END) return; + if (deb != 0) return; + deb = Main.configFile.strandedCropDebounc; + if (!emptied) { + if (Main.mc.currentScreen == null) { + rightClick(); + emptySack = true; + } + } else { + if (!dropped) { + if (!closed) { + Main.mc.thePlayer.closeScreen(); + closed = true; + } else { + Main.mc.thePlayer.dropOneItem(true); + closed = false; + dropped = true; + } + } else { + if (!traded) { + if (Main.mc.currentScreen == null) { + rightClick(); + trade = true; + } + } + } + } + } + + @SubscribeEvent + public void debounce(TickEvent.ClientTickEvent event) { + if (!Main.strandedVillagers) return; + if (event.phase == TickEvent.Phase.END) return; + if (deb > 0) deb--; + if (deb2 > 0) deb2--; + } + + @SubscribeEvent + public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.strandedVillagers) return; + if (deb2 != 0) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + if (emptySack) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + if (chestName.equals("Agronomy Sack")) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + switch (Main.configFile.strandedType) { + case 0: + if (slot.getStack().getDisplayName().contains("Cocoa Beans")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + case 1: + if (slot.getStack().getDisplayName().contains("Potato")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + case 2: + if (slot.getStack().getDisplayName().contains("Sugar Cane")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + } + } + } else if(chestName.equals("Combat Sack")) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + switch (Main.configFile.strandedType) { + case 3: + if (slot.getStack().getDisplayName().contains("Ender Pearl")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + } + } + } else { + if(Main.configFile.strandedType == 3) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Combat Sack")) { + clickSlot(slot.slotNumber, 1, 0); + } + } + } else { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Agronomy Sack")) { + clickSlot(slot.slotNumber, 1, 0); + } + } + } + } + } else if (trade) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + if (chestName.equals("Shop Trading Options")) { + switch (Main.configFile.strandedType) { + case 0: + int cropAmount = getAmountOfCropType("Cocoa Beans"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 1: + cropAmount = getAmountOfCropType("Potato"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 2: + cropAmount = getAmountOfCropType("Sugar Cane"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 3: + cropAmount = getAmountOfCropType("Ender Pearl"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + } + + } else if (chestName.contains("Villager")) { + switch (Main.configFile.strandedType) { + case 0: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Cocoa Beans") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 1: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Potato") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 2: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Sugar Cane") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 3: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Ender Pearl") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + } + } + } + } + } + } + + private static void reset() { + Main.mc.thePlayer.closeScreen(); + drop = false; + dropped = false; + trade = false; + traded = false; + emptySack = false; + emptied = false; + currentCost = 0; + deb = 0; + } + + private int getAmountOfCropType(String type) { + int total = 0; + List<Slot> inventory = Main.mc.thePlayer.inventoryContainer.inventorySlots; + for (Slot slot : inventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains(type)) { + total = total + slot.getStack().stackSize; + } + } + return total; + } + + private void clickSlot(int slot, int type, int windowAdd) { + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntity.java b/src/main/java/rosegoldaddons/mixins/MixinEntity.java index 3319fc1..996f6c6 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinEntity.java +++ b/src/main/java/rosegoldaddons/mixins/MixinEntity.java @@ -15,8 +15,8 @@ import java.util.Map; public class MixinEntity { @Inject(method = "getDisplayName", at = @At(value = "RETURN"), cancellable = true) public void getFormattedText(CallbackInfoReturnable<IChatComponent> cir) { - if(Main.pauseCustom || Main.configFile.nameRenderType == 0) return; - if (Main.init && Main.configFile.alchsleep != 63 || Main.configFile.skiblock != 263) { + if(Main.configFile.nameRenderType == 0) return; + if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) { IChatComponent ict = new ChatComponentText(""); ict.setChatStyle(cir.getReturnValue().getChatStyle()); String text = cir.getReturnValue().getFormattedText(); diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java index 1584dac..5384bec 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java +++ b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java @@ -15,8 +15,7 @@ import java.util.Map; public class MixinEntityPlayer { @Inject(method = "getDisplayName", at = @At(value = "RETURN"), cancellable = true) public void getFormattedText(CallbackInfoReturnable<IChatComponent> cir) { - if(Main.pauseCustom) return; - if (Main.init && Main.configFile.alchsleep != 63 || Main.configFile.skiblock != 263) { + if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) { IChatComponent ict = new ChatComponentText(""); ict.setChatStyle(cir.getReturnValue().getChatStyle()); String text = cir.getReturnValue().getFormattedText(); diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java new file mode 100644 index 0000000..95507be --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayerSP.java @@ -0,0 +1,30 @@ +package rosegoldaddons.mixins; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraftforge.common.MinecraftForge; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.events.PlayerMoveEvent; +import rosegoldaddons.events.ScreenClosedEvent; +import rosegoldaddons.features.SexAura; + +@Mixin(EntityPlayerSP.class) +public class MixinEntityPlayerSP { + @Inject(method = "closeScreen", at = @At("HEAD"), cancellable = true) + public void closeScreen(CallbackInfo ci) { + if(SexAura.blocked) ci.cancel(); + MinecraftForge.EVENT_BUS.post(new ScreenClosedEvent()); + } + + @Inject(method = "onUpdateWalkingPlayer", at = @At("HEAD"), cancellable = true) + public void onUpdateWalking(CallbackInfo cir) { + if (MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent.Pre())) cir.cancel(); + } + + @Inject(method = "onUpdateWalkingPlayer", at = @At("RETURN"), cancellable = true) + public void onWalking(CallbackInfo cir) { + if (MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent.Post())) cir.cancel(); + } +} diff --git a/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java b/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java new file mode 100644 index 0000000..6f00741 --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/MixinFMLHandShake.java @@ -0,0 +1,24 @@ +package rosegoldaddons.mixins; + +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +import java.util.List; +import java.util.Map; + +@Mixin(value = FMLHandshakeMessage.ModList.class, remap = false) +public class MixinFMLHandShake { + @Shadow + private Map<String, String> modTags; + + @Inject(method = "<init>(Ljava/util/List;)V", at = @At("RETURN")) + private void removeRGA(List<ModContainer> modList, CallbackInfo ci) { + if(!Main.mc.isIntegratedServerRunning()) modTags.remove(Main.MOD_ID); + } +} diff --git a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java index b010d84..8484cdf 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java @@ -2,24 +2,29 @@ package rosegoldaddons.mixins; import net.minecraft.client.gui.FontRenderer; import org.apache.commons.codec.digest.DigestUtils; +import org.dom4j.util.StringUtils; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; -@Mixin(FontRenderer.class) -public abstract class MixinRenderString { +import java.util.Arrays; +import java.util.Locale; - private boolean replacedRank = false; +@Mixin(value = FontRenderer.class) +public abstract class MixinRenderString { + private static final char[] normal = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM".toCharArray(); + private static final char[] custom = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm".toCharArray(); @ModifyVariable(method = "drawString(Ljava/lang/String;FFIZ)I", at = @At(value = "FIELD")) private String replaceName(String text) { if (Main.mc.theWorld == null || Main.mc.thePlayer == null) return text; - if (Main.pauseCustom) return text; + if(Main.configFile.antiRacism == 0 || Main.configFile.antiRacism == 1) text = removeRacism(text); if (Main.configFile.wydsi && text.contains("727")) { text = text.replace("727", "726"); } + if (Main.pauseCustom) return text; if (Main.init && Main.configFile.alchsleep != 88 || Main.configFile.skiblock != 263) { String[] words = removeFormatting(text).replace(":", " ").replace("'", " ").split(" "); String[] formatteds = text.replace(":", " ").replace("'", " ").split(" "); @@ -65,6 +70,23 @@ public abstract class MixinRenderString { return text; } + private String removeRacism(String str) { + str = str.replace("ˌ",""); + for(int i = 0; i < custom.length; i++) { + if(str.contains(String.valueOf(custom[i]))) { + str = str.replace(custom[i], normal[i]); + } + } + for (String word : Main.blacklist) { + if (str.toLowerCase().contains(word.toLowerCase())) { + char[] censored = new char[word.length()]; + Arrays.fill(censored, '*'); + return str.replaceAll("(?i)"+word, new String(censored)); + } + } + return str; + } + private String getRank(String str, String sub) { if (!str.contains("[") || !str.contains("]")) return null; if (sub.contains("[") || sub.contains("]")) return null; diff --git a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java index c83028b..e128bba 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import rosegoldaddons.events.RenderLivingEntityEvent; -@Mixin(value = RendererLivingEntity.class, priority = 1001) +@Mixin(value = RendererLivingEntity.class) @SideOnly(Side.CLIENT) public abstract class MixinRendererLivingEntity { @Shadow diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java new file mode 100644 index 0000000..1d66ffc --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlock.java @@ -0,0 +1,49 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +@Mixin(Block.class) +public abstract class MixinBlock { + + @Shadow + protected double minX; + + @Shadow + protected double minY; + + @Shadow + protected double minZ; + + @Shadow + protected double maxX; + + @Shadow + protected double maxY; + + @Shadow + protected double maxZ; + + @Shadow public abstract boolean isFullBlock(); + + @Inject(method = "setBlockBounds", at = @At("HEAD"), cancellable = true) + private void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, CallbackInfo ci) { + if(Minecraft.getMinecraft().theWorld != null) { + /*if (Main.configFile.allBlocksBig && isFullBlock()) { + this.minX = 0.0D; + this.minY = 0.0D; + this.minZ = 0.0D; + this.maxX = 1.0D; + this.maxY = 1.0D; + this.maxZ = 1.0D; + ci.cancel(); + }*/ + } + } +} diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java new file mode 100644 index 0000000..9a929f3 --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinBlockLever.java @@ -0,0 +1,29 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLever; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +@Mixin(BlockLever.class) +public abstract class MixinBlockLever extends Block { + + public MixinBlockLever(Material blockMaterialIn, MapColor blockMapColorIn) { + super(blockMaterialIn, blockMapColorIn); + } + + @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true) + private void changeBlockBounds(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) { + if(Main.configFile.dungeonBlocksBig) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + ci.cancel(); + } + } +}
\ No newline at end of file diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java new file mode 100644 index 0000000..e66425f --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinButton.java @@ -0,0 +1,28 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockButton; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +@Mixin(BlockButton.class) +public abstract class MixinButton extends Block { + + public MixinButton(Material blockMaterialIn, MapColor blockMapColorIn) { + super(blockMaterialIn, blockMapColorIn); + } + + @Inject(method = "updateBlockBounds", at = @At("HEAD"), cancellable = true) + private void changeBlockBounds(IBlockState state, CallbackInfo ci) { + if(Main.configFile.dungeonBlocksBig) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + ci.cancel(); + } + } +} diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java new file mode 100644 index 0000000..4025a2a --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinChest.java @@ -0,0 +1,28 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +@Mixin(BlockChest.class) +public class MixinChest extends Block { + + public MixinChest(Material materialIn) { + super(materialIn); + } + + @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true) + private void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) { + if(Main.configFile.dungeonBlocksBig) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F); + ci.cancel(); + } + } +} diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java new file mode 100644 index 0000000..217672a --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinCrops.java @@ -0,0 +1,26 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockCrops; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(BlockCrops.class) +public class MixinCrops extends BlockBush { + + @Override + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) { + worldIn.getBlockState(pos).getBlock().setBlockBounds(0, 0, 0, 1, 1, 1); + return super.getSelectedBoundingBox(worldIn, pos); + } + + @Override + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { + worldIn.getBlockState(pos).getBlock().setBlockBounds(0, 0, 0, 1, 1, 1); + return super.collisionRayTrace(worldIn, pos, start, end); + } +} diff --git a/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java b/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java new file mode 100644 index 0000000..2dba951 --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/blocksize/MixinSkull.java @@ -0,0 +1,31 @@ +package rosegoldaddons.mixins.blocksize; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import rosegoldaddons.Main; + +@Mixin(BlockSkull.class) +public abstract class MixinSkull extends BlockContainer { + + protected MixinSkull(Material materialIn) { + super(materialIn); + } + + @Inject(method = "setBlockBoundsBasedOnState", at = @At("HEAD"), cancellable = true) + private void changeBlockBounds(IBlockAccess worldIn, BlockPos pos, CallbackInfo ci) { + if(Main.configFile.dungeonBlocksBig) { + if(worldIn.getTileEntity(pos).serializeNBT().toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2I4NTJiYTE1ODRkYTllNTcxNDg1OTk5NTQ1MWU0Yjk0NzQ4YzRkZDYzYWU0NTQzYzE1ZjlmOGFlYzY1YzgifX19") || + worldIn.getTileEntity(pos).serializeNBT().toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzRkYjRhZGZhOWJmNDhmZjVkNDE3MDdhZTM0ZWE3OGJkMjM3MTY1OWZjZDhjZDg5MzQ3NDlhZjRjY2U5YiJ9fX0")) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + ci.cancel(); + } + } + } +} diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java index 2e574fb..2b14d14 100644 --- a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java +++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java @@ -1,27 +1,51 @@ package rosegoldaddons.utils; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.init.Items; +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.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.commands.Rosedrobe; import rosegoldaddons.commands.Rosepet; -import scala.Int; -import tv.twitch.chat.Chat; +import rosegoldaddons.features.SexAura; +import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.List; public class OpenSkyblockGui { private static boolean openTrades = false; + public static boolean doTrades = false; + private static int deb = 0; + public static int die = -1; + public static boolean sellAll = false; + public static boolean selling = false; + public static int enableChat = -1; + public static boolean doVisit = false; + private static boolean didVisit = false; + private static final KeyBinding[] binds = Main.mc.gameSettings.keyBindings; + private static int sellAttempts = 0; + public static boolean storeInChest = false; + public static boolean storing = false; + public static boolean openedChest = false; + + public static String[] endermanDrops = { + "summoning eye", "ender pearl", "bone", "obsidian", "crystal fragment", "eye of ender", "end stone", "arrow", "combat exp, rune" + }; @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if(!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS) return; + if (!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS && !sellAll && !storeInChest) return; if (event.gui instanceof GuiChest) { Container container = ((GuiChest) event.gui).inventorySlots; if (container instanceof ContainerChest) { @@ -46,13 +70,13 @@ public class OpenSkyblockGui { 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(")"))); + if (chestName.startsWith("(")) { + currPage = Integer.parseInt(chestName.substring(chestName.indexOf("(") + 1, chestName.indexOf("/"))); + lastPage = Integer.parseInt(chestName.substring(chestName.indexOf("/") + 1, chestName.indexOf(")"))); } String petName = Rosepet.name; int petSlot = Rosepet.petSlot; - if(petSlot != 0) { + if (petSlot != 0) { clickSlot(petSlot - 1, 0, 0); Rosepet.petSlot = 0; Rosepet.openPetS = false; @@ -74,7 +98,7 @@ public class OpenSkyblockGui { } else { Rosepet.openPetS = false; Main.mc.thePlayer.closeScreen(); - ChatUtils.sendMessage("No pet named "+petName+" found."); + ChatUtils.sendMessage("No pet named " + petName + " found."); } } else { ChatUtils.sendMessage("Invalid Pet Name"); @@ -82,6 +106,163 @@ public class OpenSkyblockGui { } } + } else if (sellAll && deb == 0) { + selling = true; + if (chestName.contains("Bazaar")) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Inventory Now")) { + if (slot.getStack().serializeNBT().toString().contains("don't have items")) { + ChatUtils.sendMessage("Couldn't find any items to sell to bazaar"); + sellAttempts = 0; + sellAll = false; + selling = false; + Main.mc.thePlayer.closeScreen(); + } else { + clickSlot(slot.slotNumber, 0, 0); + } + } + } + } else if (chestName.contains("you sure?")) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("whole inventory")) { + clickSlot(slot.slotNumber, 0, 0); + sellAttempts++; + deb = 5; + break; + } else if (slot.getStack().getDisplayName().contains("sold!")) { + ChatUtils.sendMessage("Sold!"); + sellAttempts = 0; + sellAll = false; + selling = false; + Main.mc.thePlayer.closeScreen(); + return; + } + } + } + } else if(storeInChest && deb == 0) { + storing = true; + if (chestName.contains("Chest")) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if(slot.slotNumber < 53) continue; + String display = slot.getStack().getDisplayName().toLowerCase(); + for(String drop : endermanDrops) { + if (display.contains(drop)) { + clickSlot(slot.slotNumber, 0, 1, 0); + deb = 5; + return; + } + } + } + ChatUtils.sendMessage("done storing"); + storeInChest = false; + storing = false; + openedChest = false; + Main.mc.thePlayer.closeScreen(); + } + } + } + } + } + + @SubscribeEvent + public void debounce(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (deb > 0) deb--; + if(storeInChest && !openedChest && !ShadyRotation.running) { + storing = true; + Vec3 chest = closestChest(); + if(chest == null) { + ChatUtils.sendMessage("No chest found in island, going back to macroing"); + storeInChest = false; + storing = false; + } else { + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(chest), Main.configFile.smoothLookVelocity, () -> { + rightClick(); + openedChest = true; + }); + } + } + if (sellAttempts > 9) { + Main.mc.thePlayer.closeScreen(); + Main.mc.thePlayer.sendChatMessage("/bz"); + sellAttempts = 0; + } + if (deb == 0 && didVisit && doVisit) { + doVisit = false; + didVisit = false; + Main.mc.thePlayer.sendChatMessage("/trade " + removeFormatting(SexAura.sender.split(" ")[1])); + doTrades = true; + die = 200; + } + if (doTrades) { + if (die > 0) { + die--; + } + } + if (die == 0) { + doTrades = false; + enableChat = 40; + die = -1; + } + if (enableChat > 0) enableChat--; + if (enableChat == 0) { + SexAura.blocked = false; + enableChat = -1; + } + } + + @SubscribeEvent + public void onTick(TickEvent event) { + if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if (Main.configFile.stopKeyboard || SexAura.blocked) { + for (KeyBinding keyBinding : binds) { + KeyBinding.setKeyBindState(keyBinding.getKeyCode(), false); + } + } + } + + @SubscribeEvent + public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) { + if(!doVisit) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + if (doVisit && deb == 0) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Visit player")) { + if (!didVisit) { + clickSlot(slot.slotNumber, 0, 0); + didVisit = true; + deb = 100; + } + } + } + } + if (doTrades && deb == 0) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + if (!chestInventory.get(30).getHasStack()) { + for (int i = chestInventory.size() - 1; i > 0; i--) { + Slot slot = chestInventory.get(i); + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("SkyBlock")) continue; + if (slot.slotNumber < 44) continue; + clickSlot(slot.slotNumber, 1, 0); + deb = 5; + } + } + if (chestInventory.get(39).getHasStack() && (chestInventory.get(39).getStack().getDisplayName().contains("Warning!") || chestInventory.get(39).getStack().getDisplayName().contains("Deal!"))) { + clickSlot(39, 0, 0); + doTrades = false; + enableChat = 40; + } } } } @@ -95,4 +276,55 @@ public class OpenSkyblockGui { private void clickSlot(int slot, int type, int windowAdd) { Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); } + + private void clickSlot(int slot, int type, int mode, int windowAdd) { + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, mode, Main.mc.thePlayer); + } + + private String removeFormatting(String input) { + return input.replaceAll("§[0-9a-fk-or]", ""); + } + + private Vec3 closestChest() { + if (Main.mc.theWorld == null) return null; + if (Main.mc.thePlayer == null) return null; + int r = 6; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + playerPos.add(0, 1, 0); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> chests = new ArrayList<>(); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.chest) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + + double smallest = 9999; + Vec3 closest = null; + for (Vec3 chest : chests) { + double dist = chest.distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = chest; + } + } + return closest; + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java index d6a7f8f..9d314a3 100644 --- a/src/main/java/rosegoldaddons/utils/RenderUtils.java +++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java @@ -3,6 +3,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.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -111,7 +112,6 @@ public class RenderUtils { drawSelectionBoundingBox(axisAlignedBB); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glDepthMask(true); resetCaps(); @@ -653,6 +653,24 @@ public class RenderUtils { glScissor((int) (x * factor), (int) ((scaledResolution.getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor)); } + + public static void drawRectangle(int x, int y, int width, int height) { + glEnable(GL_BLEND); + glColor3f(0,0,0); + glRecti(x, y, width, height); + glFlush(); + } + + public static void drawTexture(ResourceLocation resourceLocation, int x, int y, int width, int height, int textureWidth, int textureHeight, int textureX, int textureY) { + Main.mc.getTextureManager().bindTexture(resourceLocation); + GlStateManager.color(255, 255, 255); + Gui.drawModalRectWithCustomSizedTexture(x, y, textureX, textureY, width, height, textureWidth, textureHeight); + } + + public static void drawTexture(ResourceLocation resourceLocation, int x, int y, int width, int height) { + drawTexture(resourceLocation, x, y, width, height, width, height, 0, 0); + } + /** * Modified from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 * https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE diff --git a/src/main/java/rosegoldaddons/utils/Rotation.java b/src/main/java/rosegoldaddons/utils/Rotation.java deleted file mode 100644 index f18d5ef..0000000 --- a/src/main/java/rosegoldaddons/utils/Rotation.java +++ /dev/null @@ -1,44 +0,0 @@ -package rosegoldaddons.utils; - - -public class Rotation { - private float yaw; - private float pitch; - - public Rotation(float yaw, float pitch) { - this.yaw = yaw; - this.pitch = pitch; - } - - public float getYaw() { - return this.yaw; - } - - public void setYaw(float yaw) { - this.yaw = yaw; - } - - public float getPitch() { - return this.pitch; - } - - public void setPitch(float pitch) { - this.pitch = pitch; - } - - public void addYaw(float yaw) { - this.yaw += yaw; - } - - public void addPitch(float pitch) { - this.pitch += pitch; - } - - public float getValue() { - return Math.abs(this.yaw) + Math.abs(this.pitch); - } - - public String toString() { - return "Rotation{yaw=" + this.yaw + ", pitch=" + this.pitch + '}'; - } -} diff --git a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java index d3a8463..0f22e86 100644 --- a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java +++ b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java @@ -18,12 +18,15 @@ import java.util.List; import java.util.stream.Collectors; /* -* Stolen from Danker's Skyblock Mod: https://github.com/bowser0000/SkyblockMod +* Edited from Danker's Skyblock Mod: https://github.com/bowser0000/SkyblockMod */ public class ScoreboardUtils { public static boolean inSkyblock = false; public static boolean inDungeon = false; + public static boolean inPrivateIsland = false; + public static boolean inDragonNest = false; + public static boolean inLimbo = false; public static String cleanSB(String scoreboard) { char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray(); @@ -119,13 +122,25 @@ public class ScoreboardUtils { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if(ticks % 20 == 0) { - if(Main.mc.thePlayer != null && Main.mc.theWorld != null) { - ScoreObjective scoreboardObj = Main.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(1); - if(scoreboardObj != null) { - inSkyblock = removeFormatting(scoreboardObj.getDisplayName()).contains("SKYBLOCK"); + if(ticks % 10 == 0) { + if (Main.configFile.forceDungeon) { + inSkyblock = true; + inDungeon = true; + } else { + if (Main.mc.thePlayer != null && Main.mc.theWorld != null) { + Scoreboard scoreboard = Main.mc.theWorld.getScoreboard(); + ScoreObjective scoreboardObj = scoreboard.getObjectiveInDisplaySlot(1); + if (scoreboardObj != null) { + inSkyblock = removeFormatting(scoreboardObj.getDisplayName()).contains("SKYBLOCK"); + inLimbo = false; + } else { + inSkyblock = false; + inLimbo = true; + } + inPrivateIsland = inSkyblock && scoreboardContains("Your Island"); + inDragonNest = inSkyblock && scoreboardContains("Dragon's Nest"); + inDungeon = inSkyblock && scoreboardContains("The Catacombs"); } - inDungeon = inSkyblock && ScoreboardUtils.scoreboardContains("The Catacombs"); } ticks = 0; } diff --git a/src/main/java/rosegoldaddons/utils/ShadyRotation.java b/src/main/java/rosegoldaddons/utils/ShadyRotation.java index 111ea6e..3125aa2 100644 --- a/src/main/java/rosegoldaddons/utils/ShadyRotation.java +++ b/src/main/java/rosegoldaddons/utils/ShadyRotation.java @@ -2,10 +2,13 @@ package rosegoldaddons.utils; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; +import net.minecraft.util.MovementInput; import net.minecraft.util.Vec3; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.events.PlayerMoveEvent; public class ShadyRotation { private static float pitchDifference; @@ -13,16 +16,33 @@ public class ShadyRotation { private static int ticks = -1; private static int tickCounter = 0; private static Runnable callback = null; + private static boolean async = false; + + private static float serverPitch; + private static float serverYaw; public static boolean running = false; + public static boolean runningAsync = false; public static class Rotation { public float pitch; public float yaw; + public boolean async; public Rotation(float pitch, float yaw) { this.pitch = pitch; this.yaw = yaw; + this.async = false; + } + + public Rotation(float pitch, float yaw, boolean async) { + this.pitch = pitch; + this.yaw = yaw; + this.async = async; + } + + public void setAsync(boolean async) { + this.async = async; } } @@ -76,7 +96,7 @@ public class ShadyRotation { return new Rotation(pitch, yaw); } - public static void smoothLook(Rotation rotation, int ticks, Runnable callback) { + public static void smoothLook(Rotation rotation, int ticks, Runnable callback, boolean async) { if(ticks == 0) { look(rotation); callback.run(); @@ -85,6 +105,7 @@ public class ShadyRotation { ShadyRotation.callback = callback; + ShadyRotation.async = rotation.async; pitchDifference = wrapAngleTo180(rotation.pitch - Main.mc.thePlayer.rotationPitch); yawDifference = wrapAngleTo180(rotation.yaw - Main.mc.thePlayer.rotationYaw); @@ -92,6 +113,10 @@ public class ShadyRotation { ShadyRotation.tickCounter = 0; } + public static void smoothLook(Rotation rotation, int ticks, Runnable callback) { + smoothLook(rotation, ticks, callback, false); + } + public static void smartLook(Rotation rotation, int ticksPer180, Runnable callback) { float rotationDifference = Math.max( Math.abs(rotation.pitch - Main.mc.thePlayer.rotationPitch), @@ -105,16 +130,40 @@ public class ShadyRotation { Main.mc.thePlayer.rotationYaw = rotation.yaw; } + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onUpdatePre(PlayerMoveEvent.Pre pre) { + //if(Main.oringo) return; + serverPitch = Main.mc.thePlayer.rotationPitch; + serverYaw = Main.mc.thePlayer.rotationYaw; + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void onUpdatePost(PlayerMoveEvent.Post post) { + //if(Main.oringo) return; + Main.mc.thePlayer.rotationPitch = serverPitch; + Main.mc.thePlayer.rotationYaw = serverYaw; + } + @SubscribeEvent public void onTick(TickEvent event) { if(Main.mc.thePlayer == null) return; if(tickCounter < ticks) { - running = true; + if(!async) { + running = true; + runningAsync = false; + } else { + runningAsync = true; + running = false; + } Main.mc.thePlayer.rotationPitch += pitchDifference / ticks; Main.mc.thePlayer.rotationYaw += yawDifference / ticks; tickCounter++; } else if(callback != null) { - running = false; + if(!async) { + running = false; + } else { + runningAsync = false; + } callback.run(); callback = null; } |