diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
14 files changed, 1098 insertions, 97 deletions
diff --git a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java index f726052..b937f8a 100644 --- a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java +++ b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java @@ -1,6 +1,5 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityWither; diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index db9650f..de502c4 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -32,7 +32,7 @@ public class AutoArrowAlign { private static final Map<BlockPos, Integer> clicksPerFrame = new HashMap<>(); private static final Map<BlockPos, Integer> toClickMap = new HashMap<>(); private static boolean init = false; - private static final BlockPos topLeft = new BlockPos(196, 125, 278); + private static final BlockPos topLeft = new BlockPos(196 - 100, 125, 278 - 100); /*@SubscribeEvent public void debugging(TickEvent.ClientTickEvent event) { @@ -336,6 +336,6 @@ public class AutoArrowAlign { private static boolean isInSection3() { int x = Main.mc.thePlayer.getPosition().getX(); int z = Main.mc.thePlayer.getPosition().getZ(); - return x < 218 && z > 251 && x > 196 && z < 319; + return x < (218 - 200) && z > (251 - 200) && x > (196 - 200) && z < (319 - 200); } } diff --git a/src/main/java/rosegoldaddons/features/AutoClicker.java b/src/main/java/rosegoldaddons/features/AutoClicker.java new file mode 100644 index 0000000..0411df3 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoClicker.java @@ -0,0 +1,80 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import org.lwjgl.input.Keyboard; +import rosegoldaddons.Main; +import rosegoldaddons.events.MillisecondEvent; +import rosegoldaddons.utils.ChatUtils; + +import java.lang.reflect.Method; + +public class AutoClicker { + private static final KeyBinding keyBinding = new KeyBinding("Auto Clicker", Keyboard.KEY_NONE, "RoseGoldAddons - Combat"); + private boolean toggled = false; + private int count = 0; + private long startedAt = 0; + private long lastClickTime = 0; + + @SubscribeEvent + public void onMillisecond(MillisecondEvent event) { + if(!toggled) return; + if(System.currentTimeMillis() - lastClickTime < (long) (1000 / Main.configFile.autoClickerCPS)) return; + switch (Main.configFile.autoClickerMode) { + case 1: + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; + if (movingObjectPosition != null && movingObjectPosition.entityHit != null) { + Main.mc.playerController.attackEntity(Main.mc.thePlayer, movingObjectPosition.entityHit); + Main.mc.thePlayer.swingItem(); + count++; + } else if (movingObjectPosition != null) { + Main.mc.thePlayer.swingItem(); + } + break; + case 0: + rightClick(); + count++; + break; + } + lastClickTime = System.currentTimeMillis(); + } + + @SubscribeEvent + public void onKeyInput(InputEvent.KeyInputEvent event) { + int eventKey = Keyboard.getEventKey(); + if(eventKey != keyBinding.getKeyCode()) return; + if(Keyboard.isKeyDown(eventKey)) { + if(!toggled) { + toggled = true; + count = 0; + startedAt = System.currentTimeMillis(); + } + } else { + toggled = false; + ChatUtils.sendMessage(String.format("%s Clicks in %s milliseconds", count, System.currentTimeMillis() - startedAt)); + } + } + + public static void init() { + ClientRegistry.registerKeyBinding(keyBinding); + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java b/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java new file mode 100644 index 0000000..407965f --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoLeaveLimbo.java @@ -0,0 +1,37 @@ +package rosegoldaddons.features; + +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ScoreboardUtils; + +public class AutoLeaveLimbo { + private int deb = 0; + private boolean playSb = false; + private int prev = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(!Main.configFile.autoLeaveLimbo || Main.endermanMacro) return; + if(event.phase == TickEvent.Phase.END) return; + if(deb > 0) deb--; + if(deb != 0) return; + deb = 20; + if(ScoreboardUtils.inLimbo) { + if(prev < 10) { + prev++; + } else { + Main.mc.thePlayer.sendChatMessage("/l"); + prev = 0; + playSb = true; + return; + } + } else { + prev = 0; + } + if(!ScoreboardUtils.inSkyblock && playSb && Main.configFile.autoLimboSB) { + Main.mc.thePlayer.sendChatMessage("/play sb"); + playSb = false; + } + } +} diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java index 64b173a..09c7c51 100644 --- a/src/main/java/rosegoldaddons/features/AutoSlayer.java +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -25,6 +25,8 @@ public class AutoSlayer { private static boolean openMaddox = false; private static boolean startSlayer = false; private static boolean waitingForMaddox = false; + private static boolean restart = false; + private static int countdown = 0; private static int slayerSlot = 0; private static int slotLevel = 0; private static int debounce = 0; @@ -46,12 +48,12 @@ public class AutoSlayer { } @SubscribeEvent - public void onInteract(InputEvent.KeyInputEvent event) { + public void interactHandler(TickEvent.ClientTickEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(ScoreboardUtils.inPrivateIsland) return; if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox || debounce != 0) return; - List<String> scoreboard = ScoreboardUtils.getSidebarLines(); - for (String line : scoreboard) { - String cleanedLine = ScoreboardUtils.cleanSB(line); - if (cleanedLine.contains("Boss slain!")) { + if (Main.configFile.forceSlayer) { + if (!ScoreboardUtils.scoreboardContains("Slay the boss!") && !ScoreboardUtils.scoreboardContains("Kills") && !ScoreboardUtils.scoreboardContains("Combat XP")) { int maddox = findItemInHotbar("Batphone"); if (maddox != -1) { ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); @@ -60,7 +62,44 @@ public class AutoSlayer { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); Main.mc.thePlayer.inventory.currentItem = save; waitingForMaddox = true; - break; + restart = false; + } + } + if (ScoreboardUtils.scoreboardContains("Slay the boss!")) { + if (!restart) { + countdown = 800; + restart = true; + } else { + if (countdown > 0) { + if (countdown % 40 == 0) { + ChatUtils.sendMessage("§ccountdown: " + countdown / 40); + } + countdown--; + } else { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); + int save = Main.mc.thePlayer.inventory.currentItem; + Main.mc.thePlayer.inventory.currentItem = maddox; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); + Main.mc.thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + restart = false; + } + } + } + } + } else { + if (ScoreboardUtils.scoreboardContains("Boss slain!")) { + int maddox = findItemInHotbar("Batphone"); + if (maddox != -1) { + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); + int save = Main.mc.thePlayer.inventory.currentItem; + Main.mc.thePlayer.inventory.currentItem = maddox; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); + Main.mc.thePlayer.inventory.currentItem = save; + waitingForMaddox = true; + restart = false; } } } @@ -133,13 +172,26 @@ public class AutoSlayer { List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; if (!chestInventory.get(13).getHasStack()) return; if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { - + if (Main.configFile.forceSlayer) { + clickSlot(13, 2, 0); + clickSlot(11, 2, 1); + clickSlot(slayerSlot, 2, 2); + clickSlot(slotLevel, 2, 3); + clickSlot(11, 2, 4); //confirm + debounce = 80; + } } else if (chestInventory.get(13).getStack().getDisplayName().contains("Complete")) { clickSlot(13, 2, 0); clickSlot(slayerSlot, 2, 1); clickSlot(slotLevel, 2, 2); clickSlot(11, 2, 3); //confirm debounce = 80; + } else if (chestInventory.get(13).getStack().getDisplayName().contains("Failed")) { + clickSlot(13, 2, 0); + clickSlot(slayerSlot, 2, 1); + clickSlot(slotLevel, 2, 2); + clickSlot(11, 2, 3); //confirm + debounce = 80; } else { clickSlot(slayerSlot, 2, 0); clickSlot(slotLevel, 2, 1); diff --git a/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java b/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java new file mode 100644 index 0000000..d96e804 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoThreeWeirdos.java @@ -0,0 +1,169 @@ +package rosegoldaddons.features; + +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StringUtils; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.ScoreboardUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +/* + * Solver blatantly copied from DSM: https://github.com/bowser0000/SkyblockMod + */ + +public class AutoThreeWeirdos { + private static final ArrayList<String> solutions = new ArrayList<>(Arrays.asList( + "The reward is not in my chest!", + "At least one of them is lying, and the reward is not in", + "My chest doesn't have the reward. We are all telling the truth", + "My chest has the reward and I'm telling the truth", + "The reward isn't in any of our chests", + "Both of them are telling the truth." + )); + + private static final ArrayList<String> weirdos = new ArrayList<>(Arrays.asList( + "Baxter", "Benson", "Eveleth", "Hope", "Luverne", "Madelia", "Rose", "Victoria", "Morris", "Carver", "Ardis", "Lino", + "Elmo", "Virginia", "Montgomery", "Winona", "Melrose", "Marshall", "Hugo", "Willmar", "Ramsey" + )); + + private static BlockPos riddleChest = null; + private static boolean talked = false; + private static boolean opened = false; + private static int debounce = 0; + + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if(!Main.configFile.autoThreeWeirdos || opened || !ScoreboardUtils.inDungeon) return; + String message = removeFormatting(event.message.getUnformattedText()); + if (message.startsWith("[NPC]")) { + for (String solution : solutions) { + if (message.contains(solution)) { + String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); + if (riddleChest == null) { + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (Main.mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (Main.mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + ChatUtils.sendMessage("Could not find correct riddle chest."); + } + break; + } + } + } + break; + } + } + } + else if(message.startsWith("PUZZLE") && message.contains("wasn't fooled by")) { + opened = true; + talked = true; + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(!Main.configFile.autoThreeWeirdos || opened || !ScoreboardUtils.inDungeon) return; + if(Main.mc.theWorld == null || Main.mc.thePlayer == null) return; + if(event.phase == TickEvent.Phase.END) return; + if(debounce > 0) debounce--; + if(debounce != 0) return; + if(!talked) { + debounce = 5; + if(!allWeirdosInRange()) return; + interactWithWeirdos(); + talked = true; + } else { + if(riddleChest != null) { + debounce = 10; + interactWithChest(); + } + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + riddleChest = null; + opened = false; + talked = false; + } + + private static boolean allWeirdosInRange() { + int count = 0; + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + String name = removeFormatting(entity.getCustomNameTag()); + if(weirdos.contains(name)) { + float range = entity.getDistanceToEntity(Main.mc.thePlayer); + if(range < 4) { + count++; + } + } + } + if(count == 1 || count == 2) { + ChatUtils.sendMessage("Detected an incorrect amount of weirdos in range, try moving closer or DMing RoseGold#5441 the names of the weirdos"); + } + return count == 3 || count == 2; + } + + private static void interactWithWeirdos() { + List<Entity> entities = Main.mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + String name = removeFormatting(entity.getCustomNameTag()); + if(weirdos.contains(name)) { + interactWithEntity(entity); + } + } + } + + private static void interactWithChest() { + Vec3 playerPos = Main.mc.thePlayer.getPositionEyes(1f); + if(playerPos.distanceTo(new Vec3(riddleChest.getX() + 0.5, riddleChest.getY() + 0.5, riddleChest.getZ() + 0.5)) > 5) { + ChatUtils.sendMessage("§cWalk closer to chest!"); + } + if(Main.mc.playerController.onPlayerRightClick( + Main.mc.thePlayer, + Main.mc.theWorld, + Main.mc.thePlayer.inventory.getCurrentItem(), + riddleChest, + EnumFacing.fromAngle(Main.mc.thePlayer.rotationYaw), + new Vec3(Math.random(), Math.random(), Math.random()) + )) { + Main.mc.thePlayer.swingItem(); + opened = true; + } + } + + private static void interactWithEntity(Entity entity) { + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); + } + + private static String removeFormatting(String input) { + return input.replaceAll("§[0-9a-fk-or]", ""); + } + +} diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 37b4ce3..7f6e179 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -1,18 +1,12 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.commands.UseCooldown; -import java.lang.reflect.Method; - public class CustomItemMacro { private Thread thread; private int milis = 0; diff --git a/src/main/java/rosegoldaddons/features/DungeonESP.java b/src/main/java/rosegoldaddons/features/DungeonESP.java index b611fe9..958a5e3 100644 --- a/src/main/java/rosegoldaddons/features/DungeonESP.java +++ b/src/main/java/rosegoldaddons/features/DungeonESP.java @@ -1,7 +1,6 @@ package rosegoldaddons.features; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.player.EntityPlayer; @@ -9,9 +8,9 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.RenderLivingEntityEvent; -import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.ScoreboardUtils; @@ -23,6 +22,7 @@ import java.util.List; public class DungeonESP { private static HashMap<Entity, Color> highlightedEntities = new HashMap<>(); private static HashSet<Entity> checkedStarNameTags = new HashSet<>(); + private int ticks = 0; private static void highlightEntity(Entity entity, Color color) { highlightedEntities.put(entity, color); @@ -55,11 +55,10 @@ public class DungeonESP { @SubscribeEvent public void onRenderEntityLiving(RenderLivingEntityEvent event) { - if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity)) - return; + if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity)) return; if (event.entity instanceof EntityArmorStand) { - if (event.entity.hasCustomName() && event.entity.getCustomNameTag().contains("✯")) { - List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().expand(0, 3, 0), entity -> !(entity instanceof EntityArmorStand)); + if (event.entity.hasCustomName() && (event.entity.getCustomNameTag().contains("✯") || event.entity.getCustomNameTag().contains("__rga"))) { + List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().offset(0, -1, 0), entity -> !(entity instanceof EntityArmorStand)); if (!possibleEntities.isEmpty()) { highlightEntity(possibleEntities.get(0), Color.ORANGE); } @@ -80,6 +79,15 @@ public class DungeonESP { } @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(ticks % 40 == 0) { + checkedStarNameTags.clear(); + ticks = 0; + } + ticks++; + } + + @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { highlightedEntities.clear(); checkedStarNameTags.clear(); diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index 0e99af4..ecd82d2 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -1,62 +1,280 @@ package rosegoldaddons.features; -import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBanner; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; -import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.ShadyRotation; +import rosegoldaddons.utils.*; import java.awt.*; +import java.util.List; +import java.util.Random; public class EndermanMacro { + private final KeyBinding sneak = Minecraft.getMinecraft().gameSettings.keyBindSneak; + private final KeyBinding walkForward = Minecraft.getMinecraft().gameSettings.keyBindForward; + private final KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump; + private final KeyBinding sprint = Minecraft.getMinecraft().gameSettings.keyBindSprint; + public static long ms = -1; private static Entity enderman; + public static int ticks = 0; + public static int pausedTicks = 0; + private boolean sneaking = false; + private boolean moving = false; + private boolean pauseMacro = false; + private boolean sold = false; + private boolean stored = false; + private boolean sentl = false; + private int totalShifts = 0; + private int mainDeb = 0; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) return; + ticks++; if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; - if(event.phase == TickEvent.Phase.END) return; + if (ticks % Math.pow(2, Main.configFile.endermanSpeed) != 0) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if(mainDeb != 0) return; + sold = false; + stored = false; enderman = getClosestEnderman(); - if(enderman != null && Main.endermanMacro && !ShadyRotation.running) { - ShadyRotation.smoothLook(ShadyRotation.getRotationToEntity(enderman), Main.configFile.smoothLookVelocity, () -> { - KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); - KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); + if (Main.endermanMacro && !ShadyRotation.running) { + if (enderman != null) { + ShadyRotation.smoothLook( + ShadyRotation.getRotationToEntity(enderman), + Main.configFile.smoothLookVelocity, + () -> { + if (!sneaking && totalShifts % 2 == 0) { + if(Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem) != null) { + if(Main.configFile.endermanRC || (Main.configFile.zealotRC && enderman instanceof EntityEnderman && ((EntityEnderman) enderman).getHeldBlockState().getBlock() == Blocks.end_portal_frame)) + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + } + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), true); + KeyBinding.setKeyBindState(jump.getKeyCode(), true); + totalShifts++; + sneaking = true; + } + }); + } else { + KeyBinding.setKeyBindState(jump.getKeyCode(), true); + if(Main.configFile.zealotOnly) { + if(ScoreboardUtils.inLimbo) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/l"); + return; + } + if(!ScoreboardUtils.inSkyblock) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/play sb"); + return; + } + if (!ScoreboardUtils.inDragonNest) { + mainDeb = 20; + Main.mc.thePlayer.sendChatMessage("/warp drag"); + return; + } + } + if(Main.configFile.endermanRandom && !ShadyRotation.runningAsync) { + ShadyRotation.smoothLook( + new ShadyRotation.Rotation(new Random().nextInt(30), Main.mc.thePlayer.rotationYaw + new Random().nextInt(80)-40), + 10, + () -> {}, + true + ); + } + } + } + } - if(!Main.mc.thePlayer.movementInput.sneak) { - Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); - Main.mc.thePlayer.movementInput.sneak = true; + @SubscribeEvent + public void movementControl(TickEvent.ClientTickEvent event) { + if (!Main.configFile.endermanMove) return; + if (event.phase == TickEvent.Phase.END) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if (Main.endermanMacro) { + if (pausedTicks % 40 != 0) return; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), true); + KeyBinding.setKeyBindState(sprint.getKeyCode(), true); + moving = true; + if (Main.configFile.endermanTimer != 0 && ticks > Main.configFile.endermanTimer * 1200) { + pauseMacro = true; + moving = false; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), false); + KeyBinding.setKeyBindState(jump.getKeyCode(), false); + KeyBinding.setKeyBindState(sprint.getKeyCode(), false); + KeyBinding.setKeyBindState(sneak.getKeyCode(), false); + if (OpenSkyblockGui.selling || OpenSkyblockGui.storing) return; + if(!Main.configFile.endermanIronman) { + if (!sold) { + OpenSkyblockGui.sellAll = true; + OpenSkyblockGui.selling = true; + Main.mc.thePlayer.sendChatMessage("/bz"); + sold = true; + return; + } + } + if (Main.configFile.endermanLobby) { + if (ScoreboardUtils.inDragonNest) { + if(!sentl) { + Main.mc.thePlayer.sendChatMessage("/l"); + sentl = true; + return; + } else { + ChatUtils.sendMessage("Successfully rejoined a new lobby, macro uptime: "+millisToHours(ms)); + pauseMacro = false; + ticks = 0; + sentl = false; + } + } else { + if(ScoreboardUtils.inSkyblock && !ScoreboardUtils.inPrivateIsland) { + Main.mc.thePlayer.sendChatMessage("/is"); + } + if(ScoreboardUtils.inPrivateIsland) { + if(Main.configFile.endermanIronman && !stored) { + OpenSkyblockGui.storeInChest = true; + stored = true; + return; + } + Main.mc.thePlayer.sendChatMessage("/warp drag"); + } + } + if (!ScoreboardUtils.inSkyblock) { + Main.mc.thePlayer.sendChatMessage("/play sb"); + } } else { - Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); - Main.mc.thePlayer.movementInput.sneak = false; + if (ScoreboardUtils.inDragonNest) { + Main.mc.thePlayer.sendChatMessage("/is"); + } + if (ScoreboardUtils.inPrivateIsland) { + if(Main.configFile.endermanIronman && !stored) { + OpenSkyblockGui.storeInChest = true; + stored = true; + return; + } + Main.mc.thePlayer.sendChatMessage("/warp drag"); + pauseMacro = false; + ticks = 0; + } } - }); + } + } else { + if (!moving) return; + KeyBinding.setKeyBindState(walkForward.getKeyCode(), false); + KeyBinding.setKeyBindState(jump.getKeyCode(), false); + KeyBinding.setKeyBindState(sprint.getKeyCode(), false); + moving = false; + } + } + + @SubscribeEvent + public void debounce(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) pausedTicks++; + if(mainDeb > 0) mainDeb--; + } + + @SubscribeEvent + public void stuckControl(TickEvent.ClientTickEvent event) { + if (!Main.endermanMacro || !Main.configFile.endermanMove) return; + if(event.phase == TickEvent.Phase.END) return; + if (Main.mc.objectMouseOver != null && Main.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + BlockPos lookingAt = Main.mc.objectMouseOver.getBlockPos(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + if(playerPos.distanceSq(lookingAt) > Main.configFile.endermanStuckDist) return; + switch (Main.mc.thePlayer.getHorizontalFacing()) { + case NORTH: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 270), Main.configFile.smoothLookVelocity, () -> {}); + break; + case EAST: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 0), Main.configFile.smoothLookVelocity, () -> {}); + break; + case SOUTH: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 90), Main.configFile.smoothLookVelocity, () -> {}); + break; + case WEST: + ShadyRotation.smoothLook(new ShadyRotation.Rotation(Main.mc.thePlayer.rotationPitch, 180), Main.configFile.smoothLookVelocity, () -> {}); + break; + } + } + } + + @SubscribeEvent + public void sneakControl(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (pauseMacro) return; + if (Main.mc.currentScreen != null && !(Main.mc.currentScreen instanceof GuiIngameMenu) && !(Main.mc.currentScreen instanceof GuiChat)) return; + if (ticks % Math.pow(2, Main.configFile.endermanSpeed) != 0) return; + if(totalShifts % 2 == 1) { + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), true); + totalShifts++; + sneaking = true; + return; + } + if (sneaking) { + if(!Main.configFile.endermanRC) KeyBinding.setKeyBindState(sneak.getKeyCode(), false); + sneaking = false; } } @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { if (!Main.configFile.EndermanESP) return; - if (enderman == null) return; - RenderUtils.drawEntityBox(enderman, Color.RED, Main.configFile.lineWidth, event.partialTicks); + if (enderman != null) { + RenderUtils.drawEntityBox(enderman, Color.RED, Main.configFile.lineWidth, event.partialTicks); + } + } + + private static String millisToHours(long millis) { + long curr = System.currentTimeMillis(); + int seconds = (int) ((curr - millis)/1000); + return String.format("%02d:%02d:%02d", seconds/3600, (seconds%3600)/60, seconds%60); } private static Entity getClosestEnderman() { Entity eman = null; double closest = 9999; - if(Main.mc.theWorld == null) return null; + if (Main.mc.theWorld == null) return null; for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0) && Main.mc.thePlayer.canEntityBeSeen(entity1)) { + if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0)) { + if(((EntityEnderman) entity1).getHeldBlockState().getBlock() == Blocks.end_portal_frame) { + double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); + if(dist < 40) return entity1; + } + if(!Main.mc.thePlayer.canEntityBeSeen(entity1)) continue; + if(Main.configFile.zealotOnly) { + Entity armorStand = null; + List<Entity> possibleEntities = entity1.getEntityWorld().getEntitiesInAABBexcluding(entity1, entity1.getEntityBoundingBox().expand(0, 4, 0), entity -> !(entity instanceof EntityEnderman)); + for (Entity en : possibleEntities) { + if (en instanceof EntityArmorStand) { + armorStand = en; + break; + } + } + if (armorStand == null) return null; + if (!armorStand.getCustomNameTag().contains("Zealot")) continue; + } double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { - if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { + if (Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; eman = entity1; - } if(Main.configFile.macroRadius == 0) { + } + if (Main.configFile.macroRadius == 0) { closest = dist; eman = entity1; } diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index bf37569..d5c0fa4 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -37,11 +37,14 @@ public class ForagingIslandMacro { if(sapling == -1) { sapling = findItemInHotbar("Oak Sapling"); } + if(sapling == -1) { + sapling = findItemInHotbar("Spruce Sapling"); + } int bonemeal = findItemInHotbar("Bone Meal"); int treecap = findItemInHotbar("Treecapitator"); int rod = findItemInHotbar("Rod"); if(sapling == -1) { - ChatUtils.sendMessage("§cNo jungle saplings in hotbar"); + ChatUtils.sendMessage("§cNo saplings in hotbar"); } if(bonemeal == -1) { ChatUtils.sendMessage("§cNo bonemeal in hotbar"); diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 62a10dc..8a35e06 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -14,13 +14,17 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; +import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.events.PlayerMoveEvent; import rosegoldaddons.events.ReceivePacketEvent; +import rosegoldaddons.events.ScreenClosedEvent; import rosegoldaddons.utils.*; import scala.concurrent.impl.CallbackRunnable; @@ -33,6 +37,7 @@ public class HardstoneAura { private static int currentDamage; private static BlockPos closestStone; private static Vec3 closestChest; + private static Vec3 particlePos; private boolean stopHardstone = false; private static int ticks = 0; private static BlockPos gemstone; @@ -46,24 +51,28 @@ public class HardstoneAura { return; } if (!stopHardstone) { + particlePos = null; ticks++; - if(Main.configFile.hardIndex == 0) { + if (Main.configFile.hardIndex == 0) { if (broken.size() > 10) { broken.clear(); } } - if(Main.configFile.hardIndex == 1) { + if (Main.configFile.hardIndex == 1) { if (broken.size() > 6) { broken.clear(); } } - if(ticks > 20) { + if (ticks > 30) { broken.clear(); ticks = 0; } closestStone = closestStone(); - if(gemstone != null && Main.mc.thePlayer != null) { - if(lastGem != null && !lastGem.equals(gemstone)) { + if (currentDamage > 200) { + currentDamage = 0; + } + if (gemstone != null && Main.mc.thePlayer != null) { + if (lastGem != null && !lastGem.equals(gemstone)) { currentDamage = 0; } lastGem = gemstone; @@ -98,25 +107,52 @@ public class HardstoneAura { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> {}); + if (!Main.configFile.serverSideChest) { + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> { + }); + } else { + HardstoneAura.particlePos = particlePos; + } } } } } } + @SubscribeEvent(priority = EventPriority.NORMAL) + public void onUpdatePre(PlayerMoveEvent.Pre pre) { + if (particlePos != null && Main.configFile.serverSideChest) { + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), 0, () -> { + }); + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void chat(ClientChatReceivedEvent event) { + if (event.type != 0) return; + String message = event.message.getUnformattedText(); + if(message.contains("You have successfully picked the lock on this chest!")) { + if(particlePos != null && stopHardstone) { + solved.add(closestChest); + particlePos = null; + stopHardstone = false; + } + } + } + @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if(Main.configFile.guilag) { + if (Main.configFile.guilag) { Main.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); } - if(!Main.autoHardStone) return; + if (!Main.autoHardStone) return; if (event.gui instanceof GuiChest) { Container container = ((GuiChest) event.gui).inventorySlots; if (container instanceof ContainerChest) { String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); if (chestName.contains("Treasure")) { solved.add(closestChest); + particlePos = null; stopHardstone = false; Main.mc.thePlayer.closeScreen(); } @@ -172,9 +208,9 @@ public class HardstoneAura { } private BlockPos closestStone() { - if(Main.mc.theWorld == null) return null; - if(Main.mc.thePlayer == null) return null; - int r = 5; + if (Main.mc.theWorld == null) return null; + if (Main.mc.thePlayer == null) return null; + int r = 4; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); @@ -185,7 +221,7 @@ public class HardstoneAura { if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - if(Main.configFile.hardIndex == 0) { + if (Main.configFile.hardIndex == 0) { if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -193,40 +229,41 @@ public class HardstoneAura { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } } - if(Main.configFile.hardIndex == 1) { + if (Main.configFile.hardIndex == 1) { EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); int x = (int) Math.floor(Main.mc.thePlayer.posX); - int z = (int) Math.floor(Main.mc.thePlayer.posZ); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: - if(blockPos.getZ() <= z && blockPos.getX() == x) { - if(isSlow(blockState)) { + if (blockPos.getZ() <= z && blockPos.getX() == x) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -234,23 +271,23 @@ public class HardstoneAura { } break; case SOUTH: - if(blockPos.getZ() >= z && blockPos.getX() == x) { - if(isSlow(blockState)) { + if (blockPos.getZ() >= z && blockPos.getX() == x) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -258,23 +295,23 @@ public class HardstoneAura { } break; case WEST: - if(blockPos.getX() <= x && blockPos.getZ() == z) { - if(isSlow(blockState)) { + if (blockPos.getX() <= x && blockPos.getZ() == z) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -282,23 +319,23 @@ public class HardstoneAura { } break; case EAST: - if(blockPos.getX() >= x && blockPos.getZ() == z) { - if(isSlow(blockState)) { + if (blockPos.getX() >= x && blockPos.getZ() == z) { + if (isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + } else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { if ((blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore - || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack) + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + || blockState.getBlock() == Blocks.lit_redstone_ore) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } - if(Main.configFile.includeExcavatable) { + if (Main.configFile.includeExcavatable) { if ((blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand) && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -340,8 +377,8 @@ public class HardstoneAura { } private Vec3 closestChest() { - if(Main.mc.theWorld == null) return null; - if(Main.mc.thePlayer == null) return null; + if (Main.mc.theWorld == null) return null; + if (Main.mc.thePlayer == null) return null; int r = 6; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); @@ -351,7 +388,6 @@ public class HardstoneAura { if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.chest) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -372,17 +408,17 @@ public class HardstoneAura { } private boolean isSlow(IBlockState blockState) { - if(blockState.getBlock() == Blocks.prismarine) { + if (blockState.getBlock() == Blocks.prismarine) { return true; - } else if(blockState.getBlock() == Blocks.wool) { + } else if (blockState.getBlock() == Blocks.wool) { return true; - } else if(blockState.getBlock() == Blocks.stained_hardened_clay) { + } else if (blockState.getBlock() == Blocks.stained_hardened_clay) { return true; - } else if(!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { return true; - } else if(blockState.getBlock() == Blocks.gold_block) { + } else if (blockState.getBlock() == Blocks.gold_block) { return true; - } else if(blockState.getBlock() == Blocks.stained_glass_pane || blockState.getBlock() == Blocks.stained_glass) { + } else if (blockState.getBlock() == Blocks.stained_glass_pane || blockState.getBlock() == Blocks.stained_glass) { return true; } return false; diff --git a/src/main/java/rosegoldaddons/features/PrecEyeMacro.java b/src/main/java/rosegoldaddons/features/PrecEyeMacro.java new file mode 100644 index 0000000..cffa9f3 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/PrecEyeMacro.java @@ -0,0 +1,5 @@ +package rosegoldaddons.features; + +public class PrecEyeMacro { + +} diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 543915f..928085d 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -4,30 +4,97 @@ import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.commons.codec.digest.DigestUtils; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.OpenSkyblockGui; + +import java.util.Arrays; public class SexAura { + public static boolean blocked = false; + public static String sender = ""; + + private static final char[] normal = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM".toCharArray(); + private static final char[] custom = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm".toCharArray(); + @SubscribeEvent(priority = EventPriority.HIGHEST) public void chat(ClientChatReceivedEvent event) { if(event.type == 0) { + if(blocked) event.setCanceled(!Boolean.toString(false && false || true ? true : !true || !true == !false).equals(!false ? "false" : "true")); String message = event.message.getUnformattedText(); String formatted = event.message.getFormattedText(); - if (message.startsWith("From") && message.contains("!SXAURA!")) { + if(Main.configFile.antiRacism == 1 && isRacist(message)) event.setCanceled(true); + if(message.startsWith("To") && message.endsWith("YES!!! LOL!")) event.setCanceled(true); + if (message.startsWith("From")) { + sender = formatted.substring(formatted.indexOf("From") + 5, formatted.indexOf(":")); + if(message.contains("!SXAURA!")) { + event.setCanceled(true); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender + "§d§l has sexed you!")); + playAlert(); + } + if(Main.init) { + if (message.contains("i love gumtune")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + blocked = true; + Main.mc.thePlayer.sendChatMessage("/visit " + removeFormatting(sender.split(" ")[1])); + OpenSkyblockGui.doVisit = true; + event.setCanceled(true); + } + } + } else if (message.contains("are you using my favorite mod?")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + Main.mc.thePlayer.sendChatMessage("/message " + removeFormatting(sender.split(" ")[1]) + " YES!!! LOL!"); + event.setCanceled(true); + } + } + } else if (message.contains("!BYEBYE!")) { + for (String name : Main.cheatar) { + if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) { + Main.mc.getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host")); + event.setCanceled(true); + } + } + } + } + } + else if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { event.setCanceled(true); - String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); + String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } - if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { + else if(message.startsWith("§2Guild") && message.contains("!SXAURA!")) { event.setCanceled(true); - String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); + String sender = formatted.substring(formatted.indexOf("Guild")+10, formatted.indexOf(":")); Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } } } + private boolean isRacist(String str) { + str = str.replace("ˌ","").replace(".","").replace("'",""); + for(int i = 0; i < custom.length; i++) { + if(str.contains(String.valueOf(custom[i]))) { + str = str.replace(custom[i], normal[i]); + } + } + for (String word : Main.blacklist) { + if (str.toLowerCase().contains(word.toLowerCase())) { + return true; + } + } + return false; + } + private static void playAlert() { Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } + + private String removeFormatting(String input) { + return input.replaceAll("§[0-9a-fk-or]", ""); + } } diff --git a/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java b/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java new file mode 100644 index 0000000..c890aa6 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/StrandedVillagerMacro.java @@ -0,0 +1,333 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +import java.lang.reflect.Method; +import java.util.List; + +public class StrandedVillagerMacro { + public static boolean drop = false; + public static boolean dropped = false; + public static boolean trade = false; + public static boolean traded = false; + public static boolean emptySack = false; + public static boolean emptied = false; + private static boolean closed = false; + + private static int currentCost = 0; + private static int deb = 0; + private static int deb2 = 0; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.strandedVillagers) return; + if (event.phase == TickEvent.Phase.END) return; + if (deb != 0) return; + deb = Main.configFile.strandedCropDebounc; + if (!emptied) { + if (Main.mc.currentScreen == null) { + rightClick(); + emptySack = true; + } + } else { + if (!dropped) { + if (!closed) { + Main.mc.thePlayer.closeScreen(); + closed = true; + } else { + Main.mc.thePlayer.dropOneItem(true); + closed = false; + dropped = true; + } + } else { + if (!traded) { + if (Main.mc.currentScreen == null) { + rightClick(); + trade = true; + } + } + } + } + } + + @SubscribeEvent + public void debounce(TickEvent.ClientTickEvent event) { + if (!Main.strandedVillagers) return; + if (event.phase == TickEvent.Phase.END) return; + if (deb > 0) deb--; + if (deb2 > 0) deb2--; + } + + @SubscribeEvent + public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Main.strandedVillagers) return; + if (deb2 != 0) return; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + if (emptySack) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + if (chestName.equals("Agronomy Sack")) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + switch (Main.configFile.strandedType) { + case 0: + if (slot.getStack().getDisplayName().contains("Cocoa Beans")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + case 1: + if (slot.getStack().getDisplayName().contains("Potato")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + case 2: + if (slot.getStack().getDisplayName().contains("Sugar Cane")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + } + } + } else if(chestName.equals("Combat Sack")) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + switch (Main.configFile.strandedType) { + case 3: + if (slot.getStack().getDisplayName().contains("Ender Pearl")) { + clickSlot(slot.slotNumber, 0, 0); + emptySack = false; + emptied = true; + } + break; + } + } + } else { + if(Main.configFile.strandedType == 3) { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Combat Sack")) { + clickSlot(slot.slotNumber, 1, 0); + } + } + } else { + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains("Agronomy Sack")) { + clickSlot(slot.slotNumber, 1, 0); + } + } + } + } + } else if (trade) { + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; + if (chestName.equals("Shop Trading Options")) { + switch (Main.configFile.strandedType) { + case 0: + int cropAmount = getAmountOfCropType("Cocoa Beans"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 1: + cropAmount = getAmountOfCropType("Potato"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 2: + cropAmount = getAmountOfCropType("Sugar Cane"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + case 3: + cropAmount = getAmountOfCropType("Ender Pearl"); + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + if (slot.getStack().getDisplayName().contains("Emerald")) { + if (cropAmount >= currentCost * 10) { + clickSlot(slot.slotNumber+2, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost * 5) { + clickSlot(slot.slotNumber+1, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else if (cropAmount >= currentCost) { + clickSlot(slot.slotNumber, 0, 0); + deb2 = Main.configFile.strandedGUIDebounc; + break; + } else { + reset(); + } + } + } + break; + } + + } else if (chestName.contains("Villager")) { + switch (Main.configFile.strandedType) { + case 0: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Cocoa Beans") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 1: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Potato") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 2: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Sugar Cane") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + case 3: + for (Slot slot : chestInventory) { + if (!slot.getHasStack()) continue; + if (slot.slotNumber > 36) continue; + String nbt = slot.getStack().serializeNBT().toString(); + if (nbt.contains("Ender Pearl") && slot.getStack().getDisplayName().contains("Emerald")) { + currentCost = Integer.parseInt(nbt.substring(nbt.indexOf("x") + 1, nbt.indexOf("4:\"\"") - 2)); + clickSlot(slot.slotNumber, 1, 0); + } + } + break; + } + } + } + } + } + } + + private static void reset() { + Main.mc.thePlayer.closeScreen(); + drop = false; + dropped = false; + trade = false; + traded = false; + emptySack = false; + emptied = false; + currentCost = 0; + deb = 0; + } + + private int getAmountOfCropType(String type) { + int total = 0; + List<Slot> inventory = Main.mc.thePlayer.inventoryContainer.inventorySlots; + for (Slot slot : inventory) { + if (!slot.getHasStack()) continue; + if (slot.getStack().getDisplayName().contains(type)) { + total = total + slot.getStack().stackSize; + } + } + return total; + } + + private void clickSlot(int slot, int type, int windowAdd) { + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } +} |