diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
commit | f4b58abbda168b01513a5ac2ba2870bc00df7074 (patch) | |
tree | 2f237367764c74bba1f912acec1da281a2b74d24 /src/main/java | |
parent | fdc569f2ab7674d850d25b41519b4e3da244dd00 (diff) | |
download | RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.gz RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.bz2 RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.zip |
2.7.0-pre2
Diffstat (limited to 'src/main/java')
44 files changed, 945 insertions, 395 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index c0a0908..f3394e1 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -129,6 +129,10 @@ public class Config extends Vigilant { category = "Mining", subcategory = "General") public boolean includeOres = false; + @Property(type = PropertyType.SELECTOR, name = "Mithril Macro Priority", description = "Determine the order the macro will breaks blocks in", + category = "Mining", subcategory = "General", options = {"Highest value to lowest", "Lowest value to highest","Any"}) + public int mithrilMacroPrio = 0; + @Property(type = PropertyType.SWITCH, name = "Pingless Mining", description = "Mines the next block before the previous block breaks, instabreak only", category = "Mining", subcategory = "General") public boolean pinglessMining = false; diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index bd91b90..120e944 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -1,7 +1,6 @@ package rosegoldaddons; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -28,6 +27,7 @@ import rosegoldaddons.features.*; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.OpenSkyblockGui; import rosegoldaddons.utils.PlayerUtils; +import rosegoldaddons.utils.RotationUtils; import java.io.*; import java.net.URL; @@ -43,7 +43,7 @@ import java.util.Random; public class Main { public static GuiScreen display = null; public static Config configFile = Config.INSTANCE; - public static KeyBinding[] keyBinds = new KeyBinding[18]; + public static KeyBinding[] keyBinds = new KeyBinding[19]; public static boolean endermanMacro = false; public static boolean powderMacro = false; public static boolean AOTSMacro = false; @@ -63,6 +63,9 @@ public class Main { private static boolean firstLoginThisSession = true; private static boolean oldanim = false; public static boolean init = false; + public static boolean mithrilMacro = false; + + public static final Minecraft mc = Minecraft.getMinecraft(); //Hello decompiler and / or source code checker! this is just some funny stuff, you do not have to worry about it! private String[] cumsters = null; @@ -106,8 +109,9 @@ public class Main { MinecraftForge.EVENT_BUS.register(new PlayerUtils()); MinecraftForge.EVENT_BUS.register(new CanePlanter()); MinecraftForge.EVENT_BUS.register(new ArmorStandESPs()); - MinecraftForge.EVENT_BUS.register(new DamagePerSecond()); MinecraftForge.EVENT_BUS.register(new PinglessMining()); + MinecraftForge.EVENT_BUS.register(new MithrilMacro()); + MinecraftForge.EVENT_BUS.register(new RotationUtils()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -120,8 +124,11 @@ public class Main { String[] temp = getUrlContents("https://gist.github.com/RoseGoldIsntGay/6fa79111ae8efe3f5d269a095d748aa5/raw").split("\n"); for(String str : temp) { - resp.put(str.substring(0, str.indexOf(":")), str.substring(str.indexOf(": ") + 2).replace("&", "§")); - System.out.println(str.substring(0, str.indexOf(":"))+" "+str.substring(str.indexOf(": ") + 2).replace("&", "§")); + if(str.contains(":")) { + resp.put(str.substring(0, str.indexOf(":")), str.substring(str.indexOf(": ") + 2).replace("&", "§")); + } else { + System.out.println(str); + } } init = true; @@ -188,6 +195,7 @@ public class Main { 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"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); @@ -218,10 +226,10 @@ public class Main { msg3.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/PizzaboiBestLegit/Pizza-Client")); ChatComponentText msg4 = new ChatComponentText("§0§7Check out the RoseGoldAddons §bDiscord Server!"); msg4.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://discord.gg/Tmk2hwzdxm")); - Minecraft.getMinecraft().thePlayer.addChatMessage(msg1); - Minecraft.getMinecraft().thePlayer.addChatMessage(msg2); - Minecraft.getMinecraft().thePlayer.addChatMessage(msg3); - Minecraft.getMinecraft().thePlayer.addChatMessage(msg4); + mc.thePlayer.addChatMessage(msg1); + mc.thePlayer.addChatMessage(msg2); + mc.thePlayer.addChatMessage(msg3); + mc.thePlayer.addChatMessage(msg4); firstLoginThisSession = false; } catch (Exception e) { e.printStackTrace(); @@ -255,12 +263,12 @@ public class Main { @SubscribeEvent public void tick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.START) return; - if(Minecraft.getMinecraft().gameSettings.limitFramerate == 1) { - Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 260.0F); + if(mc.gameSettings.limitFramerate == 1) { + mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 260.0F); } if (display != null) { try { - Minecraft.getMinecraft().displayGuiScreen(display); + mc.displayGuiScreen(display); } catch (Exception e) { e.printStackTrace(); } @@ -272,7 +280,7 @@ public class Main { public void key(InputEvent.KeyInputEvent event) { int rnd = new Random().nextInt(configFile.skiblock); if(rnd == 0 && configFile.funnyStuff) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((cumsters[new Random().nextInt(cumsters.length)].replace("&","§")+"§7: "+i(ILILILLILILLILILILL[new Random().nextInt(ILILILLILILLILILILL.length)])))); + mc.thePlayer.addChatMessage(new ChatComponentText((cumsters[new Random().nextInt(cumsters.length)].replace("&","§")+"§7: "+i(ILILILLILILLILILILL[new Random().nextInt(ILILILLILILLILILILL.length)])))); } if (keyBinds[0].isPressed()) { autoUseItems = !autoUseItems; @@ -342,6 +350,10 @@ public class Main { 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); } } diff --git a/src/main/java/rosegoldaddons/commands/AllEntities.java b/src/main/java/rosegoldaddons/commands/AllEntities.java index 0da86ec..016b4dc 100644 --- a/src/main/java/rosegoldaddons/commands/AllEntities.java +++ b/src/main/java/rosegoldaddons/commands/AllEntities.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemSkull; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; @@ -36,7 +37,7 @@ public class AllEntities implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { ChatUtils.sendMessage(""+entity1); if(entity1 instanceof EntityArmorStand) { ItemStack itemStack = ((EntityArmorStand) entity1).getCurrentArmor(3); diff --git a/src/main/java/rosegoldaddons/commands/Backpack.java b/src/main/java/rosegoldaddons/commands/Backpack.java index 24b7563..015913d 100644 --- a/src/main/java/rosegoldaddons/commands/Backpack.java +++ b/src/main/java/rosegoldaddons/commands/Backpack.java @@ -44,10 +44,10 @@ public class Backpack implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/storage"); + Main.mc.thePlayer.sendChatMessage("/storage"); } else { if (isNumeric(args[0])) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/storage"); + Main.mc.thePlayer.sendChatMessage("/storage"); openBP = true; bpSlot = Integer.parseInt(args[0]); } else { diff --git a/src/main/java/rosegoldaddons/commands/LobbySwap.java b/src/main/java/rosegoldaddons/commands/LobbySwap.java index 517354b..8fd5312 100644 --- a/src/main/java/rosegoldaddons/commands/LobbySwap.java +++ b/src/main/java/rosegoldaddons/commands/LobbySwap.java @@ -6,6 +6,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import java.util.ArrayList; import java.util.List; @@ -31,7 +32,7 @@ public class LobbySwap implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { swapLobby = true; - Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu"); + Main.mc.thePlayer.sendChatMessage("/sbmenu"); } diff --git a/src/main/java/rosegoldaddons/commands/Rosedrobe.java b/src/main/java/rosegoldaddons/commands/Rosedrobe.java index 55024df..5ba23b4 100644 --- a/src/main/java/rosegoldaddons/commands/Rosedrobe.java +++ b/src/main/java/rosegoldaddons/commands/Rosedrobe.java @@ -44,12 +44,12 @@ public class Rosedrobe implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + Main.mc.thePlayer.sendChatMessage("/pets"); slot = 0; openWardrobe = true; } else { if (isNumeric(args[0])) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + Main.mc.thePlayer.sendChatMessage("/pets"); openWardrobe = true; slot = Integer.parseInt(args[0]); } else { diff --git a/src/main/java/rosegoldaddons/commands/Rosepet.java b/src/main/java/rosegoldaddons/commands/Rosepet.java index cf7fb34..25c869f 100644 --- a/src/main/java/rosegoldaddons/commands/Rosepet.java +++ b/src/main/java/rosegoldaddons/commands/Rosepet.java @@ -6,6 +6,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; @@ -34,7 +35,7 @@ public class Rosepet implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 1) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + Main.mc.thePlayer.sendChatMessage("/pets"); openPetS = true; if(isNumeric(args[0])) { petSlot = Integer.parseInt(args[0]); diff --git a/src/main/java/rosegoldaddons/commands/SexPlayer.java b/src/main/java/rosegoldaddons/commands/SexPlayer.java index d7fcbe9..3083ea2 100644 --- a/src/main/java/rosegoldaddons/commands/SexPlayer.java +++ b/src/main/java/rosegoldaddons/commands/SexPlayer.java @@ -6,6 +6,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; @@ -30,7 +31,7 @@ public class SexPlayer implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pc !SXAURA!"); + Main.mc.thePlayer.sendChatMessage("/pc !SXAURA!"); ChatUtils.sendMessage("Successfully sex-arua'd party chat"); return; } @@ -38,7 +39,7 @@ public class SexPlayer implements ICommand { ChatUtils.sendMessage("Invalid Arguments"); return; } - Minecraft.getMinecraft().thePlayer.sendChatMessage("/msg "+args[0]+" !SXAURA!"); + Main.mc.thePlayer.sendChatMessage("/msg "+args[0]+" !SXAURA!"); ChatUtils.sendMessage("Successfully sex-arua'd "+args[0]); } diff --git a/src/main/java/rosegoldaddons/commands/UseCooldown.java b/src/main/java/rosegoldaddons/commands/UseCooldown.java index 351df9a..a234c50 100644 --- a/src/main/java/rosegoldaddons/commands/UseCooldown.java +++ b/src/main/java/rosegoldaddons/commands/UseCooldown.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import java.io.BufferedWriter; @@ -55,9 +56,9 @@ public class UseCooldown implements ICommand { return; } if (args.length == 1 && isNumeric(args[0])) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; - ItemStack curStack = inv.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); + ItemStack curStack = inv.getStackInSlot(Main.mc.thePlayer.inventory.currentItem); if (curStack != null) { int cd = Integer.parseInt(args[0]); if (cd == 0) { @@ -78,9 +79,9 @@ public class UseCooldown implements ICommand { ChatUtils.sendMessage("§cError getting current held item."); } } else if (args.length == 2 && isNumeric(args[0]) && args[1].equalsIgnoreCase("left")) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; - ItemStack curStack = inv.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); + ItemStack curStack = inv.getStackInSlot(Main.mc.thePlayer.inventory.currentItem); if (curStack != null) { int cd = Integer.parseInt(args[0]); if (cd == 0) { diff --git a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java index c0958bb..54616e7 100644 --- a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java +++ b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java @@ -42,7 +42,7 @@ public class ArmorStandESPs { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index e4c9c14..db9650f 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -62,7 +62,7 @@ public class AutoArrowAlign { public void onRender(RenderWorldLastEvent event) { if (!Main.configFile.autoArrowAlign) return; itemFrames.clear(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityItemFrame) { itemFrames.add(entity1); } @@ -126,8 +126,8 @@ public class AutoArrowAlign { Thread.sleep(500); if(finalSave != null) { interactWithEntity(finalSave); - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getHeldItem()); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.getHeldItem()); } } catch (Exception e) { e.printStackTrace(); @@ -317,25 +317,25 @@ public class AutoArrowAlign { rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } private static void interactWithEntity2(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Main.mc.thePlayer, entity, Main.mc.objectMouseOver); } private static boolean isInSection3() { - int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); - int z = Minecraft.getMinecraft().thePlayer.getPosition().getZ(); + int x = Main.mc.thePlayer.getPosition().getX(); + int z = Main.mc.thePlayer.getPosition().getZ(); return x < 218 && z > 251 && x > 196 && z < 319; } } diff --git a/src/main/java/rosegoldaddons/features/AutoReady.java b/src/main/java/rosegoldaddons/features/AutoReady.java index f28910e..675d9f1 100644 --- a/src/main/java/rosegoldaddons/features/AutoReady.java +++ b/src/main/java/rosegoldaddons/features/AutoReady.java @@ -22,8 +22,8 @@ public class AutoReady { static int windowId; private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } @SubscribeEvent @@ -34,7 +34,7 @@ public class AutoReady { checkingEntities = true; Thread.sleep(500); Entity mort = null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1.getName().contains("Mort")) { mort = entity1; interactWithEntity(mort); @@ -64,7 +64,7 @@ public class AutoReady { if (container instanceof ContainerChest) { String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); List<Slot> invSlots = container.inventorySlots; - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(chestName)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(chestName)); if (chestName.contains("Start Dungeon?")) { int i; for(i = 0; i < invSlots.size(); i++) { @@ -79,7 +79,7 @@ public class AutoReady { for(i = 0; i < invSlots.size(); i++) { if(!invSlots.get(i).getHasStack()) continue; String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()); - if(slotName.contains(Minecraft.getMinecraft().thePlayer.getName())) { + if(slotName.contains(Main.mc.thePlayer.getName())) { i += 9; if(invSlots.get(i).getHasStack()) { if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Not Ready")) { @@ -94,7 +94,7 @@ public class AutoReady { } private void clickSlot(Slot slot) { - windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId; - Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 1, 0, Minecraft.getMinecraft().thePlayer); + windowId = Main.mc.thePlayer.openContainer.windowId; + Main.mc.playerController.windowClick(windowId, slot.slotNumber, 1, 0, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java index bcea552..64b173a 100644 --- a/src/main/java/rosegoldaddons/features/AutoSlayer.java +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.ScoreboardUtils; import java.util.List; @@ -26,6 +27,7 @@ public class AutoSlayer { private static boolean waitingForMaddox = false; private static int slayerSlot = 0; private static int slotLevel = 0; + private static int debounce = 0; @SubscribeEvent public void chat(ClientChatReceivedEvent event) { @@ -45,18 +47,18 @@ public class AutoSlayer { @SubscribeEvent public void onInteract(InputEvent.KeyInputEvent event) { - if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox) 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!")) { int maddox = findItemInHotbar("Batphone"); if (maddox != -1) { - ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(maddox); - int save = Minecraft.getMinecraft().thePlayer.inventory.currentItem; - Minecraft.getMinecraft().thePlayer.inventory.currentItem = maddox; - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = save; + 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; break; } @@ -67,8 +69,11 @@ public class AutoSlayer { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.configFile.autoSlayer) return; + if (debounce > 0) { + debounce--; + } if (!openMaddox) return; - Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + Main.mc.thePlayer.sendChatMessage(lastMaddoxCommand); switch (Main.configFile.slayerTypeIndex) { case 1: slayerSlot = 10; //zombie @@ -125,7 +130,7 @@ public class AutoSlayer { if (container instanceof ContainerChest) { String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); if (chestName.contains("Slayer")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; if (!chestInventory.get(13).getHasStack()) return; if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { @@ -134,10 +139,12 @@ public class AutoSlayer { clickSlot(slayerSlot, 2, 1); clickSlot(slotLevel, 2, 2); clickSlot(11, 2, 3); //confirm + debounce = 80; } else { clickSlot(slayerSlot, 2, 0); clickSlot(slotLevel, 2, 1); clickSlot(11, 2, 2); //confirm + debounce = 80; } slayerSlot = 0; slotLevel = 0; @@ -149,7 +156,7 @@ public class AutoSlayer { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -162,6 +169,6 @@ public class AutoSlayer { } private void clickSlot(int slot, int type, int windowAdd) { - Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 7f5909d..1620794 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -21,14 +21,14 @@ public class BloodTriggerBot { if (event.phase == TickEvent.Phase.END) return; for (Entity entity : getAllBloodMobs()) { if (isLookingAtAABB(entity.getEntityBoundingBox(), 1F)) { - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } } } private static boolean isLookingAtAABB(AxisAlignedBB aabb, float partialTicks) { - Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); - Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(partialTicks); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(partialTicks); look = scaleVec(look, 0.5F); for (int i = 0; i < 64; i++) { if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { @@ -42,8 +42,8 @@ public class BloodTriggerBot { private static ArrayList<Entity> getAllBloodMobs() { ArrayList<Entity> bloodMobs = new ArrayList<>(); - if (Minecraft.getMinecraft().theWorld == null) return bloodMobs; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (Main.mc.theWorld == null) return bloodMobs; + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityOtherPlayerMP && !entity1.isDead) { for (String name : names) { if (entity1.getName().contains(name)) { diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java index f7febb3..e2fc381 100644 --- a/src/main/java/rosegoldaddons/features/BrewingMacro.java +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -32,16 +32,16 @@ public class BrewingMacro { public void onTick(TickEvent.ClientTickEvent event) { if (!Main.brewingMacro || !Main.configFile.openstand || Main.configFile.alchindex != 0) return; if (event.phase == TickEvent.Phase.END) { - if (Minecraft.getMinecraft().currentScreen == null && stand != null && !sell) { - if (Minecraft.getMinecraft().playerController.onPlayerRightClick( - Minecraft.getMinecraft().thePlayer, - Minecraft.getMinecraft().theWorld, - Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), + if (Main.mc.currentScreen == null && stand != null && !sell) { + if (Main.mc.playerController.onPlayerRightClick( + Main.mc.thePlayer, + Main.mc.theWorld, + Main.mc.thePlayer.inventory.getCurrentItem(), stand, - EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw), + EnumFacing.fromAngle(Main.mc.thePlayer.rotationYaw), new Vec3(Math.random(), Math.random(), Math.random()) )) { - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } } } @@ -60,7 +60,7 @@ public class BrewingMacro { try { if (Main.configFile.alchindex == 0) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber < 54) { @@ -68,7 +68,7 @@ public class BrewingMacro { Thread.sleep(sleep); if (isInventoryFull()) { sell = true; - Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu"); + Main.mc.thePlayer.sendChatMessage("/sbmenu"); } } } @@ -78,7 +78,7 @@ public class BrewingMacro { Thread.sleep(sleep); clickSlot(22, 0, 0); } else if (chestName.contains("Trades")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber >= 54) { @@ -86,13 +86,13 @@ public class BrewingMacro { Thread.sleep(sleep); } } - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); sell = false; } } } else if (Main.configFile.alchindex == 1) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(42).getHasStack()) { @@ -103,12 +103,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 2) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -123,12 +123,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 3) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -143,12 +143,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 4) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -163,7 +163,7 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } @@ -188,7 +188,7 @@ public class BrewingMacro { } private boolean isInventoryFull() { - List<Slot> inventory = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots; + List<Slot> inventory = Main.mc.thePlayer.inventoryContainer.inventorySlots; for (Slot slot : inventory) { if (!slot.getHasStack() && slot.slotNumber > 8) { return false; @@ -199,16 +199,16 @@ public class BrewingMacro { private BlockPos closestStand() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> stands = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.brewing_stand) { stands.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -230,6 +230,6 @@ public class BrewingMacro { } private void clickSlot(int slot, int type, int mode) { - Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId, slot, type, mode, Minecraft.getMinecraft().thePlayer); + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId, slot, type, mode, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java index 0a93a85..5f656d9 100644 --- a/src/main/java/rosegoldaddons/features/CanePlanter.java +++ b/src/main/java/rosegoldaddons/features/CanePlanter.java @@ -25,24 +25,24 @@ public class CanePlanter { int cane = findItemInHotbar("Cane"); BlockPos dirt = furthestEmptyDirt(); if (cane != -1 && dirt != null) { - ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(cane); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = cane; - Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item, dirt, EnumFacing.UP, Minecraft.getMinecraft().thePlayer.getLookVec()); + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(cane); + Main.mc.thePlayer.inventory.currentItem = cane; + Main.mc.playerController.onPlayerRightClick(Main.mc.thePlayer, Main.mc.theWorld, item, dirt, EnumFacing.UP, Main.mc.thePlayer.getLookVec()); } } private BlockPos furthestEmptyDirt() { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + IBlockState blockState2 = Main.mc.theWorld.getBlockState(blockPos.add(0, 1, 0)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -64,7 +64,7 @@ public class CanePlanter { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java index fc00737..915acae 100644 --- a/src/main/java/rosegoldaddons/features/CropNuker.java +++ b/src/main/java/rosegoldaddons/features/CropNuker.java @@ -22,15 +22,15 @@ public class CropNuker { private static int ticks = 0; @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { + public void onTick(TickEvent.PlayerTickEvent event) { //if(event.phase == TickEvent.Phase.END) return; - if (!Main.nukeCrops || Minecraft.getMinecraft().thePlayer == null) { + if (!Main.nukeCrops || Main.mc.thePlayer == null) { broken.clear(); return; } crop = closestCrop(); if (crop != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); PlayerUtils.swingItem(); broken.add(crop); } @@ -46,11 +46,11 @@ public class CropNuker { } private BlockPos closestCrop() { - if(Minecraft.getMinecraft().theWorld == null) return null; + if(Main.mc.theWorld == null) return null; double r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); if (Main.configFile.farmShapeIndex == 1) { vec3i = new Vec3i(r, 2, r); @@ -61,16 +61,16 @@ public class CropNuker { switch (Main.configFile.farmNukeIndex) { case 0: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.nether_wart || blockState.getBlock() == Blocks.potatoes || blockState.getBlock() == Blocks.wheat || blockState.getBlock() == Blocks.carrots || blockState.getBlock() == Blocks.pumpkin || blockState.getBlock() == Blocks.melon_block || blockState.getBlock() == Blocks.brown_mushroom || blockState.getBlock() == Blocks.red_mushroom || blockState.getBlock() == Blocks.cocoa) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -107,26 +107,62 @@ public class CropNuker { break; case 1: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3iCane), playerPos.subtract(vec3iCane))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.reeds || blockState.getBlock() == Blocks.cactus) { - if (!broken.contains(blockPos)) { - warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + if (Main.configFile.farmShapeIndex == 0) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } else if (Main.configFile.farmShapeIndex == 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); + switch (dir) { + case NORTH: + if (blockPos.getZ() < z && blockPos.getX() == x) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case SOUTH: + if (blockPos.getZ() > z && blockPos.getX() == x) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case WEST: + if (blockPos.getX() < x && blockPos.getZ() == z) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case EAST: + if (blockPos.getX() > x && blockPos.getZ() == z) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + } } } } break; case 2: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.nether_wart) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -163,16 +199,16 @@ public class CropNuker { break; case 3: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.wheat) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -209,16 +245,16 @@ public class CropNuker { break; case 4: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.carrots) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -255,16 +291,16 @@ public class CropNuker { break; case 5: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.potatoes) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -301,16 +337,16 @@ public class CropNuker { break; case 6: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.pumpkin) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -347,16 +383,16 @@ public class CropNuker { break; case 7: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.melon_block) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -393,16 +429,16 @@ public class CropNuker { break; case 8: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.cocoa) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 41ba9a7..b776f86 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -23,13 +23,13 @@ public class CustomItemMacro { if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { try { - int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + int prevItem = Main.mc.thePlayer.inventory.currentItem; for (String i : UseCooldown.RCitems.keySet()) { if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { int slot = findItemInHotbar(i); if (slot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(slot)); + Main.mc.thePlayer.inventory.currentItem = slot; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(slot)); } } } @@ -37,13 +37,13 @@ public class CustomItemMacro { if (milis % Math.floor(UseCooldown.LCitems.get(i)/100) == 0) { int slot = findItemInHotbar(i); if (slot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; + Main.mc.thePlayer.inventory.currentItem = slot; Thread.sleep(100); click(); } } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; + Main.mc.thePlayer.inventory.currentItem = prevItem; milis++; Thread.sleep(100); } catch (Exception e) { @@ -63,15 +63,15 @@ public class CustomItemMacro { clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); } clickMouse.setAccessible(true); - clickMouse.invoke(Minecraft.getMinecraft()); + clickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); }*/ - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/DamagePerSecond.java b/src/main/java/rosegoldaddons/features/DamagePerSecond.java deleted file mode 100644 index e0d990f..0000000 --- a/src/main/java/rosegoldaddons/features/DamagePerSecond.java +++ /dev/null @@ -1,12 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.client.Minecraft; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class DamagePerSecond { - @SubscribeEvent - public void onEntityJoin(EntityJoinWorldEvent event) { - - } -} diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index 5e88e74..b0ff72a 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -34,10 +34,10 @@ public class EndermanMacro { private static Entity getClosestEnderman() { Entity eman = null; double closest = 9999; - if(Minecraft.getMinecraft().theWorld == null) return null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0) && Minecraft.getMinecraft().thePlayer.canEntityBeSeen(entity1)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + 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)) { + 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) { closest = dist; diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index f59c37a..21a4691 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -96,7 +96,7 @@ public class EntityReach { private static Entity getClosestArmorStand(Entity entity) { Entity closest = null; double smallest = 9999; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityArmorStand) { double dist = entity.getDistanceToEntity(entity1); if(dist < smallest) { @@ -109,8 +109,8 @@ public class EntityReach { } private static boolean isLookingAtAABB(AxisAlignedBB aabb, RenderWorldLastEvent event) { - Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); - Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(event.partialTicks); look = scaleVec(look, 0.2F); for (int i = 0; i < 320; i++) { if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { @@ -124,7 +124,7 @@ public class EntityReach { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } @@ -133,13 +133,13 @@ public class EntityReach { } private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } private static void interactWithEntity2(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Main.mc.thePlayer, entity, Main.mc.objectMouseOver); } diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index c284e92..e06d7ea 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -30,7 +30,7 @@ public class ForagingIslandMacro { thread = new Thread(() -> { try { BlockPos furthestDirt = furthestEmptyDirt(); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); int sapling = findItemInHotbar("Jungle Sapling"); if(sapling == -1) { sapling = findItemInHotbar("Oak Sapling"); @@ -60,16 +60,16 @@ public class ForagingIslandMacro { RotationUtils.facePos(new Vec3(furthestDirt.getX() + 0.5, furthestDirt.getY() - 0.5, furthestDirt.getZ() + 0.5)); Thread.sleep(Main.configFile.smoothLookVelocity * 2L); if (sapling != -1) { - if (Minecraft.getMinecraft().objectMouseOver.typeOfHit.toString().equals("BLOCK")) { - BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); - Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); + if (Main.mc.objectMouseOver.typeOfHit.toString().equals("BLOCK")) { + BlockPos pos = Main.mc.objectMouseOver.getBlockPos(); + Block block = Main.mc.theWorld.getBlockState(pos).getBlock(); if (block == Blocks.sapling) { click(); Thread.sleep(20); } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = sapling; - //Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), furthestDirt, EnumFacing.NORTH, Minecraft.getMinecraft().objectMouseOver.hitVec); + Main.mc.thePlayer.inventory.currentItem = sapling; + //Main.mc.playerController.onPlayerRightClick(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getCurrentItem(), furthestDirt, EnumFacing.NORTH, Main.mc.objectMouseOver.hitVec); rightClick(); } } else { @@ -77,7 +77,7 @@ public class ForagingIslandMacro { if (dirt != null) { RotationUtils.facePos(new Vec3(dirt.getX() + 0.5, dirt.getY(), dirt.getZ() + 0.5)); if (bonemeal != -1 && treecap != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = bonemeal; + Main.mc.thePlayer.inventory.currentItem = bonemeal; Random rand = new Random(); int toAdd = 0; if(Main.configFile.randomizeForaging) { @@ -87,13 +87,13 @@ public class ForagingIslandMacro { Thread.sleep(Math.round(150*(1+(toAdd/100)))); rightClick(); rightClick(); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = treecap; + Main.mc.thePlayer.inventory.currentItem = treecap; Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100)))); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), true); Thread.sleep(Math.round(150*(1+(toAdd/100)))); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), false); Thread.sleep(Math.round(25*(1+(toAdd/100)))); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = rod; + Main.mc.thePlayer.inventory.currentItem = rod; Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100)))); rightClick(); Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100)))); @@ -124,9 +124,9 @@ public class ForagingIslandMacro { new Thread(() -> { try { Thread.sleep(rand2); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac "+responses[rand]); + Main.mc.thePlayer.sendChatMessage("/ac "+responses[rand]); Thread.sleep(rand2*2); - Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); + Main.mc.getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); } catch (Exception exception) { exception.printStackTrace(); } @@ -137,16 +137,16 @@ public class ForagingIslandMacro { private BlockPos furthestEmptyDirt() { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + IBlockState blockState2 = Main.mc.theWorld.getBlockState(blockPos.add(0, 1, 0)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -169,15 +169,15 @@ public class ForagingIslandMacro { private BlockPos closestDirt() { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.dirt) { dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -199,7 +199,7 @@ public class ForagingIslandMacro { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -220,7 +220,7 @@ public class ForagingIslandMacro { rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } @@ -235,32 +235,32 @@ public class ForagingIslandMacro { clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); } clickMouse.setAccessible(true); - clickMouse.invoke(Minecraft.getMinecraft()); + clickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static void playAlert() { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } private static void playAnnoyingAlert() { new Thread(() -> { try { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } catch (Exception exception) { exception.printStackTrace(); } diff --git a/src/main/java/rosegoldaddons/features/ForagingNuker.java b/src/main/java/rosegoldaddons/features/ForagingNuker.java index dcd3100..67b6cd7 100644 --- a/src/main/java/rosegoldaddons/features/ForagingNuker.java +++ b/src/main/java/rosegoldaddons/features/ForagingNuker.java @@ -19,7 +19,7 @@ public class ForagingNuker { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.nukeWood || Minecraft.getMinecraft().thePlayer == null || !Minecraft.getMinecraft().thePlayer.onGround) { + if (!Main.nukeWood || Main.mc.thePlayer == null || !Main.mc.thePlayer.onGround) { broken.clear(); return; } @@ -28,7 +28,7 @@ public class ForagingNuker { if(broken.size() > 10) { broken.clear(); } - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); PlayerUtils.swingItem(); broken.add(wood); } @@ -37,14 +37,14 @@ public class ForagingNuker { private BlockPos closestWood() { int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> warts = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.log || blockState.getBlock() == Blocks.log2) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index 3e0952b..28f30af 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -36,14 +36,14 @@ public class GemstoneAura { return; } if (event.phase == TickEvent.Phase.END) { - if (PlayerUtils.pickaxeAbilityReady && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + if (PlayerUtils.pickaxeAbilityReady && Main.mc.thePlayer != null) { + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if (currentDamage > 100) { currentDamage = 0; } if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() != Blocks.stained_glass && blockState.getBlock() != Blocks.stained_glass_pane) { currentDamage = 0; } @@ -56,11 +56,11 @@ public class GemstoneAura { blockHitDelay--; return; } - MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition fake = Main.mc.objectMouseOver; fake.hitVec = new Vec3(blockPos); EnumFacing enumFacing = fake.sideHit; if (currentDamage == 0 && enumFacing != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); } PlayerUtils.swingItem(); @@ -74,7 +74,7 @@ public class GemstoneAura { public void renderWorld(RenderWorldLastEvent event) { if (!Main.gemNukeToggle) return; if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); EnumDyeColor dyeColor = null; Color color = Color.BLACK; if (blockState.getBlock() == Blocks.stained_glass) { @@ -104,15 +104,15 @@ public class GemstoneAura { private BlockPos closestGemstone() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.stained_glass) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -124,7 +124,7 @@ public class GemstoneAura { } if (Main.configFile.prioblocks) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.stained_glass_pane) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 364471b..1e9f467 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -36,10 +36,10 @@ public class GhostMacro { private static Entity getClosestCreeper() { Entity eman = null; double closest = 9999.0; - if(Minecraft.getMinecraft().theWorld == null) return null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if(Main.mc.theWorld == null) return null; + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityCreeper && !(((EntityCreeper) entity1).getHealth() == 0)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + 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) { closest = dist; diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 51f3aeb..8cecae7 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -1,5 +1,8 @@ package rosegoldaddons.features; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; @@ -7,6 +10,7 @@ import net.minecraft.client.settings.GameSettings; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; +import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; @@ -18,6 +22,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; @@ -32,6 +37,8 @@ public class HardstoneAura { private static Vec3 closestChest; private boolean stopHardstone = false; private static int ticks = 0; + private static BlockPos gemstone; + private static BlockPos lastGem; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { @@ -48,26 +55,35 @@ public class HardstoneAura { } } if(Main.configFile.hardIndex == 1) { - if (broken.size() > 4) { + if (broken.size() > 6) { broken.clear(); } } - if(ticks > 15) { + if(ticks > 20) { broken.clear(); ticks = 0; } closestStone = closestStone(); - if (closestStone != null) { - MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + if(gemstone != null && Main.mc.thePlayer != null) { + if(lastGem != null && !lastGem.equals(gemstone)) { + currentDamage = 0; + } + lastGem = gemstone; + if (currentDamage == 0) { + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, gemstone, EnumFacing.DOWN)); + } + PlayerUtils.swingItem(); + currentDamage++; + } + if (closestStone != null && gemstone == null) { + currentDamage = 0; + MovingObjectPosition fake = Main.mc.objectMouseOver; fake.hitVec = new Vec3(closestStone); EnumFacing enumFacing = fake.sideHit; - if (currentDamage == 0 && enumFacing != null && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); - } - MovingObjectPosition real = Minecraft.getMinecraft().objectMouseOver; - if (real != null && real.entityHit == null && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().thePlayer.swingItem(); + if (enumFacing != null && Main.mc.thePlayer != null) { + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); } + PlayerUtils.swingItem(); broken.add(closestStone); } } @@ -79,14 +95,11 @@ public class HardstoneAura { if (event.packet instanceof S2APacketParticles) { S2APacketParticles packet = (S2APacketParticles) event.packet; if (packet.getParticleType().equals(EnumParticleTypes.CRIT)) { - Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate()); + Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate()); if (closestChest != null) { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - particlePos = particlePos.add(new Vec3(0, -1, 0)); - int drill = PowderMacro.findItemInHotbar("X655"); - if (drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill; RotationUtils.facePos(particlePos); } } @@ -97,7 +110,7 @@ public class HardstoneAura { @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { if(Main.configFile.guilag) { - Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); + Main.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); } if(!Main.autoHardStone) return; if (event.gui instanceof GuiChest) { @@ -107,7 +120,7 @@ public class HardstoneAura { if (chestName.contains("Treasure")) { solved.add(closestChest); stopHardstone = false; - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } @@ -126,6 +139,33 @@ public class HardstoneAura { } else { stopHardstone = false; } + if (gemstone != null) { + IBlockState blockState = Main.mc.theWorld.getBlockState(gemstone); + EnumDyeColor dyeColor = null; + Color color = Color.BLACK; + if (blockState.getBlock() == Blocks.stained_glass) { + dyeColor = blockState.getValue(BlockStainedGlass.COLOR); + } + if (blockState.getBlock() == Blocks.stained_glass_pane) { + dyeColor = blockState.getValue(BlockStainedGlassPane.COLOR); + } + if (dyeColor == EnumDyeColor.RED) { + color = new Color(188, 3, 29); + } else if (dyeColor == EnumDyeColor.PURPLE) { + color = new Color(137, 0, 201); + } else if (dyeColor == EnumDyeColor.LIME) { + color = new Color(157, 249, 32); + } else if (dyeColor == EnumDyeColor.LIGHT_BLUE) { + color = new Color(60, 121, 224); + } else if (dyeColor == EnumDyeColor.ORANGE) { + color = new Color(237, 139, 35); + } else if (dyeColor == EnumDyeColor.YELLOW) { + color = new Color(249, 215, 36); + } else if (dyeColor == EnumDyeColor.MAGENTA) { + color = new Color(214, 15, 150); + } + RenderUtils.drawBlockBox(gemstone, color, true, event.partialTicks); + } } @SubscribeEvent @@ -134,18 +174,19 @@ public class HardstoneAura { } private BlockPos closestStone() { - if(Minecraft.getMinecraft().theWorld == null) return null; - if(Minecraft.getMinecraft().thePlayer == null) return null; + if(Main.mc.theWorld == null) return null; + if(Main.mc.thePlayer == null) return null; int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); Vec3i vec3i2 = new Vec3i(r, 0, r); ArrayList<Vec3> stones = new ArrayList<Vec3>(); + ArrayList<Vec3> gemstones = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(Main.configFile.hardIndex == 0) { if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); @@ -157,13 +198,16 @@ public class HardstoneAura { } } if(Main.configFile.hardIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: - if(blockPos.getZ() < z && blockPos.getX() == x) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + 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 (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) { @@ -174,8 +218,11 @@ public class HardstoneAura { } break; case SOUTH: - if(blockPos.getZ() > z && blockPos.getX() == x) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + 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 (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) { @@ -186,8 +233,11 @@ public class HardstoneAura { } break; case WEST: - if(blockPos.getX() < x && blockPos.getZ() == z) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + 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 (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) { @@ -198,8 +248,11 @@ public class HardstoneAura { } break; case EAST: - if(blockPos.getX() > x && blockPos.getZ() == z) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + 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 (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) { @@ -222,6 +275,21 @@ public class HardstoneAura { closest = stone; } } + + double smallestgem = 9999; + Vec3 closestgem = null; + for (Vec3 gem : gemstones) { + double dist = gem.distanceTo(playerVec); + if (dist < smallestgem) { + smallestgem = dist; + closestgem = gem; + } + } + if (closestgem != null) { + gemstone = new BlockPos(closestgem.xCoord, closestgem.yCoord, closestgem.zCoord); + } else { + gemstone = null; + } if (closest != null && smallest < 5) { return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); } @@ -229,18 +297,18 @@ public class HardstoneAura { } private Vec3 closestChest() { - if(Minecraft.getMinecraft().theWorld == null) return null; - if(Minecraft.getMinecraft().thePlayer == null) return null; + if(Main.mc.theWorld == null) return null; + if(Main.mc.thePlayer == null) return null; int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + 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)); } @@ -259,4 +327,21 @@ public class HardstoneAura { } return closest; } + + private boolean isSlow(IBlockState blockState) { + if(blockState.getBlock() == Blocks.prismarine) { + return true; + } else if(blockState.getBlock() == Blocks.wool) { + return true; + } else if(blockState.getBlock() == Blocks.stained_hardened_clay) { + return true; + } else if(!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if(blockState.getBlock() == Blocks.gold_block) { + return true; + } 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/MithrilMacro.java b/src/main/java/rosegoldaddons/features/MithrilMacro.java new file mode 100644 index 0000000..ce9509b --- /dev/null +++ b/src/main/java/rosegoldaddons/features/MithrilMacro.java @@ -0,0 +1,133 @@ +package rosegoldaddons.features; + +import net.minecraft.block.BlockStone; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.*; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Random; + +public class MithrilMacro { + private Vec3 vec = null; + private int currentDamage; + private BlockPos blockPos = null; + private Vec3 lastVec = null; + private BlockPos lastBlockPos = null; + private final KeyBinding lc = Main.mc.gameSettings.keyBindAttack; + private boolean holdingLeft = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (Main.mc.currentScreen != null) return; + if (!Main.mithrilMacro) { + if (holdingLeft) { + KeyBinding.setKeyBindState(lc.getKeyCode(), false); + holdingLeft = false; + } + currentDamage = 0; + return; + } + if (PlayerUtils.pickaxeAbilityReady) { + KeyBinding.setKeyBindState(lc.getKeyCode(), false); + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + PlayerUtils.pickaxeAbilityReady = false; + } + if (currentDamage > 100) { + KeyBinding.setKeyBindState(lc.getKeyCode(), false); + currentDamage = 0; + } + lastBlockPos = blockPos; + blockPos = closestMithril(); + if (lastBlockPos != null && blockPos != null && !lastBlockPos.equals(blockPos)) { + ChatUtils.sendMessage("Block pos was changed."); + currentDamage = 0; + } + if (blockPos != null) { + ArrayList<Vec3> vec3s = BlockUtils.whereToMineBlock(blockPos); + if (vec3s.size() > 0) { + vec = vec3s.get(0); + if (vec != null) { + RotationUtils.facePos(vec); + lastVec = vec; + KeyBinding.setKeyBindState(lc.getKeyCode(), true); + holdingLeft = true; + } + + currentDamage += 1; + } + } + + } + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + if (!Main.mithrilMacro) return; + if (vec != null) { + RenderUtils.drawPixelBox(vec, Color.RED, 0.01, event.partialTicks); + } + if (blockPos != null) { + RenderUtils.drawBlockBox(blockPos, Color.CYAN, true, event.partialTicks); + } + } + + private BlockPos closestMithril() { + int r = 6; + if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition().add(0, 1, 0); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> blocks = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if (isMithril(blockState)) { + if (BlockUtils.whereToMineBlock(blockPos).size() > 0) { + blocks.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 block : blocks) { + double dist = block.distanceTo(playerVec); + if (lastBlockPos != null) { + dist = block.distanceTo(new Vec3(lastBlockPos.getX() + 0.5, lastBlockPos.getY() + 0.5, lastBlockPos.getZ() + 0.5)); + } + if (dist < smallest) { + smallest = dist; + closest = block; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private boolean isMithril(IBlockState blockState) { + if (blockState.getBlock() == Blocks.prismarine) { + return true; + } else if (blockState.getBlock() == Blocks.wool) { + return true; + } else if (blockState.getBlock() == Blocks.stained_hardened_clay) { + return true; + } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if (blockState.getBlock() == Blocks.gold_block) { + return true; + } + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index c84b378..2e2e9e5 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -24,19 +24,19 @@ public class MithrilNuker { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.mithrilNuker || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) { + if (!Main.mithrilNuker || Main.mc.thePlayer == null || Main.mc.theWorld == null) { currentDamage = 0; return; } if (event.phase == TickEvent.Phase.END) { if(PlayerUtils.pickaxeAbilityReady) { - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if(currentDamage > 100) { currentDamage = 0; } - if(blockPos != null && Minecraft.getMinecraft().theWorld != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(blockPos != null && Main.mc.theWorld != null) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.bedrock || blockState.getBlock() == Blocks.air) { currentDamage = 0; } @@ -50,7 +50,7 @@ public class MithrilNuker { return; } if (currentDamage == 0) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); if(Main.configFile.mithrilLook) { RotationUtils.facePos(new Vec3(blockPos.getX() + 0.5, blockPos.getY() - 1, blockPos.getZ() + 0.5)); } @@ -64,9 +64,9 @@ public class MithrilNuker { @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { - if (!Main.mithrilNuker || Minecraft.getMinecraft().theWorld == null) return; + if (!Main.mithrilNuker || Main.mc.theWorld == null) return; if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(blockState.getBlock() == Blocks.stone) { RenderUtils.drawBlockBox(blockPos, Color.WHITE, true, event.partialTicks); } else { @@ -77,15 +77,15 @@ public class MithrilNuker { private BlockPos closestMithril() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (isMithril(blockState)) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } diff --git a/src/main/java/rosegoldaddons/features/NecronAimbot.java b/src/main/java/rosegoldaddons/features/NecronAimbot.java index 59e1493..b491951 100644 --- a/src/main/java/rosegoldaddons/features/NecronAimbot.java +++ b/src/main/java/rosegoldaddons/features/NecronAimbot.java @@ -26,9 +26,9 @@ public class NecronAimbot { private static Entity getClosestWither() { Entity necron = null; Double closest = Double.valueOf(9999); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityWither && !(((EntityWither) entity1).getHealth() == 0)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + double dist = entity1.getDistanceSq(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { closest = dist; necron = entity1; diff --git a/src/main/java/rosegoldaddons/features/PartyUntransfer.java b/src/main/java/rosegoldaddons/features/PartyUntransfer.java index c88b4e3..be4f89d 100644 --- a/src/main/java/rosegoldaddons/features/PartyUntransfer.java +++ b/src/main/java/rosegoldaddons/features/PartyUntransfer.java @@ -13,14 +13,14 @@ public class PartyUntransfer { if (!Main.configFile.AutoUntransfer) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()).toLowerCase(); if (message.contains("the party was transferred to")) { - String playerName = Minecraft.getMinecraft().thePlayer.getName(); + String playerName = Main.mc.thePlayer.getName(); String leader = stripRank(message.substring(message.indexOf("by")+3)); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader); + Main.mc.thePlayer.sendChatMessage("/p transfer "+leader); } if(message.contains("has promoted")) { - String playerName = Minecraft.getMinecraft().thePlayer.getName(); + String playerName = Main.mc.thePlayer.getName(); String leader = stripRank(message.substring(0 ,message.indexOf("has promoted")-1)); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader); + Main.mc.thePlayer.sendChatMessage("/p transfer "+leader); } } diff --git a/src/main/java/rosegoldaddons/features/PingWorldChange.java b/src/main/java/rosegoldaddons/features/PingWorldChange.java index 9f9663b..0ac8cb6 100644 --- a/src/main/java/rosegoldaddons/features/PingWorldChange.java +++ b/src/main/java/rosegoldaddons/features/PingWorldChange.java @@ -17,7 +17,7 @@ public class PingWorldChange { if(Main.configFile.pingworldchange && countdown == 0) { String url = Main.configFile.hookurl; String id = Main.configFile.discordid; - if(url.contains("https://discord.com/api/webhooks/")) { + if(url.contains("https://") && (url.contains("discord.com/api/webhooks/") || url.contains("discordapp.com/api/webhooks/"))) { if(!id.equals("")) { DiscordWebhook webhook = new DiscordWebhook(url); webhook.setContent("<@" + id + "> Detected World Change."); diff --git a/src/main/java/rosegoldaddons/features/PinglessMining.java b/src/main/java/rosegoldaddons/features/PinglessMining.java index 9b21e91..c617ae4 100644 --- a/src/main/java/rosegoldaddons/features/PinglessMining.java +++ b/src/main/java/rosegoldaddons/features/PinglessMining.java @@ -20,7 +20,7 @@ import java.util.ArrayList; public class PinglessMining { private static BlockPos block = null; private static final ArrayList<BlockPos> broken = new ArrayList<>(); - private final KeyBinding lc = Minecraft.getMinecraft().gameSettings.keyBindAttack; + private final KeyBinding lc = Main.mc.gameSettings.keyBindAttack; private static int ticks = 0; @SubscribeEvent @@ -33,13 +33,14 @@ public class PinglessMining { } if (lc != null && lc.isKeyDown()) { if (block != null) { - MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); + Block b = Main.mc.theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore || - b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) { + b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore || + b == Blocks.nether_wart || b == Blocks.reeds || b == Blocks.potatoes || b == Blocks.carrots) { broken.add(block); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); PlayerUtils.swingItem(); } } @@ -48,7 +49,7 @@ public class PinglessMining { } @SubscribeEvent - public void onTick40(TickEvent.PlayerTickEvent event) { + public void onTick40(TickEvent.ClientTickEvent event) { if (!Main.configFile.pinglessMining) return; if (Main.configFile.pinglessSpeed == 2) return; if (Main.configFile.pinglessSpeed == 0 && event.phase == TickEvent.Phase.END) return; @@ -58,13 +59,13 @@ public class PinglessMining { } if (lc != null && lc.isKeyDown()) { if (block != null) { - MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); + Block b = Main.mc.theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore || b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) { broken.add(block); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); PlayerUtils.swingItem(); } } @@ -74,7 +75,7 @@ public class PinglessMining { @SubscribeEvent public void onRender(RenderWorldLastEvent event) { - if (!Main.configFile.pinglessMining || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) { + if (!Main.configFile.pinglessMining || Main.mc.thePlayer == null || Main.mc.theWorld == null) { broken.clear(); return; } @@ -86,12 +87,12 @@ public class PinglessMining { private BlockPos closestBlock(RenderWorldLastEvent event) { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition().add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + BlockPos playerPos = Main.mc.thePlayer.getPosition().add(0, 1, 0); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> blocks = new ArrayList<>(); for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (isLookingAtBlock(blockPos, event) && !broken.contains(blockPos) && blockState.getBlock() != Blocks.air) { blocks.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -113,8 +114,8 @@ public class PinglessMining { private boolean isLookingAtBlock(BlockPos blockPos, RenderWorldLastEvent event) { AxisAlignedBB aabb = AxisAlignedBB.fromBounds(blockPos.getX(), blockPos.getY(), blockPos.getZ(), blockPos.getX() + 1, blockPos.getY() + 1, blockPos.getZ() + 1); - Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); - Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(event.partialTicks); look = scaleVec(look, 0.2F); for (int i = 0; i < 40; i++) { if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index e350648..b4d0937 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -35,7 +35,7 @@ public class PowderMacro { if (dist < 1) { particlePos = particlePos.add(new Vec3(0, -1, 0)); int drill = findItemInHotbar("X655"); - if(drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill; + if(drill != -1) Main.mc.thePlayer.inventory.currentItem = drill; RotationUtils.facePos(particlePos); } } @@ -54,15 +54,15 @@ public class PowderMacro { private static Vec3 closestChest() { int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + 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)); } @@ -81,7 +81,7 @@ public class PowderMacro { } public static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 72df86d..54e88f2 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -1,10 +1,15 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.RenderLivingEntityEvent; + +import java.util.Map; public class SexAura { @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -15,19 +20,34 @@ public class SexAura { if (message.startsWith("From") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } } } + @SubscribeEvent + public void onEntityRender(RenderLivingEntityEvent event) { + if (Main.init) { + String text = event.entity.getDisplayName().getFormattedText(); + for (Map.Entry<String, String> entry : Main.resp.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (text.contains(key) && !text.contains(value)) { + event.entity.setCustomNameTag(text.replace(key, value)); + break; + } + } + } + } + private static void playAlert() { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } } diff --git a/src/main/java/rosegoldaddons/features/SwordSwapping.java b/src/main/java/rosegoldaddons/features/SwordSwapping.java index 4a309f0..cc45b6e 100644 --- a/src/main/java/rosegoldaddons/features/SwordSwapping.java +++ b/src/main/java/rosegoldaddons/features/SwordSwapping.java @@ -27,14 +27,14 @@ public class SwordSwapping { rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -48,7 +48,7 @@ public class SwordSwapping { @SubscribeEvent public void onTick(TickEvent.PlayerTickEvent event) { - if (Minecraft.getMinecraft().currentScreen != null) return; + if (Main.mc.currentScreen != null) return; if (!Main.AOTSMacro && !Main.SoulWhipMacro) { tickCount = 0; return; @@ -57,7 +57,7 @@ public class SwordSwapping { thread = new Thread(() -> { try { Thread.sleep(Main.configFile.swapFrequency); - int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + int prevItem = Main.mc.thePlayer.inventory.currentItem; int orbSlot = findItemInHotbar("Power Orb"); int tubaSlot = findItemInHotbar("Tuba"); int wandSlot = findItemInHotbar("Atonement"); @@ -70,31 +70,31 @@ public class SwordSwapping { whipSlot = findItemInHotbar("Whip"); } if(whipSlot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = whipSlot; + Main.mc.thePlayer.inventory.currentItem = whipSlot; rightClick(); } if(aotsSlot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = aotsSlot; + Main.mc.thePlayer.inventory.currentItem = aotsSlot; rightClick(); } if(Main.configFile.UseUtility) { if(tickCount % Math.round((1000/Main.configFile.swapFrequency*20)) == 1 && tubaSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = tubaSlot; + Main.mc.thePlayer.inventory.currentItem = tubaSlot; rightClick(); } if(tickCount % Math.round((1000/Main.configFile.swapFrequency*59)) == 1 && orbSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = orbSlot; + Main.mc.thePlayer.inventory.currentItem = orbSlot; rightClick(); } if(tickCount % Math.round((1000/Main.configFile.swapFrequency*7)) == 1 && wandSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = wandSlot; + Main.mc.thePlayer.inventory.currentItem = wandSlot; rightClick(); } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; + Main.mc.thePlayer.inventory.currentItem = prevItem; tickCount++; } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java index 4db798b..f7b0e8d 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java @@ -23,6 +23,7 @@ public abstract class MixinRenderString { if (text.contains(key) && !text.contains(value)) { text = text.replace(key, value)+"§r"; + break; } } } diff --git a/src/main/java/rosegoldaddons/utils/BlockUtils.java b/src/main/java/rosegoldaddons/utils/BlockUtils.java new file mode 100644 index 0000000..12ad293 --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/BlockUtils.java @@ -0,0 +1,155 @@ +package rosegoldaddons.utils; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.util.*; +import rosegoldaddons.Main; + +import java.util.ArrayList; + +public class BlockUtils { + public static Vec3 bp = null; + + public static ArrayList<Vec3> whereToMineBlock(BlockPos pos) { + Vec3 center = new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + ArrayList<Vec3> vec3s = new ArrayList<>(); + MovingObjectPosition position = rayTrace(center, 4.5F); + if (position != null && position.getBlockPos().equals(pos)) + //return position.hitVec; + vec3s.add(position.hitVec); + for (int x = 1; x < 5; x++) { + for (int y = 1; y < 5; y++) { + for (int z = 1; z < 5; z++) { + Vec3 vec = new Vec3(pos.getX() + x / 4.0D - 0.125D, pos.getY() + y / 4.0D - 0.125D, pos.getZ() + z / 4.0D - 0.125D); + position = rayTrace(vec, 4.5F); + if (position != null) { + bp = position.hitVec; + if (position.getBlockPos().equals(pos)) + //return position.hitVec; + vec3s.add(position.hitVec); + } + } + } + } + return vec3s; + } + + + public static MovingObjectPosition rayTrace(Vec3 target, float range) { + Vec3 vec3 = Main.mc.thePlayer.getPositionEyes(1f); + Vec3 vec31 = getLook(target); + return fastRayTrace(vec3, vec3.addVector(vec31.xCoord * (double)range, vec31.yCoord * (double)range, vec31.zCoord * (double)range)); + } + + public static Vec3 getLook(Vec3 vec) { + double diffX = vec.xCoord - Main.mc.thePlayer.posX; + double diffY = vec.yCoord - (Main.mc.thePlayer.posY + (double)Main.mc.thePlayer.getEyeHeight()); + double diffZ = vec.zCoord - Main.mc.thePlayer.posZ; + double dist = Math.sqrt(diffX * diffX + diffZ * diffZ); + return getVectorForRotation((float)(-(Math.atan2(diffY, dist) * 180.0 / Math.PI)), (float)(Math.atan2(diffZ, diffX) * 180.0 / Math.PI - 90.0)); + } + + public static Vec3 getVectorForRotation(float pitch, float yaw) { + double f2 = -Math.cos(-pitch * ((float)Math.PI / 180)); + return new Vec3(Math.sin(-yaw * ((float)Math.PI / 180) - (float)Math.PI) * f2, Math.sin(-pitch * ((float)Math.PI / 180)), Math.cos(-yaw * ((float)Math.PI / 180) - (float)Math.PI) * f2); + } + + private static MovingObjectPosition fastRayTrace(Vec3 vec31, Vec3 vec32) { + MovingObjectPosition movingobjectposition; + int j1; + int i1; + int i = (int) Math.floor(vec32.xCoord); + int j = (int) Math.floor(vec32.yCoord); + int k = (int) Math.floor(vec32.zCoord); + int l = (int) Math.floor(vec31.xCoord); + BlockPos blockpos = new BlockPos(l, i1 = (int) Math.floor(vec31.yCoord), j1 = (int) Math.floor(vec31.zCoord)); + IBlockState iblockstate = Main.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + if (block.canCollideCheck(iblockstate, false) && (movingobjectposition = block.collisionRayTrace(Main.mc.theWorld, blockpos, vec31, vec32)) != null) { + return movingobjectposition; + } + MovingObjectPosition movingobjectposition2 = null; + int k1 = 200; + while (k1-- >= 0) { + EnumFacing enumfacing; + if (l == i && i1 == j && j1 == k) { + return movingobjectposition2; + } + boolean flag2 = true; + boolean flag = true; + boolean flag1 = true; + double d0 = 999.0; + double d1 = 999.0; + double d2 = 999.0; + if (i > l) { + d0 = (double)l + 1.0; + } else if (i < l) { + d0 = (double)l + 0.0; + } else { + flag2 = false; + } + if (j > i1) { + d1 = (double)i1 + 1.0; + } else if (j < i1) { + d1 = (double)i1 + 0.0; + } else { + flag = false; + } + if (k > j1) { + d2 = (double)j1 + 1.0; + } else if (k < j1) { + d2 = (double)j1 + 0.0; + } else { + flag1 = false; + } + double d3 = 999.0; + double d4 = 999.0; + double d5 = 999.0; + double d6 = vec32.xCoord - vec31.xCoord; + double d7 = vec32.yCoord - vec31.yCoord; + double d8 = vec32.zCoord - vec31.zCoord; + if (flag2) { + d3 = (d0 - vec31.xCoord) / d6; + } + if (flag) { + d4 = (d1 - vec31.yCoord) / d7; + } + if (flag1) { + d5 = (d2 - vec31.zCoord) / d8; + } + if (d3 == -0.0) { + d3 = -1.0E-4; + } + if (d4 == -0.0) { + d4 = -1.0E-4; + } + if (d5 == -0.0) { + d5 = -1.0E-4; + } + if (d3 < d4 && d3 < d5) { + enumfacing = i > l ? EnumFacing.WEST : EnumFacing.EAST; + vec31 = new Vec3(d0, vec31.yCoord + d7 * d3, vec31.zCoord + d8 * d3); + } else if (d4 < d5) { + enumfacing = j > i1 ? EnumFacing.DOWN : EnumFacing.UP; + vec31 = new Vec3(vec31.xCoord + d6 * d4, d1, vec31.zCoord + d8 * d4); + } else { + enumfacing = k > j1 ? EnumFacing.NORTH : EnumFacing.SOUTH; + vec31 = new Vec3(vec31.xCoord + d6 * d5, vec31.yCoord + d7 * d5, d2); + } + l = MathHelper.floor_double((double)vec31.xCoord) - (enumfacing == EnumFacing.EAST ? 1 : 0); + i1 = MathHelper.floor_double((double)vec31.yCoord) - (enumfacing == EnumFacing.UP ? 1 : 0); + j1 = MathHelper.floor_double((double)vec31.zCoord) - (enumfacing == EnumFacing.SOUTH ? 1 : 0); + blockpos = new BlockPos(l, i1, j1); + IBlockState iblockstate1 = Main.mc.theWorld.getBlockState(blockpos); + Block block1 = iblockstate1.getBlock(); + if (block1.canCollideCheck(iblockstate1, false)) { + MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(Main.mc.theWorld, blockpos, vec31, vec32); + if (movingobjectposition1 == null) continue; + return movingobjectposition1; + } + movingobjectposition2 = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec31, enumfacing, blockpos); + } + return movingobjectposition2; + } +} diff --git a/src/main/java/rosegoldaddons/utils/ChatUtils.java b/src/main/java/rosegoldaddons/utils/ChatUtils.java index 43107eb..26ac190 100644 --- a/src/main/java/rosegoldaddons/utils/ChatUtils.java +++ b/src/main/java/rosegoldaddons/utils/ChatUtils.java @@ -8,6 +8,7 @@ import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import org.jetbrains.annotations.NotNull; +import rosegoldaddons.Main; import java.util.Iterator; import java.util.List; @@ -18,8 +19,8 @@ public class ChatUtils { /* § */ public static void sendMessage(String message) { - if (Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] " + message)); + if (Main.mc.thePlayer != null) { + Main.mc.thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] " + message)); } } diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java index b0760a0..2e574fb 100644 --- a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java +++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java @@ -8,6 +8,7 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; import rosegoldaddons.commands.Rosedrobe; import rosegoldaddons.commands.Rosepet; import scala.Int; @@ -21,7 +22,6 @@ public class OpenSkyblockGui { @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { if(!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS) return; - ChatUtils.sendMessage("OpenSkyblockGui"); if (event.gui instanceof GuiChest) { Container container = ((GuiChest) event.gui).inventorySlots; if (container instanceof ContainerChest) { @@ -32,7 +32,7 @@ public class OpenSkyblockGui { clickSlot(32, 0, 1); if (Rosedrobe.slot > 0) { clickSlot(Rosedrobe.slot + 35, 0, 2); - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } Rosedrobe.openWardrobe = false; } @@ -59,12 +59,12 @@ public class OpenSkyblockGui { return; } if (!petName.equals("")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (slot.getStack().getDisplayName().contains(petName)) { clickSlot(slot.slotNumber, 0, 0); - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); Rosepet.openPetS = false; return; } @@ -73,7 +73,7 @@ public class OpenSkyblockGui { clickSlot(53, 0, 0); } else { Rosepet.openPetS = false; - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); ChatUtils.sendMessage("No pet named "+petName+" found."); } } else { @@ -89,10 +89,10 @@ public class OpenSkyblockGui { public static void openTradesMenu() { openTrades = true; - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + Main.mc.thePlayer.sendChatMessage("/pets"); } private void clickSlot(int slot, int type, int windowAdd) { - Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/utils/PlayerUtils.java b/src/main/java/rosegoldaddons/utils/PlayerUtils.java index b41d047..f0662c0 100644 --- a/src/main/java/rosegoldaddons/utils/PlayerUtils.java +++ b/src/main/java/rosegoldaddons/utils/PlayerUtils.java @@ -12,9 +12,9 @@ public class PlayerUtils { public static boolean pickaxeAbilityReady = false; public static void swingItem() { - MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; if (movingObjectPosition != null && movingObjectPosition.entityHit == null) { - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } } @@ -26,10 +26,10 @@ public class PlayerUtils { @SubscribeEvent public void chat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - if (message.contains(":")) return; - if(message.contains("You used your")) { + if (message.contains(":") || message.contains(">")) return; + if(message.startsWith("You used your")) { pickaxeAbilityReady = false; - } else if(message.contains("is now available!")) { + } else if(message.endsWith("is now available!")) { pickaxeAbilityReady = true; } } diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java index 37c6e98..cf83c28 100644 --- a/src/main/java/rosegoldaddons/utils/RenderUtils.java +++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java @@ -12,12 +12,10 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.*; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import rosegoldaddons.Main; import java.awt.*; import java.util.HashMap; @@ -30,7 +28,7 @@ public class RenderUtils { private static final Map<Integer, Boolean> glCapMap = new HashMap<>(); private static final int[] DISPLAY_LISTS_2D = new int[4]; - private static final Minecraft mc = Minecraft.getMinecraft(); + private static final Minecraft mc = Main.mc; static { for (int i = 0; i < DISPLAY_LISTS_2D.length; i++) { @@ -119,6 +117,34 @@ public class RenderUtils { resetCaps(); } + public static void drawPixelBox(final Vec3 vec, final Color color, final double size, float partialTicks) { + final RenderManager renderManager = mc.getRenderManager(); + + final double x = vec.xCoord - renderManager.viewerPosX; + final double y = vec.yCoord - renderManager.viewerPosY; + final double z = vec.zCoord - renderManager.viewerPosZ; + + AxisAlignedBB axisAlignedBB = new AxisAlignedBB(x, y, z, x + size, y + size, z + size); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + enableGlCap(GL_BLEND); + disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST); + glDepthMask(false); + + glColor(color.getRed(), color.getGreen(), color.getBlue(), 35); + //drawFilledBox(axisAlignedBB); + + glLineWidth(3F); + enableGlCap(GL_LINE_SMOOTH); + glColor(color); + + drawSelectionBoundingBox(axisAlignedBB); + + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glDepthMask(true); + resetCaps(); + } + public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); @@ -637,7 +663,7 @@ public class RenderUtils { GlStateManager.pushMatrix(); - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + Entity viewer = Main.mc.getRenderViewEntity(); double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; @@ -648,7 +674,7 @@ public class RenderUtils { double distSq = x * x + y * y + z * z; double dist = Math.sqrt(distSq); - if(distSq > 144) { + if (distSq > 144) { x *= 12 / dist; y *= 12 / dist; z *= 12 / dist; @@ -658,11 +684,11 @@ public class RenderUtils { drawNametag(str); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-Main.mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Main.mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0, -0.25f, 0); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-Main.mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(Main.mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); drawNametag(EnumChatFormatting.YELLOW.toString() + Math.round(dist) + " blocks"); @@ -672,13 +698,13 @@ public class RenderUtils { } public static void drawNametag(String str) { - FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; + FontRenderer fontrenderer = Main.mc.fontRendererObj; float f = 1.6F; float f1 = 0.016666668F * f; GlStateManager.pushMatrix(); GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-Main.mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Main.mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); diff --git a/src/main/java/rosegoldaddons/utils/Rotation.java b/src/main/java/rosegoldaddons/utils/Rotation.java new file mode 100644 index 0000000..f18d5ef --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/Rotation.java @@ -0,0 +1,44 @@ +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/RotationUtils.java b/src/main/java/rosegoldaddons/utils/RotationUtils.java index a9b2e78..2ead71f 100644 --- a/src/main/java/rosegoldaddons/utils/RotationUtils.java +++ b/src/main/java/rosegoldaddons/utils/RotationUtils.java @@ -1,52 +1,82 @@ package rosegoldaddons.utils; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.network.play.client.C03PacketPlayer; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import rosegoldaddons.Main; -import java.security.Key; - public class RotationUtils { static boolean working = false; static boolean snek = false; - static boolean antiafking = false; + public static Rotation startRot; + public static Rotation neededChange; + public static Rotation endRot; + public static long startTime; + public static long endTime; + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + update(); + } - public static void antiAfk() { - if (Minecraft.getMinecraft().currentScreen != null) { - if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) { - } else { - return; + //bing chilling thx apfel + public static void update() { + if (System.currentTimeMillis() <= endTime) { + if(startRot != null && endRot != null) { + Main.mc.thePlayer.rotationYaw = interpolate(startRot.getYaw(), endRot.getYaw()); + Main.mc.thePlayer.rotationPitch = interpolate(startRot.getPitch(), endRot.getPitch()); } - } - if (snek) return; - KeyBinding right = Minecraft.getMinecraft().gameSettings.keyBindRight; - KeyBinding left = Minecraft.getMinecraft().gameSettings.keyBindLeft; - new Thread(() -> { - try { - KeyBinding.setKeyBindState(right.getKeyCode(), true); - Thread.sleep(50); - KeyBinding.setKeyBindState(right.getKeyCode(), false); - Thread.sleep(200); - KeyBinding.setKeyBindState(left.getKeyCode(), true); - Thread.sleep(50); - KeyBinding.setKeyBindState(left.getKeyCode(), false); - } catch (InterruptedException e) { - e.printStackTrace(); + } else { + if(startRot != null && endRot != null) { + Main.mc.thePlayer.rotationYaw = endRot.getYaw(); + Main.mc.thePlayer.rotationPitch = endRot.getPitch(); + reset(); } - }).start(); + } } + private static void reset() { + startRot = null; + neededChange = null; + endRot = null; + } + + private static float interpolate(float f, float t) { + float x = System.currentTimeMillis() - startTime; + float u = (f - t) / 2.0f; + return (float) (u * Math.cos((float) (x * Math.PI / (endTime - startTime))) - u + f); + } + + public static void setup(Rotation rot, Long aimTime) { + startRot = new Rotation(Main.mc.thePlayer.rotationYaw, Main.mc.thePlayer.rotationPitch); + neededChange = getNeededChange(startRot, rot); + endRot = new Rotation(startRot.getYaw() + neededChange.getYaw(), startRot.getPitch() + neededChange.getPitch()); + startTime = System.currentTimeMillis(); + endTime = System.currentTimeMillis() + aimTime; + } + + public static Rotation getNeededChange(Rotation startRot, Rotation endRot) { + float yawChng = (float) (wrapAngleTo180(endRot.getYaw()) - wrapAngleTo180(startRot.getYaw())); + if (yawChng <= -180.0F) { + yawChng += 360.0F; + } else if (yawChng > 180.0F) { + yawChng += -360.0F; + } + + return new Rotation(yawChng, endRot.getPitch() - startRot.getPitch()); + } + + public static void shootEman() { - if (Minecraft.getMinecraft().currentScreen != null) { - if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) { + if (Main.mc.currentScreen != null) { + if (Main.mc.currentScreen instanceof GuiIngameMenu || Main.mc.currentScreen instanceof GuiChat) { } else { return; } @@ -55,13 +85,13 @@ public class RotationUtils { new Thread(() -> { try { snek = true; - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); Thread.sleep(50); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); Thread.sleep(50); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); Thread.sleep(50); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); snek = false; } catch (Exception e) { e.printStackTrace(); @@ -70,8 +100,8 @@ public class RotationUtils { } public static void facePos(Vec3 vector) { - if (Minecraft.getMinecraft().currentScreen != null) { - if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) { + if (Main.mc.currentScreen != null) { + if (Main.mc.currentScreen instanceof GuiIngameMenu || Main.mc.currentScreen instanceof GuiChat) { } else { return; } @@ -80,21 +110,22 @@ public class RotationUtils { new Thread(() -> { try { working = true; - double diffX = vector.xCoord - (Minecraft.getMinecraft()).thePlayer.posX; - double diffY = vector.yCoord - (Minecraft.getMinecraft()).thePlayer.posY; - double diffZ = vector.zCoord - (Minecraft.getMinecraft()).thePlayer.posZ; + double diffX = vector.xCoord - Main.mc.thePlayer.posX; + double diffY = vector.yCoord - (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()); + double diffZ = vector.zCoord - Main.mc.thePlayer.posZ; double dist = Math.sqrt(diffX * diffX + diffZ * diffZ); - float pitch = (float) -Math.atan2(dist, diffY); - float yaw = (float) Math.atan2(diffZ, diffX); - pitch = (float) wrapAngleTo180((pitch * 180F / Math.PI + 90) * -1 - Minecraft.getMinecraft().thePlayer.rotationPitch); - yaw = (float) wrapAngleTo180((yaw * 180 / Math.PI) - 90 - Minecraft.getMinecraft().thePlayer.rotationYaw); + float pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / Math.PI); + float yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / Math.PI - 90.0D); + pitch = MathHelper.wrapAngleTo180_float(pitch - Main.mc.thePlayer.rotationPitch); + yaw = MathHelper.wrapAngleTo180_float(yaw - Main.mc.thePlayer.rotationYaw); for (int i = 0; i < Main.configFile.smoothLookVelocity; i++) { - Minecraft.getMinecraft().thePlayer.rotationYaw += yaw / Main.configFile.smoothLookVelocity; - Minecraft.getMinecraft().thePlayer.rotationPitch += pitch / Main.configFile.smoothLookVelocity; + Main.mc.thePlayer.rotationYaw += yaw / Main.configFile.smoothLookVelocity; + Main.mc.thePlayer.rotationPitch += pitch / Main.configFile.smoothLookVelocity; Thread.sleep(1); } + //setup(new Rotation(yaw, pitch), (long) Main.configFile.smoothLookVelocity); working = false; if (Main.endermanMacro) { shootEman(); @@ -111,8 +142,8 @@ public class RotationUtils { try { working = true; for (int i = 0; i < Main.configFile.smoothLookVelocity; i++) { - Minecraft.getMinecraft().thePlayer.rotationYaw += yaw / Main.configFile.smoothLookVelocity; - Minecraft.getMinecraft().thePlayer.rotationPitch += pitch / Main.configFile.smoothLookVelocity; + Main.mc.thePlayer.rotationYaw += yaw / Main.configFile.smoothLookVelocity; + Main.mc.thePlayer.rotationPitch += pitch / Main.configFile.smoothLookVelocity; Thread.sleep(1); } working = false; @@ -124,33 +155,33 @@ public class RotationUtils { public static void faceEntity(Entity en) { if (en instanceof EntityCreeper) { - facePos(new Vec3(en.posX, en.posY - 1.5, en.posZ)); - } else { facePos(new Vec3(en.posX, en.posY, en.posZ)); + } else { + facePos(new Vec3(en.posX, en.posY + Main.mc.thePlayer.getEyeHeight(), en.posZ)); } } public static void packetFaceEntity(Entity en) { if (en == null) return; Vec3 vector = new Vec3(en.posX, en.posY - 1.5, en.posZ); - if (Minecraft.getMinecraft().currentScreen != null) { - if (Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || Minecraft.getMinecraft().currentScreen instanceof GuiChat) { + if (Main.mc.currentScreen != null) { + if (Main.mc.currentScreen instanceof GuiIngameMenu || Main.mc.currentScreen instanceof GuiChat) { } else { return; } } - double diffX = vector.xCoord - (Minecraft.getMinecraft()).thePlayer.posX; - double diffY = vector.yCoord - (Minecraft.getMinecraft()).thePlayer.posY; - double diffZ = vector.zCoord - (Minecraft.getMinecraft()).thePlayer.posZ; + double diffX = vector.xCoord - (Main.mc).thePlayer.posX; + double diffY = vector.yCoord - (Main.mc).thePlayer.posY; + double diffZ = vector.zCoord - (Main.mc).thePlayer.posZ; double dist = Math.sqrt(diffX * diffX + diffZ * diffZ); float pitch = (float) -Math.atan2(dist, diffY); float yaw = (float) Math.atan2(diffZ, diffX); - pitch = (float) wrapAngleTo180((pitch * 180F / Math.PI + 90) * -1 - Minecraft.getMinecraft().thePlayer.rotationPitch); - yaw = (float) wrapAngleTo180((yaw * 180 / Math.PI) - 90 - Minecraft.getMinecraft().thePlayer.rotationYaw); + pitch = (float) wrapAngleTo180((pitch * 180F / Math.PI + 90) * -1 - Main.mc.thePlayer.rotationPitch); + yaw = (float) wrapAngleTo180((yaw * 180 / Math.PI) - 90 - Main.mc.thePlayer.rotationYaw); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, Minecraft.getMinecraft().thePlayer.onGround)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, Main.mc.thePlayer.onGround)); } diff --git a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java index 3dd677a..38312a7 100644 --- a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java +++ b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java @@ -8,6 +8,7 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.StringUtils; +import rosegoldaddons.Main; import java.util.ArrayList; import java.util.Collection; @@ -34,8 +35,8 @@ public class ScoreboardUtils { public static List<String> getSidebarLines() { List<String> lines = new ArrayList<>(); - if (Minecraft.getMinecraft().theWorld == null) return lines; - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + if (Main.mc.theWorld == null) return lines; + Scoreboard scoreboard = Main.mc.theWorld.getScoreboard(); if (scoreboard == null) return lines; ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); |