aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/utils
diff options
context:
space:
mode:
authorRoseGoldIsntGay <yoavkau@gmail.com>2022-07-27 21:47:43 +0300
committerRoseGoldIsntGay <yoavkau@gmail.com>2022-07-27 21:47:43 +0300
commit170ccfa42e36f04306820fbc3ef8a8ce3cf75010 (patch)
tree6728741f9a9befcb71ce1f27262073c984affe9a /src/main/java/rosegoldaddons/utils
parent854c131bf7965cef66d37e80640999242c9e0d65 (diff)
downloadRGA-master.tar.gz
RGA-master.tar.bz2
RGA-master.zip
last update for a whileHEADmaster
imma be real with y'all this is really old changes i never pushed to git so forgive me if the changelog is partial added an autoclicker that probably gets u banned added auto leave limbo added three weirdos auto solver added block size modifiers for dungeons i changed a log of stuff probably bug fixes have fun
Diffstat (limited to 'src/main/java/rosegoldaddons/utils')
-rw-r--r--src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java250
-rw-r--r--src/main/java/rosegoldaddons/utils/RenderUtils.java20
-rw-r--r--src/main/java/rosegoldaddons/utils/Rotation.java44
-rw-r--r--src/main/java/rosegoldaddons/utils/ScoreboardUtils.java29
-rw-r--r--src/main/java/rosegoldaddons/utils/ShadyRotation.java55
5 files changed, 334 insertions, 64 deletions
diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
index 2e574fb..2b14d14 100644
--- a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
+++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
@@ -1,27 +1,51 @@
package rosegoldaddons.utils;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.init.Items;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.Vec3;
+import net.minecraft.util.Vec3i;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
import rosegoldaddons.Main;
import rosegoldaddons.commands.Rosedrobe;
import rosegoldaddons.commands.Rosepet;
-import scala.Int;
-import tv.twitch.chat.Chat;
+import rosegoldaddons.features.SexAura;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.List;
public class OpenSkyblockGui {
private static boolean openTrades = false;
+ public static boolean doTrades = false;
+ private static int deb = 0;
+ public static int die = -1;
+ public static boolean sellAll = false;
+ public static boolean selling = false;
+ public static int enableChat = -1;
+ public static boolean doVisit = false;
+ private static boolean didVisit = false;
+ private static final KeyBinding[] binds = Main.mc.gameSettings.keyBindings;
+ private static int sellAttempts = 0;
+ public static boolean storeInChest = false;
+ public static boolean storing = false;
+ public static boolean openedChest = false;
+
+ public static String[] endermanDrops = {
+ "summoning eye", "ender pearl", "bone", "obsidian", "crystal fragment", "eye of ender", "end stone", "arrow", "combat exp, rune"
+ };
@SubscribeEvent
public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
- if(!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS) return;
+ if (!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS && !sellAll && !storeInChest) return;
if (event.gui instanceof GuiChest) {
Container container = ((GuiChest) event.gui).inventorySlots;
if (container instanceof ContainerChest) {
@@ -46,13 +70,13 @@ public class OpenSkyblockGui {
if (chestName.contains("Pets")) {
int currPage = 1;
int lastPage = 1;
- if(chestName.startsWith("(")) {
- currPage = Integer.parseInt(chestName.substring(chestName.indexOf("(")+1, chestName.indexOf("/")));
- lastPage = Integer.parseInt(chestName.substring(chestName.indexOf("/")+1, chestName.indexOf(")")));
+ if (chestName.startsWith("(")) {
+ currPage = Integer.parseInt(chestName.substring(chestName.indexOf("(") + 1, chestName.indexOf("/")));
+ lastPage = Integer.parseInt(chestName.substring(chestName.indexOf("/") + 1, chestName.indexOf(")")));
}
String petName = Rosepet.name;
int petSlot = Rosepet.petSlot;
- if(petSlot != 0) {
+ if (petSlot != 0) {
clickSlot(petSlot - 1, 0, 0);
Rosepet.petSlot = 0;
Rosepet.openPetS = false;
@@ -74,7 +98,7 @@ public class OpenSkyblockGui {
} else {
Rosepet.openPetS = false;
Main.mc.thePlayer.closeScreen();
- ChatUtils.sendMessage("No pet named "+petName+" found.");
+ ChatUtils.sendMessage("No pet named " + petName + " found.");
}
} else {
ChatUtils.sendMessage("Invalid Pet Name");
@@ -82,6 +106,163 @@ public class OpenSkyblockGui {
}
}
+ } else if (sellAll && deb == 0) {
+ selling = true;
+ if (chestName.contains("Bazaar")) {
+ List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
+ for (Slot slot : chestInventory) {
+ if (!slot.getHasStack()) continue;
+ if (slot.getStack().getDisplayName().contains("Inventory Now")) {
+ if (slot.getStack().serializeNBT().toString().contains("don't have items")) {
+ ChatUtils.sendMessage("Couldn't find any items to sell to bazaar");
+ sellAttempts = 0;
+ sellAll = false;
+ selling = false;
+ Main.mc.thePlayer.closeScreen();
+ } else {
+ clickSlot(slot.slotNumber, 0, 0);
+ }
+ }
+ }
+ } else if (chestName.contains("you sure?")) {
+ List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
+ for (Slot slot : chestInventory) {
+ if (!slot.getHasStack()) continue;
+ if (slot.getStack().getDisplayName().contains("whole inventory")) {
+ clickSlot(slot.slotNumber, 0, 0);
+ sellAttempts++;
+ deb = 5;
+ break;
+ } else if (slot.getStack().getDisplayName().contains("sold!")) {
+ ChatUtils.sendMessage("Sold!");
+ sellAttempts = 0;
+ sellAll = false;
+ selling = false;
+ Main.mc.thePlayer.closeScreen();
+ return;
+ }
+ }
+ }
+ } else if(storeInChest && deb == 0) {
+ storing = true;
+ if (chestName.contains("Chest")) {
+ List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
+ for (Slot slot : chestInventory) {
+ if (!slot.getHasStack()) continue;
+ if(slot.slotNumber < 53) continue;
+ String display = slot.getStack().getDisplayName().toLowerCase();
+ for(String drop : endermanDrops) {
+ if (display.contains(drop)) {
+ clickSlot(slot.slotNumber, 0, 1, 0);
+ deb = 5;
+ return;
+ }
+ }
+ }
+ ChatUtils.sendMessage("done storing");
+ storeInChest = false;
+ storing = false;
+ openedChest = false;
+ Main.mc.thePlayer.closeScreen();
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void debounce(TickEvent.ClientTickEvent event) {
+ if (event.phase == TickEvent.Phase.END) return;
+ if (deb > 0) deb--;
+ if(storeInChest && !openedChest && !ShadyRotation.running) {
+ storing = true;
+ Vec3 chest = closestChest();
+ if(chest == null) {
+ ChatUtils.sendMessage("No chest found in island, going back to macroing");
+ storeInChest = false;
+ storing = false;
+ } else {
+ ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(chest), Main.configFile.smoothLookVelocity, () -> {
+ rightClick();
+ openedChest = true;
+ });
+ }
+ }
+ if (sellAttempts > 9) {
+ Main.mc.thePlayer.closeScreen();
+ Main.mc.thePlayer.sendChatMessage("/bz");
+ sellAttempts = 0;
+ }
+ if (deb == 0 && didVisit && doVisit) {
+ doVisit = false;
+ didVisit = false;
+ Main.mc.thePlayer.sendChatMessage("/trade " + removeFormatting(SexAura.sender.split(" ")[1]));
+ doTrades = true;
+ die = 200;
+ }
+ if (doTrades) {
+ if (die > 0) {
+ die--;
+ }
+ }
+ if (die == 0) {
+ doTrades = false;
+ enableChat = 40;
+ die = -1;
+ }
+ if (enableChat > 0) enableChat--;
+ if (enableChat == 0) {
+ SexAura.blocked = false;
+ enableChat = -1;
+ }
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent event) {
+ if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return;
+ if (Main.configFile.stopKeyboard || SexAura.blocked) {
+ for (KeyBinding keyBinding : binds) {
+ KeyBinding.setKeyBindState(keyBinding.getKeyCode(), false);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if(!doVisit) return;
+ if (event.gui instanceof GuiChest) {
+ Container container = ((GuiChest) event.gui).inventorySlots;
+ if (container instanceof ContainerChest) {
+ if (doVisit && deb == 0) {
+ List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
+ for (Slot slot : chestInventory) {
+ if (!slot.getHasStack()) continue;
+ if (slot.getStack().getDisplayName().contains("Visit player")) {
+ if (!didVisit) {
+ clickSlot(slot.slotNumber, 0, 0);
+ didVisit = true;
+ deb = 100;
+ }
+ }
+ }
+ }
+ if (doTrades && deb == 0) {
+ List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
+ if (!chestInventory.get(30).getHasStack()) {
+ for (int i = chestInventory.size() - 1; i > 0; i--) {
+ Slot slot = chestInventory.get(i);
+ if (!slot.getHasStack()) continue;
+ if (slot.getStack().getDisplayName().contains("SkyBlock")) continue;
+ if (slot.slotNumber < 44) continue;
+ clickSlot(slot.slotNumber, 1, 0);
+ deb = 5;
+ }
+ }
+ if (chestInventory.get(39).getHasStack() && (chestInventory.get(39).getStack().getDisplayName().contains("Warning!") || chestInventory.get(39).getStack().getDisplayName().contains("Deal!"))) {
+ clickSlot(39, 0, 0);
+ doTrades = false;
+ enableChat = 40;
+ }
}
}
}
@@ -95,4 +276,55 @@ public class OpenSkyblockGui {
private void clickSlot(int slot, int type, int windowAdd) {
Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer);
}
+
+ private void clickSlot(int slot, int type, int mode, int windowAdd) {
+ Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, mode, Main.mc.thePlayer);
+ }
+
+ private String removeFormatting(String input) {
+ return input.replaceAll("ยง[0-9a-fk-or]", "");
+ }
+
+ private Vec3 closestChest() {
+ if (Main.mc.theWorld == null) return null;
+ if (Main.mc.thePlayer == null) return null;
+ int r = 6;
+ BlockPos playerPos = Main.mc.thePlayer.getPosition();
+ playerPos.add(0, 1, 0);
+ Vec3 playerVec = Main.mc.thePlayer.getPositionVector();
+ Vec3i vec3i = new Vec3i(r, r, r);
+ ArrayList<Vec3> chests = new ArrayList<>();
+ for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) {
+ IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos);
+ if (blockState.getBlock() == Blocks.chest) {
+ chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5));
+ }
+ }
+
+ double smallest = 9999;
+ Vec3 closest = null;
+ for (Vec3 chest : chests) {
+ double dist = chest.distanceTo(playerVec);
+ if (dist < smallest) {
+ smallest = dist;
+ closest = chest;
+ }
+ }
+ return closest;
+ }
+
+ public static void rightClick() {
+ try {
+ Method rightClickMouse;
+ try {
+ rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse");
+ } catch (NoSuchMethodException e) {
+ rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag");
+ }
+ rightClickMouse.setAccessible(true);
+ rightClickMouse.invoke(Main.mc);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java
index d6a7f8f..9d314a3 100644
--- a/src/main/java/rosegoldaddons/utils/RenderUtils.java
+++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java
@@ -3,6 +3,7 @@ package rosegoldaddons.utils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -111,7 +112,6 @@ public class RenderUtils {
drawSelectionBoundingBox(axisAlignedBB);
-
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDepthMask(true);
resetCaps();
@@ -653,6 +653,24 @@ public class RenderUtils {
glScissor((int) (x * factor), (int) ((scaledResolution.getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor));
}
+
+ public static void drawRectangle(int x, int y, int width, int height) {
+ glEnable(GL_BLEND);
+ glColor3f(0,0,0);
+ glRecti(x, y, width, height);
+ glFlush();
+ }
+
+ public static void drawTexture(ResourceLocation resourceLocation, int x, int y, int width, int height, int textureWidth, int textureHeight, int textureX, int textureY) {
+ Main.mc.getTextureManager().bindTexture(resourceLocation);
+ GlStateManager.color(255, 255, 255);
+ Gui.drawModalRectWithCustomSizedTexture(x, y, textureX, textureY, width, height, textureWidth, textureHeight);
+ }
+
+ public static void drawTexture(ResourceLocation resourceLocation, int x, int y, int width, int height) {
+ drawTexture(resourceLocation, x, y, width, height, width, height, 0, 0);
+ }
+
/**
* Modified from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0
* https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE
diff --git a/src/main/java/rosegoldaddons/utils/Rotation.java b/src/main/java/rosegoldaddons/utils/Rotation.java
deleted file mode 100644
index f18d5ef..0000000
--- a/src/main/java/rosegoldaddons/utils/Rotation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package rosegoldaddons.utils;
-
-
-public class Rotation {
- private float yaw;
- private float pitch;
-
- public Rotation(float yaw, float pitch) {
- this.yaw = yaw;
- this.pitch = pitch;
- }
-
- public float getYaw() {
- return this.yaw;
- }
-
- public void setYaw(float yaw) {
- this.yaw = yaw;
- }
-
- public float getPitch() {
- return this.pitch;
- }
-
- public void setPitch(float pitch) {
- this.pitch = pitch;
- }
-
- public void addYaw(float yaw) {
- this.yaw += yaw;
- }
-
- public void addPitch(float pitch) {
- this.pitch += pitch;
- }
-
- public float getValue() {
- return Math.abs(this.yaw) + Math.abs(this.pitch);
- }
-
- public String toString() {
- return "Rotation{yaw=" + this.yaw + ", pitch=" + this.pitch + '}';
- }
-}
diff --git a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java
index d3a8463..0f22e86 100644
--- a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java
+++ b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java
@@ -18,12 +18,15 @@ import java.util.List;
import java.util.stream.Collectors;
/*
-* Stolen from Danker's Skyblock Mod: https://github.com/bowser0000/SkyblockMod
+* Edited from Danker's Skyblock Mod: https://github.com/bowser0000/SkyblockMod
*/
public class ScoreboardUtils {
public static boolean inSkyblock = false;
public static boolean inDungeon = false;
+ public static boolean inPrivateIsland = false;
+ public static boolean inDragonNest = false;
+ public static boolean inLimbo = false;
public static String cleanSB(String scoreboard) {
char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray();
@@ -119,13 +122,25 @@ public class ScoreboardUtils {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
- if(ticks % 20 == 0) {
- if(Main.mc.thePlayer != null && Main.mc.theWorld != null) {
- ScoreObjective scoreboardObj = Main.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(1);
- if(scoreboardObj != null) {
- inSkyblock = removeFormatting(scoreboardObj.getDisplayName()).contains("SKYBLOCK");
+ if(ticks % 10 == 0) {
+ if (Main.configFile.forceDungeon) {
+ inSkyblock = true;
+ inDungeon = true;
+ } else {
+ if (Main.mc.thePlayer != null && Main.mc.theWorld != null) {
+ Scoreboard scoreboard = Main.mc.theWorld.getScoreboard();
+ ScoreObjective scoreboardObj = scoreboard.getObjectiveInDisplaySlot(1);
+ if (scoreboardObj != null) {
+ inSkyblock = removeFormatting(scoreboardObj.getDisplayName()).contains("SKYBLOCK");
+ inLimbo = false;
+ } else {
+ inSkyblock = false;
+ inLimbo = true;
+ }
+ inPrivateIsland = inSkyblock && scoreboardContains("Your Island");
+ inDragonNest = inSkyblock && scoreboardContains("Dragon's Nest");
+ inDungeon = inSkyblock && scoreboardContains("The Catacombs");
}
- inDungeon = inSkyblock && ScoreboardUtils.scoreboardContains("The Catacombs");
}
ticks = 0;
}
diff --git a/src/main/java/rosegoldaddons/utils/ShadyRotation.java b/src/main/java/rosegoldaddons/utils/ShadyRotation.java
index 111ea6e..3125aa2 100644
--- a/src/main/java/rosegoldaddons/utils/ShadyRotation.java
+++ b/src/main/java/rosegoldaddons/utils/ShadyRotation.java
@@ -2,10 +2,13 @@ package rosegoldaddons.utils;
import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
+import net.minecraft.util.MovementInput;
import net.minecraft.util.Vec3;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import rosegoldaddons.Main;
+import rosegoldaddons.events.PlayerMoveEvent;
public class ShadyRotation {
private static float pitchDifference;
@@ -13,16 +16,33 @@ public class ShadyRotation {
private static int ticks = -1;
private static int tickCounter = 0;
private static Runnable callback = null;
+ private static boolean async = false;
+
+ private static float serverPitch;
+ private static float serverYaw;
public static boolean running = false;
+ public static boolean runningAsync = false;
public static class Rotation {
public float pitch;
public float yaw;
+ public boolean async;
public Rotation(float pitch, float yaw) {
this.pitch = pitch;
this.yaw = yaw;
+ this.async = false;
+ }
+
+ public Rotation(float pitch, float yaw, boolean async) {
+ this.pitch = pitch;
+ this.yaw = yaw;
+ this.async = async;
+ }
+
+ public void setAsync(boolean async) {
+ this.async = async;
}
}
@@ -76,7 +96,7 @@ public class ShadyRotation {
return new Rotation(pitch, yaw);
}
- public static void smoothLook(Rotation rotation, int ticks, Runnable callback) {
+ public static void smoothLook(Rotation rotation, int ticks, Runnable callback, boolean async) {
if(ticks == 0) {
look(rotation);
callback.run();
@@ -85,6 +105,7 @@ public class ShadyRotation {
ShadyRotation.callback = callback;
+ ShadyRotation.async = rotation.async;
pitchDifference = wrapAngleTo180(rotation.pitch - Main.mc.thePlayer.rotationPitch);
yawDifference = wrapAngleTo180(rotation.yaw - Main.mc.thePlayer.rotationYaw);
@@ -92,6 +113,10 @@ public class ShadyRotation {
ShadyRotation.tickCounter = 0;
}
+ public static void smoothLook(Rotation rotation, int ticks, Runnable callback) {
+ smoothLook(rotation, ticks, callback, false);
+ }
+
public static void smartLook(Rotation rotation, int ticksPer180, Runnable callback) {
float rotationDifference = Math.max(
Math.abs(rotation.pitch - Main.mc.thePlayer.rotationPitch),
@@ -105,16 +130,40 @@ public class ShadyRotation {
Main.mc.thePlayer.rotationYaw = rotation.yaw;
}
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onUpdatePre(PlayerMoveEvent.Pre pre) {
+ //if(Main.oringo) return;
+ serverPitch = Main.mc.thePlayer.rotationPitch;
+ serverYaw = Main.mc.thePlayer.rotationYaw;
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void onUpdatePost(PlayerMoveEvent.Post post) {
+ //if(Main.oringo) return;
+ Main.mc.thePlayer.rotationPitch = serverPitch;
+ Main.mc.thePlayer.rotationYaw = serverYaw;
+ }
+
@SubscribeEvent
public void onTick(TickEvent event) {
if(Main.mc.thePlayer == null) return;
if(tickCounter < ticks) {
- running = true;
+ if(!async) {
+ running = true;
+ runningAsync = false;
+ } else {
+ runningAsync = true;
+ running = false;
+ }
Main.mc.thePlayer.rotationPitch += pitchDifference / ticks;
Main.mc.thePlayer.rotationYaw += yawDifference / ticks;
tickCounter++;
} else if(callback != null) {
- running = false;
+ if(!async) {
+ running = false;
+ } else {
+ runningAsync = false;
+ }
callback.run();
callback = null;
}