diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
21 files changed, 1261 insertions, 276 deletions
diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index 4744766..e4c9c14 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -10,7 +10,9 @@ import net.minecraft.item.ItemCloth; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -121,9 +123,11 @@ public class AutoArrowAlign { Entity finalSave = save; new Thread(() -> { try { - Thread.sleep(60); + Thread.sleep(500); if(finalSave != null) { interactWithEntity(finalSave); + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getHeldItem()); } } catch (Exception e) { e.printStackTrace(); @@ -324,6 +328,10 @@ public class AutoArrowAlign { playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); } + private static void interactWithEntity2(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + } private static boolean isInSection3() { int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); diff --git a/src/main/java/rosegoldaddons/features/AutoReady.java b/src/main/java/rosegoldaddons/features/AutoReady.java index 12089a1..f28910e 100644 --- a/src/main/java/rosegoldaddons/features/AutoReady.java +++ b/src/main/java/rosegoldaddons/features/AutoReady.java @@ -1,48 +1,26 @@ package rosegoldaddons.features; -import com.mojang.realmsclient.gui.ChatFormatting; - -import java.awt.Color; import java.util.List; -import java.util.Locale; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; -import net.minecraft.network.play.server.S45PacketTitle; -import net.minecraft.potion.Potion; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import rosegoldaddons.Config; import rosegoldaddons.Main; -import rosegoldaddons.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.OutlineUtils; -import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.client.multiplayer.PlayerControllerMP; -import scala.collection.parallel.ParIterableLike; public class AutoReady { boolean startDung = false; boolean checkingEntities = false; - String currentMenu = ""; static int windowId; - private double getDist2Entities(Entity entity1, Entity entity2) { - return Math.sqrt(Math.pow((entity1.getPosition().getX() - entity2.getPosition().getX()), 2) + Math.pow((entity1.getPosition().getY() - entity2.getPosition().getY()), 2) + Math.pow((entity1.getPosition().getZ() - entity2.getPosition().getZ()), 2)); - } - private static void interactWithEntity(Entity entity) { PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java new file mode 100644 index 0000000..839e238 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -0,0 +1,176 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.ScoreboardUtils; + +import java.util.List; + +public class AutoSlayer { + private static String lastMaddoxCommand = "/cb placeholder"; + private static boolean openMaddox = false; + private static boolean startSlayer = false; + private static boolean waitingForMaddox = false; + private static int slayerSlot = 0; + private static int slotLevel = 0; + + @SubscribeEvent + public void chat(ClientChatReceivedEvent event) { + if (!Main.configFile.autoSlayer) return; + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + if (message.contains(":")) return; + if (message.contains("[OPEN MENU]")) { + List<IChatComponent> siblings = event.message.getSiblings(); + for (IChatComponent sibling : siblings) { + if (sibling.getUnformattedText().contains("[OPEN MENU]")) { + lastMaddoxCommand = sibling.getChatStyle().getChatClickEvent().getValue(); + openMaddox = true; + } + } + } + } + + @SubscribeEvent + public void onInteract(InputEvent.KeyInputEvent event) { + if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox) return; + List<String> scoreboard = ScoreboardUtils.getSidebarLines(); + for (String line : scoreboard) { + String cleanedLine = ScoreboardUtils.cleanSB(line); + if (cleanedLine.contains("Boss slain!")) { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(maddox); + int save = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + Minecraft.getMinecraft().thePlayer.inventory.currentItem = maddox; + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + break; + } + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.configFile.autoSlayer) return; + if (!openMaddox) return; + Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + switch (Main.configFile.slayerTypeIndex) { + case 1: + slayerSlot = 10; //zombie + slotLevel = 13; //tier 3 + break; + case 2: + slayerSlot = 10; + slotLevel = 14; //tier 4 + break; + case 3: + slayerSlot = 10; + slotLevel = 15; //tier 5 + break; + case 4: + slayerSlot = 11; //spider + slotLevel = 13; //tier 3 + break; + case 5: + slayerSlot = 11; + slotLevel = 14; //tier 4 + break; + case 6: + slayerSlot = 12; //sven + slotLevel = 13; //tier 3 + break; + case 7: + slayerSlot = 12; + slotLevel = 14; //tier 4 + break; + case 8: + slayerSlot = 13; //eman + slotLevel = 12; //tier 2 + break; + case 9: + slayerSlot = 13; + slotLevel = 13; //tier 3 + break; + case 10: + slayerSlot = 13; + slotLevel = 14; //tier 4 + break; + } + openMaddox = false; + startSlayer = true; + } + + @SubscribeEvent + public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.configFile.autoSlayer) return; + if (!startSlayer) return; + if (slayerSlot == 0 || slotLevel == 0) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + ChatUtils.sendMessage(chestName); + if (chestName.contains("Slayer")) { + ChatUtils.sendMessage(slayerSlot +" "+slotLevel); + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + if (!chestInventory.get(13).getHasStack()) return; + if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { + + } else if (chestInventory.get(13).getStack().getDisplayName().contains("Complete")) { + ChatUtils.sendMessage("will now commence clicks"); + clickSlot(13, 2, 0); + clickSlot(slayerSlot, 2, 1); + clickSlot(slotLevel, 2, 2); + clickSlot(11, 2, 3); //confirm + ChatUtils.sendMessage("clicked"); + } else { + ChatUtils.sendMessage("will now commence clicks"); + clickSlot(slayerSlot, 2, 0); + clickSlot(slotLevel, 2, 1); + clickSlot(11, 2, 2); //confirm + ChatUtils.sendMessage("clicked"); + } + ChatUtils.sendMessage("resetting variables"); + slayerSlot = 0; + slotLevel = 0; + startSlayer = false; + waitingForMaddox = false; + } + } + } + } + + private static int findItemInHotbar(String name) { + InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + for (int i = 0; i < 9; i++) { + ItemStack curStack = inv.getStackInSlot(i); + if (curStack != null) { + if (curStack.getDisplayName().contains(name)) { + return i; + } + } + } + return -1; + } + + private void clickSlot(int slot, int type, int windowAdd) { + Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); + } +} diff --git a/src/main/java/rosegoldaddons/features/BlockBreakAura.java b/src/main/java/rosegoldaddons/features/BlockBreakAura.java deleted file mode 100644 index 528ccc1..0000000 --- a/src/main/java/rosegoldaddons/features/BlockBreakAura.java +++ /dev/null @@ -1,98 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.init.Blocks; -import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.util.*; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import rosegoldaddons.Main; -import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.RotationUtils; - -import java.awt.*; -import java.lang.reflect.Method; -import java.util.ArrayList; - -public class BlockBreakAura { - BlockPos gem = null; - private Thread thread; - private boolean breaking = false; - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if(!Main.gemNukeToggle) { - if(breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - return; - } - if(event.phase.toString().equals("START") && gem != null) { - RotationUtils.facePos(new Vec3(gem.getX()+0.5, gem.getY()-1, gem.getZ()+0.5)); - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if(objectMouseOver != null && objectMouseOver.typeOfHit.toString() == "BLOCK") { - BlockPos pos = objectMouseOver.getBlockPos(); - Block gem = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); - if(gem == Blocks.stained_glass || gem == Blocks.stained_glass_pane) { - if(!breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); - breaking = true; - } - } else { - if(breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - } - - } - } - } - - @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { - if(!Main.gemNukeToggle) return; - gem = closestGemstone(); - if (gem != null) { - RenderUtils.drawBlockBox(gem, Color.RED, true, event.partialTicks); - } - } - - private BlockPos closestGemstone() { - int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); - playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); - Vec3i vec3i = new Vec3i(r, r, r); - ArrayList<Vec3> chests = new ArrayList<Vec3>(); - if (playerPos != null) { - for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); - if (blockState.getBlock() == Blocks.stained_glass) { - chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - } - } - double smallest = 9999; - Vec3 closest = null; - for (int i = 0; i < chests.size(); i++) { - double dist = chests.get(i).distanceTo(playerVec); - if (dist < smallest) { - smallest = dist; - closest = chests.get(i); - } - } - if (closest != null && smallest < 4) { - return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); - } - return null; - } - -} diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 41d1f90..9df02e9 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; public class BloodTriggerBot { - private static String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor"}; + private static String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor", "Spirit Bear"}; private static ArrayList<Entity> bloodMobs = null; private Thread thread; diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java new file mode 100644 index 0000000..6dffeba --- /dev/null +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -0,0 +1,234 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class BrewingMacro { + private Thread thread; + private BlockPos stand; + private boolean sell = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.brewingMacro || !Main.configFile.openstand || Main.configFile.alchindex != 0) return; + if (event.phase == TickEvent.Phase.END) { + if (Minecraft.getMinecraft().currentScreen == null && stand != null && !sell) { + if (Minecraft.getMinecraft().playerController.onPlayerRightClick( + Minecraft.getMinecraft().thePlayer, + Minecraft.getMinecraft().theWorld, + Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), + stand, + EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw), + new Vec3(Math.random(), Math.random(), Math.random()) + )) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } + } + } + } + + @SubscribeEvent + public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.brewingMacro) return; + if (thread == null || !thread.isAlive()) { + thread = new Thread(() -> { + try { + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + int sleep = Main.configFile.alchsleep; + if (Main.configFile.alchindex == 0) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber < 54) { + clickSlot(slot.slotNumber, 1, 1); + Thread.sleep(sleep); + if (isInventoryFull()) { + sell = true; + Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu"); + } + } + } + } + if (sell) { + if (chestName.contains("SkyBlock")) { + Thread.sleep(100); + clickSlot(22, 0, 0); + } else if (chestName.contains("Trades")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 1, 0); + Thread.sleep(sleep); + } + } + Minecraft.getMinecraft().thePlayer.closeScreen(); + sell = false; + } + } + } else if (Main.configFile.alchindex == 1) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(42).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Water Bottle") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 1, 1); + Thread.sleep(sleep); + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 2) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Nether Wart") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 3) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if ((slot.getStack().getDisplayName().contains("Sugar") || slot.getStack().getDisplayName().contains("Spider Eye")) && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } else if (Main.configFile.alchindex == 4) { + if (chestName.contains("Brewing Stand")) { + List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (!chestInventory.get(13).getHasStack()) { + if (slot.getStack().getDisplayName().contains("Glowstone") && slot.slotNumber >= 54) { + clickSlot(slot.slotNumber, 0, 0); + Thread.sleep(sleep/2); + clickSlot(13, 1, 0); + Thread.sleep(sleep/2); + clickSlot(slot.slotNumber, 0, 0); + break; + } + } + } + if(Main.configFile.alchclose) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } + } + } + } catch (Exception exception) { + exception.printStackTrace(); + } + }, "brewing"); + thread.start(); + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.brewingMacro) return; + stand = closestStand(); + if (stand != null) { + RenderUtils.drawBlockBox(stand, Color.YELLOW, true, event.partialTicks); + } + } + + private boolean isInventoryFull() { + List<Slot> inventory = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots; + for (Slot slot : inventory) { + if (!slot.getHasStack() && slot.slotNumber > 8) { + return false; + } + } + return true; + } + + private BlockPos closestStand() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> stands = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + if (blockState.getBlock() == Blocks.brewing_stand) { + stands.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < stands.size(); i++) { + double dist = stands.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = stands.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private void clickSlot(int slot, int type, int mode) { + Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId, slot, type, mode, Minecraft.getMinecraft().thePlayer); + } +} diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java new file mode 100644 index 0000000..0a93a85 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/CanePlanter.java @@ -0,0 +1,78 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +import java.util.ArrayList; + +public class CanePlanter { + //when you're down bad + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.placeCane || event.phase == TickEvent.Phase.END) { + return; + } + int cane = findItemInHotbar("Cane"); + BlockPos dirt = furthestEmptyDirt(); + if (cane != -1 && dirt != null) { + ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(cane); + Minecraft.getMinecraft().thePlayer.inventory.currentItem = cane; + Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item, dirt, EnumFacing.UP, Minecraft.getMinecraft().thePlayer.getLookVec()); + } + } + + private BlockPos furthestEmptyDirt() { + int r = 5; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> dirts = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { + dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double biggest = -1; + Vec3 furthest = null; + for (int i = 0; i < dirts.size(); i++) { + double dist = dirts.get(i).distanceTo(playerVec); + if (dist > biggest) { + biggest = dist; + furthest = dirts.get(i); + } + } + if (furthest != null && biggest < 4) { + return new BlockPos(furthest.xCoord, furthest.yCoord, furthest.zCoord); + } + return null; + } + + private static int findItemInHotbar(String name) { + InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + for (int i = 0; i < 9; i++) { + ItemStack curStack = inv.getStackInSlot(i); + if (curStack != null) { + if (curStack.getDisplayName().contains(name)) { + return i; + } + } + } + return -1; + } +} diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java new file mode 100644 index 0000000..f4dc4e6 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/CropNuker.java @@ -0,0 +1,152 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.PlayerUtils; + +import java.util.ArrayList; + +public class CropNuker { + private static BlockPos crop; + private static ArrayList<BlockPos> broken = new ArrayList<>(); + private static int ticks = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END) return; + if (!Main.nukeCrops || Minecraft.getMinecraft().thePlayer == null) { + broken.clear(); + return; + } + crop = closestCrop(); + if (crop != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); + PlayerUtils.swingItem(); + broken.add(crop); + } + + } + + private BlockPos closestCrop() { + int r = 6; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + Vec3i vec3iCane = new Vec3i(r, 0, r); + ArrayList<Vec3> warts = new ArrayList<>(); + if (playerPos != null) { + switch (Main.configFile.farmNukeIndex) { + case 0: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.nether_wart || blockState.getBlock() == Blocks.potatoes || blockState.getBlock() == Blocks.wheat || blockState.getBlock() == Blocks.carrots || blockState.getBlock() == Blocks.pumpkin || blockState.getBlock() == Blocks.melon_block || blockState.getBlock() == Blocks.brown_mushroom || blockState.getBlock() == Blocks.red_mushroom || blockState.getBlock() == Blocks.cocoa) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 1: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3iCane), playerPos.subtract(vec3iCane))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.reeds || blockState.getBlock() == Blocks.cactus) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 2: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.nether_wart) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 3: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.wheat) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 4: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.carrots) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 5: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.potatoes) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 6: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.pumpkin) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 7: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.melon_block) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + case 8: + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.cocoa) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + break; + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 wart : warts) { + double dist = wart.distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = wart; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 3133cb8..750db14 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -30,8 +30,7 @@ public class CustomItemMacro { int slot = findItemInHotbar(i); if (slot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; - rightClick(); - Thread.sleep(1); + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(slot)); } } } @@ -55,23 +54,8 @@ public class CustomItemMacro { } } - public static void rightClick() { - try { - Method rightClickMouse = null; - try { - rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); - } catch (NoSuchMethodException e) { - rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); - } - rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); - } catch (Exception e) { - e.printStackTrace(); - } - } - public static void click() { - try { + /*try { Method clickMouse; try { clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); @@ -82,7 +66,8 @@ public class CustomItemMacro { clickMouse.invoke(Minecraft.getMinecraft()); } catch (Exception e) { e.printStackTrace(); - } + }*/ + Minecraft.getMinecraft().thePlayer.swingItem(); } private static int findItemInHotbar(String name) { diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index fb31a0b..4768eb0 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -4,46 +4,38 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.event.RenderWorldEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; -import rosegoldaddons.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.OutlineUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; import java.awt.*; -import java.util.HashSet; import java.util.Random; public class EndermanMacro { + private static Entity enderman; @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { - if (Main.endermanMacro) { - Entity entity1 = getClosestEnderman(); - if(entity1 == null) return; - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - RotationUtils.faceEntity(entity1); - Random r = new Random(); - if(r.nextInt(1000) == 1) { - RotationUtils.antiAfk(); - } - } else if (Main.configFile.EndermanESP) { - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman) { - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - } - } + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; + enderman = getClosestEnderman(); + if(enderman != null && Main.endermanMacro) { + RotationUtils.faceEntity(enderman); } } + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.configFile.EndermanESP) return; + if (enderman == null) return; + RenderUtils.drawEntityBox(enderman, Color.RED, true, event.partialTicks); + } + private static Entity getClosestEnderman() { Entity eman = null; - Double closest = Double.valueOf(9999); + double closest = 9999; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index 9db81f1..66715fe 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -1,37 +1,30 @@ package rosegoldaddons.features; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.item.Item; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.item.ItemSkull; import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; -import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.InputEvent; import rosegoldaddons.Main; -import rosegoldaddons.events.ClickEvent; -import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import java.awt.*; import java.util.ArrayList; public class EntityReach { - private Thread thread; private static Entity toInteract; + private static final ArrayList<Entity> solved = new ArrayList<>(); @SubscribeEvent public void onInteract(PlayerInteractEvent event) { @@ -44,40 +37,86 @@ public class EntityReach { interactWithEntity(toInteract); toInteract = null; } + } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + if (toInteract != null) { + if (toInteract instanceof EntityArmorStand) { + interactWithEntity2(toInteract); + solved.add(toInteract); + } + toInteract = null; + } } } @SubscribeEvent + public void clear(WorldEvent.Load event) { + solved.clear(); + } + + @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { if (!Main.configFile.entityReach) return; + if (toInteract != null) { + Entity stand = getClosestArmorStand(toInteract); + String entityName = "Null"; + if(stand != null) { + entityName = stand.getCustomNameTag(); + } + if(entityName.equals("") && stand != null) { + entityName = stand.getName(); + } + RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + RenderUtils.renderWaypointText(entityName, toInteract.posX, toInteract.posY + toInteract.height, toInteract.posZ, event.partialTicks); + } + boolean found = false; ArrayList<Entity> entities = getAllEntitiesInRange(); for (Entity entity : entities) { if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { toInteract = entity; - return; + found = true; + } + if(entity instanceof EntityArmorStand) { + ItemStack itemStack = ((EntityArmorStand) entity).getCurrentArmor(3); + if (itemStack != null && itemStack.getItem() instanceof ItemSkull) { + if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjk2OTIzYWQyNDczMTAwMDdmNmFlNWQzMjZkODQ3YWQ1Mzg2NGNmMTZjMzU2NWExODFkYzhlNmIyMGJlMjM4NyJ9fX0=")) { + if(solved.contains(entity)) { + RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + } else { + RenderUtils.drawEntityBox(entity, Color.MAGENTA, true, event.partialTicks); + } + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODZhZGRiZDVkZWRhZDQwOTk5NDczYmU0YTdmNDhmNjIzNmE3OWEwZGNlOTcxYjVkYmQ3MzcyMDE0YWUzOTRkIn19fQ==")) { + RenderUtils.drawEntityBox(entity, Color.GREEN, true, event.partialTicks); + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGRhNDE0ZDI5Y2M5ZWJiZmMxY2JkY2QyMTFlZWU0NzI2ZDA2NzZiZTI2MmU5Y2I4ZWVmZmFmZDFmYzM4MGIxNCJ9fX0=")) { + RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + } + else if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjMxMmE1YTEyZWNiMjRkNjg1MmRiMzg4ZTZhMzQ3MjFjYzY3ZjUyMmNjZGU3ZTgyNGI5Zjc1ZTk1MDM2YWM5MyJ9fX0=")) { + RenderUtils.drawEntityBox(entity, Color.WHITE, true, event.partialTicks); + } + } } } - if (!Main.configFile.sticky) { + if (!Main.configFile.sticky && !found) { toInteract = null; } } - @SubscribeEvent - public void renderWorld2(RenderWorldLastEvent event) { - if (!Main.configFile.entityReach) return; - if (toInteract != null) { - RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + private static Entity getClosestArmorStand(Entity entity) { + Entity closest = null; + double smallest = 9999; + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityArmorStand) { + double dist = entity.getDistanceToEntity(entity1); + if(dist < smallest) { + smallest = dist; + closest = entity1; + } + } } + return closest; } - /*@SubscribeEvent - public void onInteract(ClickEvent.Right event) { - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if (objectMouseOver != null) { - ChatUtils.sendMessage(""+objectMouseOver.entityHit); - } - }*/ - private static boolean isLookingAtAABB(AxisAlignedBB aabb, RenderWorldLastEvent event) { Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); @@ -94,10 +133,8 @@ public class EntityReach { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - Vec3 playerPos = Minecraft.getMinecraft().thePlayer.getPositionVector(); - playerPos.add(new Vec3(0, 1, 0)); for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (playerPos.distanceTo(entity1.getPositionVector()) < 30 && !(entity1 instanceof EntityPlayerSP)) { + if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } } @@ -111,8 +148,7 @@ public class EntityReach { private static void interactWithEntity2(Entity entity) { PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - MovingObjectPosition mop = new MovingObjectPosition(entity); - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, mop); + playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); } diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index ecf314b..c284e92 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -4,8 +4,6 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -14,18 +12,16 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; -import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; -import scala.actors.threadpool.helpers.ThreadHelpers; -import java.awt.*; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Base64; import java.util.Random; public class ForagingIslandMacro { private Thread thread; - private String[] cum = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; + private final String[] responses = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { @@ -55,6 +51,7 @@ public class ForagingIslandMacro { ChatUtils.sendMessage("§cNo Fishing Rod in hotbar"); } if(sapling == -1 || bonemeal == -1 || treecap == -1 || rod == -1) { + playAnnoyingAlert(); Main.forageOnIsland = false; ChatUtils.sendMessage("§cForaging Macro Deactivated"); return; @@ -86,7 +83,7 @@ public class ForagingIslandMacro { if(Main.configFile.randomizeForaging) { toAdd = rand.nextInt(20); } - ChatUtils.sendMessage("extra delay: "+toAdd+"%"); + //ChatUtils.sendMessage("extra delay: "+toAdd+"%"); Thread.sleep(Math.round(150*(1+(toAdd/100)))); rightClick(); rightClick(); @@ -120,13 +117,14 @@ public class ForagingIslandMacro { Main.forageOnIsland = false; ChatUtils.sendMessage("§cNo dirt in range of player"); ChatUtils.sendMessage("§cForaging Macro Deactivated"); + playAnnoyingAlert(); if(Main.configFile.forageantisus) { - int rand = new Random().nextInt(cum.length); - int rand2 = new Random().nextInt(5000); + int rand = new Random().nextInt(responses.length); + int rand2 = new Random().nextInt(2000); new Thread(() -> { try { Thread.sleep(rand2); - Minecraft.getMinecraft().thePlayer.sendChatMessage(cum[rand]); + Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac "+responses[rand]); Thread.sleep(rand2*2); Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); } catch (Exception exception) { @@ -242,4 +240,30 @@ public class ForagingIslandMacro { e.printStackTrace(); } } + + private static void playAlert() { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } + + private static void playAnnoyingAlert() { + new Thread(() -> { + try { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Thread.sleep(100); + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } catch (Exception exception) { + exception.printStackTrace(); + } + }).start(); + } } diff --git a/src/main/java/rosegoldaddons/features/ForagingNuker.java b/src/main/java/rosegoldaddons/features/ForagingNuker.java new file mode 100644 index 0000000..dcd3100 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/ForagingNuker.java @@ -0,0 +1,69 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; + +import java.util.ArrayList; + +public class ForagingNuker { + private static BlockPos wood; + private ArrayList<BlockPos> broken = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.nukeWood || Minecraft.getMinecraft().thePlayer == null || !Minecraft.getMinecraft().thePlayer.onGround) { + broken.clear(); + return; + } + wood = closestWood(); + if (wood != null) { + if(broken.size() > 10) { + broken.clear(); + } + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); + PlayerUtils.swingItem(); + broken.add(wood); + } + + } + + private BlockPos closestWood() { + int r = 6; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> warts = new ArrayList<>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.log || blockState.getBlock() == Blocks.log2) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 wart : warts) { + double dist = wart.distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = wart; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java new file mode 100644 index 0000000..a694818 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -0,0 +1,151 @@ +package rosegoldaddons.features; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; +import rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class GemstoneAura { + private static int currentDamage; + private static byte blockHitDelay = 0; + private static BlockPos blockPos; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.gemNukeToggle) { + currentDamage = 0; + return; + } + if (event.phase == TickEvent.Phase.END) { + if(PlayerUtils.pickaxeAbilityReady) { + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + } + if(currentDamage > 100) { + currentDamage = 0; + } + if(blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() != Blocks.stained_glass && blockState.getBlock() != Blocks.stained_glass_pane) { + currentDamage = 0; + } + } + if(currentDamage == 0) { + blockPos = closestGemstone(); + } + if (blockPos != null) { + if (blockHitDelay > 0) { + blockHitDelay--; + return; + } + MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + fake.hitVec = new Vec3(blockPos); + EnumFacing enumFacing = fake.sideHit; + if (currentDamage == 0 && enumFacing != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); + } + + PlayerUtils.swingItem(); + + currentDamage += 1; + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.gemNukeToggle) return; + if (blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + EnumDyeColor dyeColor = null; + Color color = Color.BLACK; + if (blockState.getBlock() == Blocks.stained_glass) { + dyeColor = blockState.getValue(BlockStainedGlass.COLOR); + } + if (blockState.getBlock() == Blocks.stained_glass_pane) { + dyeColor = blockState.getValue(BlockStainedGlassPane.COLOR); + } + if (dyeColor == EnumDyeColor.RED) { + color = new Color(188, 3, 29); + } else if (dyeColor == EnumDyeColor.PURPLE) { + color = new Color(137, 0, 201); + } else if (dyeColor == EnumDyeColor.LIME) { + color = new Color(157, 249, 32); + } else if (dyeColor == EnumDyeColor.LIGHT_BLUE) { + color = new Color(60, 121, 224); + } else if (dyeColor == EnumDyeColor.ORANGE) { + color = new Color(237, 139, 35); + } else if (dyeColor == EnumDyeColor.YELLOW) { + color = new Color(249, 215, 36); + } else if (dyeColor == EnumDyeColor.MAGENTA) { + color = new Color(214, 15, 150); + } + RenderUtils.drawBlockBox(blockPos, color, true, event.partialTicks); + } + } + + private BlockPos closestGemstone() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> chests = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + if (blockState.getBlock() == Blocks.stained_glass) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + if(!Main.configFile.prioblocks) { + if (blockState.getBlock() == Blocks.stained_glass_pane) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + if(Main.configFile.prioblocks) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(!Main.configFile.prioblocks) { + if (blockState.getBlock() == Blocks.stained_glass_pane) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < chests.size(); i++) { + double dist = chests.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = chests.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } +} diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 8fb2dfc..79a7907 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -7,6 +7,7 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; @@ -15,23 +16,26 @@ import java.awt.*; import java.util.Random; public class GhostMacro { + private static Entity creeper; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.GhostMacro) return; + creeper = getClosestCreeper(); + if (creeper == null) return; + RotationUtils.faceEntity(creeper); + } + @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { - if (Main.GhostMacro) { - Entity entity1 = getClosestCreeper(); - if (entity1 == null) return; - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - RotationUtils.faceEntity(entity1); - Random r = new Random(); - if(r.nextInt(800) == 1) { - RotationUtils.antiAfk(); - } - } + if (!Main.GhostMacro) return; + if (creeper == null) return; + RenderUtils.drawEntityBox(creeper, Color.RED, true, event.partialTicks); } private static Entity getClosestCreeper() { Entity eman = null; - Double closest = Double.valueOf(9999); + double closest = 9999.0; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityCreeper && !(((EntityCreeper) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); @@ -39,7 +43,8 @@ public class GhostMacro { if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; eman = entity1; - } if(Main.configFile.macroRadius == 0) { + } + if(Main.configFile.macroRadius == 0) { closest = dist; eman = entity1; } diff --git a/src/main/java/rosegoldaddons/features/HardstoneMacro.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 95c1808..ff4ee3c 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneMacro.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -1,14 +1,17 @@ package rosegoldaddons.features; import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; +import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; import net.minecraftforge.client.event.GuiScreenEvent; @@ -18,57 +21,45 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; import java.awt.*; import java.util.ArrayList; -public class HardstoneMacro { +public class HardstoneAura { private ArrayList<Vec3> solved = new ArrayList<>(); - private BlockPos closestStone = null; - private Vec3 closestChest = null; - private Thread thread; - private boolean breaking = false; + private ArrayList<BlockPos> broken = new ArrayList<>(); + private static int currentDamage; + private static BlockPos closestStone; + private static Vec3 closestChest; private boolean stopHardstone = false; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.autoHardStone) { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } + currentDamage = 0; + broken.clear(); return; } - if (event.phase.toString().equals("START") && closestStone != null && !stopHardstone) { - RotationUtils.facePos(new Vec3(closestStone.getX() + 0.5, closestStone.getY() - 1, closestStone.getZ() + 0.5)); - //Minecraft.getMinecraft().playerController.onPlayerDamageBlock(closestStone, EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw)); - MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; - if (objectMouseOver != null && objectMouseOver.typeOfHit.toString() == "BLOCK") { - BlockPos pos = objectMouseOver.getBlockPos(); - Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); - if (block == Blocks.stone || block == Blocks.coal_ore || block == Blocks.diamond_ore || block == Blocks.emerald_ore - || block == Blocks.gold_ore || block == Blocks.iron_ore || block == Blocks.lapis_ore || block == Blocks.redstone_ore) { - int pickaxe = PowderMacro.findItemInHotbar("Jungle"); - if (pickaxe != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = pickaxe; - if (!breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); - breaking = true; - } - } else { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; - } - } - + if (!stopHardstone) { + if (broken.size() > 10) { + broken.clear(); } - } - if (stopHardstone) { - if (breaking) { - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - breaking = false; + closestStone = closestStone(); + if (closestStone != null) { + MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + fake.hitVec = new Vec3(closestStone); + EnumFacing enumFacing = fake.sideHit; + if (currentDamage == 0 && enumFacing != null) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); + } + MovingObjectPosition real = Minecraft.getMinecraft().objectMouseOver; + if (real != null && real.entityHit == null) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } + broken.add(closestStone); } } } @@ -96,25 +87,21 @@ public class HardstoneMacro { @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - new Thread(() -> { - try { - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - if (chestName.contains("Treasure")) { - breaking = false; - solved.add(closestChest); - stopHardstone = false; - Thread.sleep(20); - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } + if(Main.configFile.guilag) { + Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); + } + if(!Main.autoHardStone) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + if (chestName.contains("Treasure")) { + solved.add(closestChest); + stopHardstone = false; + Minecraft.getMinecraft().thePlayer.closeScreen(); } - } catch (Exception e) { - e.printStackTrace(); } - }).start(); + } } @SubscribeEvent @@ -142,14 +129,14 @@ public class HardstoneMacro { BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); - Vec3i vec3i = new Vec3i(r, 1, r); + Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); Vec3i vec3i2 = new Vec3i(r, 0, r); ArrayList<Vec3> stones = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); - if (blockState.getBlock() == Blocks.stone) { + if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -188,7 +175,7 @@ public class HardstoneMacro { double smallest = 9999; Vec3 closest = null; for (Vec3 chest : chests) { - if(!solved.contains(chest)) { + if (!solved.contains(chest)) { double dist = chest.distanceTo(playerVec); if (dist < smallest) { smallest = dist; diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java new file mode 100644 index 0000000..5342f58 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -0,0 +1,125 @@ +package rosegoldaddons.features; + +import net.minecraft.block.*; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.PlayerUtils; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.RotationUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class MithrilNuker { + private static int currentDamage; + private static byte blockHitDelay = 0; + private static BlockPos blockPos; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.mithrilNuker) { + currentDamage = 0; + return; + } + if (event.phase == TickEvent.Phase.END) { + if(PlayerUtils.pickaxeAbilityReady) { + Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + } + if(currentDamage > 100) { + currentDamage = 0; + } + if(blockPos != null && Minecraft.getMinecraft().theWorld != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (blockState.getBlock() == Blocks.bedrock || blockState.getBlock() == Blocks.air) { + currentDamage = 0; + } + } + if(currentDamage == 0) { + blockPos = closestMithril(); + } + if (blockPos != null) { + if (blockHitDelay > 0) { + blockHitDelay--; + return; + } + if (currentDamage == 0) { + Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); + if(Main.configFile.mithrilLook) { + RotationUtils.facePos(new Vec3(blockPos.getX() + 0.5, blockPos.getY() - 1, blockPos.getZ() + 0.5)); + } + } + PlayerUtils.swingItem(); + + currentDamage += 1; //finally used after all + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.mithrilNuker) return; + if (blockPos != null) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(blockState.getBlock() == Blocks.stone) { + RenderUtils.drawBlockBox(blockPos, Color.WHITE, true, event.partialTicks); + } else { + RenderUtils.drawBlockBox(blockPos, Color.BLUE, true, event.partialTicks); + } + } + } + + private BlockPos closestMithril() { + int r = 6; + if (Minecraft.getMinecraft().thePlayer == null) return null; + BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + playerPos = playerPos.add(0, 1, 0); + Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> chests = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if (isMithril(blockState)) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (int i = 0; i < chests.size(); i++) { + double dist = chests.get(i).distanceTo(playerVec); + if (dist < smallest) { + smallest = dist; + closest = chests.get(i); + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + private boolean isMithril(IBlockState blockState) { + if(blockState.getBlock() == Blocks.prismarine) { + return true; + } else if(blockState.getBlock() == Blocks.wool) { + return true; + } else if(blockState.getBlock() == Blocks.stained_hardened_clay) { + return true; + } else if(!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if(blockState.getBlock() == Blocks.gold_block) { + return true; + } + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/PingWorldChange.java b/src/main/java/rosegoldaddons/features/PingWorldChange.java new file mode 100644 index 0000000..9f9663b --- /dev/null +++ b/src/main/java/rosegoldaddons/features/PingWorldChange.java @@ -0,0 +1,48 @@ +package rosegoldaddons.features; + +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.DiscordWebhook; + +import java.io.IOException; + +public class PingWorldChange { + private int countdown = 0; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Unload event) { + if(Main.configFile.pingworldchange && countdown == 0) { + String url = Main.configFile.hookurl; + String id = Main.configFile.discordid; + if(url.contains("https://discord.com/api/webhooks/")) { + if(!id.equals("")) { + DiscordWebhook webhook = new DiscordWebhook(url); + webhook.setContent("<@" + id + "> Detected World Change."); + try { + countdown = 100; + webhook.execute(); + } catch (IOException e) { + ChatUtils.sendMessage("Ping sender seemed to have crashed: "+e.getMessage()); + e.printStackTrace(); + } + } else { + ChatUtils.sendMessage("Invalid Discord ID"); + } + } else { + ChatUtils.sendMessage("Invalid Webhook URL"); + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END) { + if(countdown > 0) { + countdown--; + } + } + } +} diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index 3666e0d..e350648 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -32,9 +32,6 @@ public class PowderMacro { Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate()); if (closestChest != null) { double dist = closestChest.distanceTo(particlePos); - /*Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(dist + "")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(closestChest.toString())); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(particlePos.toString()));*/ if (dist < 1) { particlePos = particlePos.add(new Vec3(0, -1, 0)); int drill = findItemInHotbar("X655"); diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java new file mode 100644 index 0000000..72df86d --- /dev/null +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -0,0 +1,33 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class SexAura { + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void chat(ClientChatReceivedEvent event) { + if(event.type == 0) { + String message = event.message.getUnformattedText(); + String formatted = event.message.getFormattedText(); + if (message.startsWith("From") && message.contains("!SXAURA!")) { + event.setCanceled(true); + String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + playAlert(); + } + if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { + event.setCanceled(true); + String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + playAlert(); + } + } + } + + private static void playAlert() { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + } +} diff --git a/src/main/java/rosegoldaddons/features/TpMe.java b/src/main/java/rosegoldaddons/features/TpMe.java new file mode 100644 index 0000000..4134ca9 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/TpMe.java @@ -0,0 +1,5 @@ +package rosegoldaddons.features; + +public class TpMe { + +} |
