aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons
diff options
context:
space:
mode:
authorRoseGoldIsntGay <yoavkau@gmail.com>2021-11-07 18:34:22 +0200
committerRoseGoldIsntGay <yoavkau@gmail.com>2021-11-07 18:34:22 +0200
commit6f69d1e1aff688bf2f5ca34754640eed5102b045 (patch)
treee931c56ad48dedb4cec6ffceb78ef0b320c1c192 /src/main/java/rosegoldaddons
downloadRGA-6f69d1e1aff688bf2f5ca34754640eed5102b045.tar.gz
RGA-6f69d1e1aff688bf2f5ca34754640eed5102b045.tar.bz2
RGA-6f69d1e1aff688bf2f5ca34754640eed5102b045.zip
committed
or something
Diffstat (limited to 'src/main/java/rosegoldaddons')
-rw-r--r--src/main/java/rosegoldaddons/Config.java52
-rw-r--r--src/main/java/rosegoldaddons/FMLLoadingPlugin.java45
-rw-r--r--src/main/java/rosegoldaddons/Main.java159
-rw-r--r--src/main/java/rosegoldaddons/OpenSettings.java57
-rw-r--r--src/main/java/rosegoldaddons/commands/Backpack.java87
-rw-r--r--src/main/java/rosegoldaddons/commands/LobbySwap.java57
-rw-r--r--src/main/java/rosegoldaddons/commands/Rosedrobe.java90
-rw-r--r--src/main/java/rosegoldaddons/commands/UseCooldown.java90
-rw-r--r--src/main/java/rosegoldaddons/commands/WartSetup.java82
-rw-r--r--src/main/java/rosegoldaddons/events/ReceivePacketEvent.java16
-rw-r--r--src/main/java/rosegoldaddons/events/RenderLivingEntityEvent.java26
-rw-r--r--src/main/java/rosegoldaddons/features/AutoReady.java122
-rw-r--r--src/main/java/rosegoldaddons/features/BlockBreakAura.java98
-rw-r--r--src/main/java/rosegoldaddons/features/CustomItemMacro.java77
-rw-r--r--src/main/java/rosegoldaddons/features/EndermanMacro.java63
-rw-r--r--src/main/java/rosegoldaddons/features/GhostMacro.java51
-rw-r--r--src/main/java/rosegoldaddons/features/HardstoneMacro.java201
-rw-r--r--src/main/java/rosegoldaddons/features/ItemFrameAura.java413
-rw-r--r--src/main/java/rosegoldaddons/features/PartyUntransfer.java34
-rw-r--r--src/main/java/rosegoldaddons/features/PowderMacro.java98
-rw-r--r--src/main/java/rosegoldaddons/features/SwordSwapping.java106
-rw-r--r--src/main/java/rosegoldaddons/features/WartMacro.java146
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinNetworkManager.java20
-rw-r--r--src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java28
-rw-r--r--src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java154
-rw-r--r--src/main/java/rosegoldaddons/utils/OutlineUtils.java152
-rw-r--r--src/main/java/rosegoldaddons/utils/RenderUtils.java682
-rw-r--r--src/main/java/rosegoldaddons/utils/RotationUtils.java110
28 files changed, 3316 insertions, 0 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java
new file mode 100644
index 0000000..0047b65
--- /dev/null
+++ b/src/main/java/rosegoldaddons/Config.java
@@ -0,0 +1,52 @@
+package rosegoldaddons;
+
+import gg.essential.vigilance.Vigilant;
+import gg.essential.vigilance.data.Property;
+import gg.essential.vigilance.data.PropertyType;
+
+import java.awt.*;
+import java.io.File;
+import java.util.Arrays;
+
+import java.io.File;
+
+public class Config extends Vigilant {
+ public static Config INSTANCE = new Config();
+
+ @Property(type = PropertyType.SWITCH, name = "Auto Start Dungeon + Ready", description = "Automatically starts the dungeon and gets ready.",
+ category = "RoseGoldAddons", subcategory = "General")
+ public boolean AutoReady = true;
+
+ @Property(type = PropertyType.SWITCH, name = "Party Untransfer", description = "When you really dont wanna be party leader.",
+ category = "RoseGoldAddons", subcategory = "General")
+ public boolean AutoUntransfer = true;
+
+ @Property(type = PropertyType.SWITCH, name = "Enderman ESP", description = "**NOT** Needed for enderman macro.",
+ category = "RoseGoldAddons", subcategory = "General")
+ public boolean EndermanESP = false;
+
+ @Property(type = PropertyType.SWITCH, name = "Use Utility Items when Swapping", description = "Automatically use Tuba / Orb / Wand when AOTS or Whip swap are enabled",
+ category = "RoseGoldAddons", subcategory = "General")
+ public boolean UseUtility = false;
+
+ @Property(type = PropertyType.SLIDER, name = "Sword Swap Delay", description = "How often to swap swords (in miliseconds)",
+ category = "RoseGoldAddons", subcategory = "General", max = 2000)
+ public int swapFrequency = 500;
+
+ @Property(type = PropertyType.SLIDER, name = "ItemFrame Terminal Aura Delay", description = "How often to click an item frame (in miliseconds)",
+ category = "RoseGoldAddons", subcategory = "General", max = 500)
+ public int auraDelay = 10;
+
+ @Property(type = PropertyType.SLIDER, name = "Smooth Look Velocity", description = "How fast should head rotation changes be (in miliseconds)",
+ category = "RoseGoldAddons", subcategory = "General", min = 1, max = 200)
+ public int smoothLookVelocity = 50;
+
+ @Property(type = PropertyType.SLIDER, name = "Macro Range", description = "Look for entities only in radius of the player, 0 = unlimited",
+ category = "RoseGoldAddons", subcategory = "General", min = 0, max = 100)
+ public int macroRadius = 0;
+
+ public Config() {
+ super(new File("./config/rosegoldaddons/config.toml"), "RoseGold Addons");
+ initialize();
+ }
+}
diff --git a/src/main/java/rosegoldaddons/FMLLoadingPlugin.java b/src/main/java/rosegoldaddons/FMLLoadingPlugin.java
new file mode 100644
index 0000000..57d237e
--- /dev/null
+++ b/src/main/java/rosegoldaddons/FMLLoadingPlugin.java
@@ -0,0 +1,45 @@
+package rosegoldaddons;
+
+import net.minecraftforge.common.ForgeVersion;
+import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
+import org.spongepowered.asm.launch.MixinBootstrap;
+import org.spongepowered.asm.mixin.MixinEnvironment;
+import org.spongepowered.asm.mixin.Mixins;
+
+
+import java.util.Map;
+
+@IFMLLoadingPlugin.MCVersion(ForgeVersion.mcVersion)
+public class FMLLoadingPlugin implements IFMLLoadingPlugin {
+
+ public FMLLoadingPlugin() {
+ MixinBootstrap.init();
+ Mixins.addConfiguration("mixins.rosegoldaddons.json");
+ MixinEnvironment.getCurrentEnvironment().setObfuscationContext("searge");
+ }
+
+ @Override
+ public String[] getASMTransformerClass() {
+ return new String[0];
+ }
+
+ @Override
+ public String getModContainerClass() {
+ return null;
+ }
+
+ @Override
+ public String getSetupClass() {
+ return null;
+ }
+
+ @Override
+ public void injectData(Map<String, Object> data) {
+
+ }
+
+ @Override
+ public String getAccessTransformerClass() {
+ return null;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java
new file mode 100644
index 0000000..9c2a338
--- /dev/null
+++ b/src/main/java/rosegoldaddons/Main.java
@@ -0,0 +1,159 @@
+package rosegoldaddons;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.client.ClientCommandHandler;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.client.registry.ClientRegistry;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.InputEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import net.minecraftforge.fml.common.network.FMLNetworkEvent;
+import org.lwjgl.input.Keyboard;
+import rosegoldaddons.commands.*;
+import rosegoldaddons.features.BlockBreakAura;
+import rosegoldaddons.features.*;
+import rosegoldaddons.utils.OpenSkyblockGui;
+
+import java.io.*;
+
+@Mod(modid = "timechanger", name = "RoseGold Addons", version = "2.1")
+public class Main {
+ public static GuiScreen display = null;
+ public static Config configFile = Config.INSTANCE;
+ public static KeyBinding[] keyBinds = new KeyBinding[11];
+ public static int tickCount = 0;
+ public static boolean endermanMacro = false;
+ public static boolean powderMacro = false;
+ public static String u = "";
+ public static boolean AOTSMacro = false;
+ public static boolean SoulWhipMacro = false;
+ public static boolean verified = false;
+ public static boolean GhostMacro = false;
+ public static boolean legitToggle = false;
+ public static boolean gemNukeToggle = false;
+ public static boolean wartToggle = false;
+ public static boolean autoUseItems = false;
+ public static boolean autoHardStone = false;
+
+ @Mod.EventHandler
+ public void onFMLInitialization(FMLPreInitializationEvent event) {
+ File directory = new File(event.getModConfigurationDirectory(), "rosegoldaddons");
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ }
+
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent event) {
+ MinecraftForge.EVENT_BUS.register(this);
+ MinecraftForge.EVENT_BUS.register(new AutoReady());
+ MinecraftForge.EVENT_BUS.register(new OpenSkyblockGui());
+ MinecraftForge.EVENT_BUS.register(new EndermanMacro());
+ MinecraftForge.EVENT_BUS.register(new ItemFrameAura());
+ MinecraftForge.EVENT_BUS.register(new PowderMacro());
+ MinecraftForge.EVENT_BUS.register(new SwordSwapping());
+ MinecraftForge.EVENT_BUS.register(new PartyUntransfer());
+ MinecraftForge.EVENT_BUS.register(new GhostMacro());
+ MinecraftForge.EVENT_BUS.register(new BlockBreakAura());
+ MinecraftForge.EVENT_BUS.register(new WartMacro());
+ MinecraftForge.EVENT_BUS.register(new CustomItemMacro());
+ MinecraftForge.EVENT_BUS.register(new HardstoneMacro());
+
+ configFile.initialize();
+ ClientCommandHandler.instance.registerCommand(new OpenSettings());
+ ClientCommandHandler.instance.registerCommand(new Rosedrobe());
+ ClientCommandHandler.instance.registerCommand(new LobbySwap());
+ ClientCommandHandler.instance.registerCommand(new Backpack());
+ ClientCommandHandler.instance.registerCommand(new WartSetup());
+ ClientCommandHandler.instance.registerCommand(new UseCooldown());
+
+ keyBinds[0] = new KeyBinding("Custom Item Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[1] = new KeyBinding("Toggle Enderman Macro", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[2] = new KeyBinding("Item Frame Aura", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[3] = new KeyBinding("Powder Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[4] = new KeyBinding("AOTS SS Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[5] = new KeyBinding("Soul Whip SS Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[6] = new KeyBinding("Ghost Macro Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[7] = new KeyBinding("Item Frame Legit Mode Toggle", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[8] = new KeyBinding("Gemstone Smart Nuke", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[9] = new KeyBinding("Wart Macro", Keyboard.KEY_NONE, "RoseGold Addons");
+ keyBinds[10] = new KeyBinding("Hardstone Macro", Keyboard.KEY_NONE, "RoseGold Addons");
+
+ for (KeyBinding keyBind : keyBinds) {
+ ClientRegistry.registerKeyBinding(keyBind);
+ }
+ }
+
+ @SubscribeEvent
+ public void tick(TickEvent.ClientTickEvent event) {
+ if (event.phase != TickEvent.Phase.START) return;
+ if (display != null) {
+ try {
+ Minecraft.getMinecraft().displayGuiScreen(display);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ display = null;
+ }
+ }
+
+ @SubscribeEvent
+ public void connect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
+
+ }
+
+ @SubscribeEvent
+ public void key(InputEvent.KeyInputEvent event) {
+ if (keyBinds[0].isPressed()) {
+ autoUseItems = !autoUseItems;
+ String str = autoUseItems ? "§aCustom Item Macro Activated" : "§cCustom Item Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if (keyBinds[1].isPressed()) {
+ endermanMacro = !endermanMacro;
+ String str = endermanMacro ? "§aZealot Macro Activated" : "§cZealot Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if (keyBinds[2].isPressed()) {
+ ItemFrameAura.mainAura();
+ } else if (keyBinds[3].isPressed()) {
+ powderMacro = !powderMacro;
+ String str = powderMacro ? "§aPowder Macro Activated" : "§cPowder Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if (keyBinds[4].isPressed()) {
+ AOTSMacro = !AOTSMacro;
+ String str = AOTSMacro ? "§aAOTS Macro Activated" : "§cAOTS Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if (keyBinds[5].isPressed()) {
+ SoulWhipMacro = !SoulWhipMacro;
+ String str = SoulWhipMacro ? "§aSoul Whip Macro Activated" : "§cSoul Whip Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if(keyBinds[6].isPressed()) {
+ GhostMacro = !GhostMacro;
+ String str = GhostMacro ? "§aGhost Macro Activated" : "§cGhost Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if(keyBinds[7].isPressed()) {
+ legitToggle = !legitToggle;
+ String str = legitToggle ? "§aLegit Mode Activated" : "§cLegit Mode Deactivated";
+ SwordSwapping.tickCount = 0;
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if(keyBinds[8].isPressed()) {
+ gemNukeToggle = !gemNukeToggle;
+ String str = gemNukeToggle ? "§aGemstone Nuke Activated" : "§cGemstone Nuke Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if(keyBinds[9].isPressed()) {
+ wartToggle = !wartToggle;
+ String str = wartToggle ? "§aWart Macro Activated" : "§cWart Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ } else if(keyBinds[10].isPressed()) {
+ autoHardStone = !autoHardStone;
+ String str = autoHardStone ? "§aHardstone Macro Activated" : "§cHardstone Macro Deactivated";
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str));
+ }
+ }
+
+}
diff --git a/src/main/java/rosegoldaddons/OpenSettings.java b/src/main/java/rosegoldaddons/OpenSettings.java
new file mode 100644
index 0000000..0e79b74
--- /dev/null
+++ b/src/main/java/rosegoldaddons/OpenSettings.java
@@ -0,0 +1,57 @@
+package rosegoldaddons;
+
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.BlockPos;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class OpenSettings implements ICommand {
+ @Override
+ public String getCommandName() {
+ return "rosegoldaddons";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>(Arrays.asList("rosegoldaddons", "rga"));
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) {
+ /*EntityPlayerSP player = (EntityPlayerSP) sender;
+ player.addChatMessage(new ChatComponentText("hi "+player.getName()+"!"));*/
+ Main.display = Main.configFile.gui();
+ return;
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+}
+
diff --git a/src/main/java/rosegoldaddons/commands/Backpack.java b/src/main/java/rosegoldaddons/commands/Backpack.java
new file mode 100644
index 0000000..f69cd87
--- /dev/null
+++ b/src/main/java/rosegoldaddons/commands/Backpack.java
@@ -0,0 +1,87 @@
+package rosegoldaddons.commands;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.inventory.Slot;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.jetbrains.annotations.NotNull;
+import rosegoldaddons.Main;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Backpack implements ICommand {
+ public static boolean openBP = false;
+ public static int bpSlot = 0;
+
+ @Override
+ public String getCommandName() {
+ return "backpack";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>(Arrays.asList("backpack", "bp"));
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (args.length == 0) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/storage");
+ } else {
+ if (isNumeric(args[0])) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/storage");
+ openBP = true;
+ bpSlot = Integer.parseInt(args[0]);
+ } else {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments."));
+ return;
+ }
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ private boolean isNumeric(String str) {
+ try {
+ Double.parseDouble(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/commands/LobbySwap.java b/src/main/java/rosegoldaddons/commands/LobbySwap.java
new file mode 100644
index 0000000..517354b
--- /dev/null
+++ b/src/main/java/rosegoldaddons/commands/LobbySwap.java
@@ -0,0 +1,57 @@
+package rosegoldaddons.commands;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.BlockPos;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LobbySwap implements ICommand {
+ public static boolean swapLobby = false;
+
+ @Override
+ public String getCommandName() {
+ return "lobbyswap";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ swapLobby = true;
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu");
+
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return null;
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/commands/Rosedrobe.java b/src/main/java/rosegoldaddons/commands/Rosedrobe.java
new file mode 100644
index 0000000..1f7fd62
--- /dev/null
+++ b/src/main/java/rosegoldaddons/commands/Rosedrobe.java
@@ -0,0 +1,90 @@
+package rosegoldaddons.commands;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.inventory.Slot;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.jetbrains.annotations.NotNull;
+import rosegoldaddons.Main;
+import scala.actors.threadpool.Arrays;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Rosedrobe implements ICommand {
+ public static boolean openWardrobe = false;
+ public static int slot = 0;
+ int windowId;
+
+ @Override
+ public String getCommandName() {
+ return "rosedrobe";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (args.length == 0) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets");
+ slot = 0;
+ openWardrobe = true;
+ } else {
+ if (isNumeric(args[0])) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets");
+ openWardrobe = true;
+ slot = Integer.parseInt(args[0]);
+ } else {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments."));
+ return;
+ }
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ private boolean isNumeric(String str) {
+ try {
+ Double.parseDouble(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/commands/UseCooldown.java b/src/main/java/rosegoldaddons/commands/UseCooldown.java
new file mode 100644
index 0000000..912c75a
--- /dev/null
+++ b/src/main/java/rosegoldaddons/commands/UseCooldown.java
@@ -0,0 +1,90 @@
+package rosegoldaddons.commands;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class UseCooldown implements ICommand {
+ public static HashMap<String, Integer> items = new HashMap<String, Integer>();
+
+ @Override
+ public String getCommandName() {
+ return "usecooldown";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (args.length == 1 && isNumeric(args[0])) {
+ InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory;
+
+ ItemStack curStack = inv.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem);
+ if (curStack != null) {
+ int cd = Integer.parseInt(args[0]);
+ if (cd == 0) {
+ items.remove(curStack.getDisplayName());
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."));
+ return;
+ }
+ if (cd < 1) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Miliseconds, Minimum delay 1 Milisecond."));
+ return;
+ }
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§aSuccessfully Added " + curStack.getDisplayName() + "§a with delay of " + cd + " ms."));
+ items.put(curStack.getDisplayName(), cd);
+ } else {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cError getting current held item."));
+ }
+ } else {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments."));
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ private boolean isNumeric(String str) {
+ try {
+ Double.parseDouble(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/commands/WartSetup.java b/src/main/java/rosegoldaddons/commands/WartSetup.java
new file mode 100644
index 0000000..a5cca13
--- /dev/null
+++ b/src/main/java/rosegoldaddons/commands/WartSetup.java
@@ -0,0 +1,82 @@
+package rosegoldaddons.commands;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class WartSetup implements ICommand {
+ public static int wartEnd = 99999;
+ public static String cardinal = "west";
+
+ @Override
+ public String getCommandName() {
+ return "wartsetup";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if(args.length == 2) {
+ if(args[0].equals("west")) {
+ cardinal = "west";
+ } else if(args[0].equals("north")) {
+ cardinal = "north";
+ } else if(args[0].equals("east")) {
+ cardinal = "east";
+ } else if(args[0].equals("south")) {
+ cardinal = "south";
+ }
+
+ if(isNumeric(args[1])) {
+ wartEnd = (int) Math.floor(Double.parseDouble(args[1]));
+ }
+ } else {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cInvalid Arguments."));
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(String[] args, int index) {
+ return false;
+ }
+
+ @Override
+ public int compareTo(@NotNull ICommand o) {
+ return 0;
+ }
+
+ private boolean isNumeric(String str) {
+ try {
+ Double.parseDouble(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/events/ReceivePacketEvent.java b/src/main/java/rosegoldaddons/events/ReceivePacketEvent.java
new file mode 100644
index 0000000..e658a1e
--- /dev/null
+++ b/src/main/java/rosegoldaddons/events/ReceivePacketEvent.java
@@ -0,0 +1,16 @@
+package rosegoldaddons.events;
+
+import net.minecraft.network.Packet;
+import net.minecraftforge.fml.common.eventhandler.Cancelable;
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+@Cancelable
+public class ReceivePacketEvent extends Event {
+
+ public Packet<?> packet;
+
+ public ReceivePacketEvent(Packet<?> packet) {
+ this.packet = packet;
+ }
+
+}
diff --git a/src/main/java/rosegoldaddons/events/RenderLivingEntityEvent.java b/src/main/java/rosegoldaddons/events/RenderLivingEntityEvent.java
new file mode 100644
index 0000000..8a6c9ed
--- /dev/null
+++ b/src/main/java/rosegoldaddons/events/RenderLivingEntityEvent.java
@@ -0,0 +1,26 @@
+package rosegoldaddons.events;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraftforge.fml.common.eventhandler.Cancelable;
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+@Cancelable
+public class RenderLivingEntityEvent extends Event {
+
+ public EntityLivingBase entity;
+ public float p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor;
+ public ModelBase modelBase;
+
+ public RenderLivingEntityEvent(EntityLivingBase entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor, ModelBase modelBase) {
+ this.entity = entity;
+ this.p_77036_2_ = p_77036_2_;
+ this.p_77036_3_ = p_77036_3_;
+ this.p_77036_4_ = p_77036_4_;
+ this.p_77036_5_ = p_77036_5_;
+ this.p_77036_6_ = p_77036_6_;
+ this.scaleFactor = scaleFactor;
+ this.modelBase = modelBase;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/rosegoldaddons/features/AutoReady.java b/src/main/java/rosegoldaddons/features/AutoReady.java
new file mode 100644
index 0000000..12089a1
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/AutoReady.java
@@ -0,0 +1,122 @@
+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);
+ }
+
+ @SubscribeEvent
+ public void renderWorld(RenderWorldLastEvent event) {
+ if (!Main.configFile.AutoReady || !startDung || checkingEntities) return;
+ new Thread(() -> {
+ try {
+ checkingEntities = true;
+ Thread.sleep(500);
+ Entity mort = null;
+ for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) {
+ if (entity1.getName().contains("Mort")) {
+ mort = entity1;
+ interactWithEntity(mort);
+ startDung = false;
+ break;
+ }
+ }
+ checkingEntities = false;
+ } catch (Exception e) {}
+ }).start();
+ }
+
+ @SubscribeEvent
+ public void chat(ClientChatReceivedEvent event) {
+ if (!Main.configFile.AutoReady) return;
+ String message = StringUtils.stripControlCodes(event.message.getUnformattedText()).toLowerCase();
+ if (message.contains("active potion effects have been paused")) {
+ startDung = true;
+ }
+ }
+
+ @SubscribeEvent
+ public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!Main.configFile.AutoReady) return;
+ if (event.gui instanceof GuiChest) {
+ Container container = ((GuiChest) event.gui).inventorySlots;
+ if (container instanceof ContainerChest) {
+ String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
+ List<Slot> invSlots = container.inventorySlots;
+ //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(chestName));
+ if (chestName.contains("Start Dungeon?")) {
+ int i;
+ for(i = 0; i < invSlots.size(); i++) {
+ if(!invSlots.get(i).getHasStack()) continue;
+ String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName());
+ if(slotName.equals("Start Dungeon?")) {
+ clickSlot(invSlots.get(i));
+ }
+ }
+ } else if (chestName.contains("Catacombs -")) {
+ int i;
+ for(i = 0; i < invSlots.size(); i++) {
+ if(!invSlots.get(i).getHasStack()) continue;
+ String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName());
+ if(slotName.contains(Minecraft.getMinecraft().thePlayer.getName())) {
+ i += 9;
+ if(invSlots.get(i).getHasStack()) {
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Not Ready")) {
+ clickSlot(invSlots.get(i));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void clickSlot(Slot slot) {
+ windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId;
+ Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 1, 0, Minecraft.getMinecraft().thePlayer);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/BlockBreakAura.java b/src/main/java/rosegoldaddons/features/BlockBreakAura.java
new file mode 100644
index 0000000..e8b7219
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/BlockBreakAura.java
@@ -0,0 +1,98 @@
+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 = 4;
+ 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/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java
new file mode 100644
index 0000000..57c650f
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java
@@ -0,0 +1,77 @@
+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 rosegoldaddons.commands.WartSetup;
+
+import java.lang.reflect.Method;
+
+public class CustomItemMacro {
+ private Thread thread;
+ private int milis = 0;
+
+ @SubscribeEvent
+ public void onRender(RenderWorldLastEvent event) {
+ if (!Main.autoUseItems) return;
+ if (thread == null || !thread.isAlive()) {
+ thread = new Thread(() -> {
+ try {
+ milis++;
+ int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem;
+ for (String i : UseCooldown.items.keySet()) {
+ //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(Math.floor(UseCooldown.items.get(i)/1000) + " " + milis));
+ if (milis % Math.floor(UseCooldown.items.get(i)/100) == 0) {
+ int slot = findItemInHotbar(i);
+ if (slot != -1) {
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot;
+ rightClick();
+ Thread.sleep(1);
+ }
+ }
+ }
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem;
+ Thread.sleep(100);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }, "Custom Item Use");
+ thread.start();
+ }
+ }
+
+ 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();
+ }
+ }
+
+ 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/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java
new file mode 100644
index 0000000..fb31a0b
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java
@@ -0,0 +1,63 @@
+package rosegoldaddons.features;
+
+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 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 {
+
+ @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);
+ }
+ }
+ }
+ }
+
+ private static Entity getClosestEnderman() {
+ Entity eman = null;
+ Double closest = Double.valueOf(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);
+ if (dist < closest) {
+ if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) {
+ closest = dist;
+ eman = entity1;
+ } if(Main.configFile.macroRadius == 0) {
+ closest = dist;
+ eman = entity1;
+ }
+ }
+ }
+ }
+ return eman;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java
new file mode 100644
index 0000000..8fb2dfc
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/GhostMacro.java
@@ -0,0 +1,51 @@
+package rosegoldaddons.features;
+
+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.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import rosegoldaddons.Main;
+import rosegoldaddons.utils.RenderUtils;
+import rosegoldaddons.utils.RotationUtils;
+
+import java.awt.*;
+import java.util.Random;
+
+public class GhostMacro {
+ @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();
+ }
+ }
+ }
+
+ private static Entity getClosestCreeper() {
+ Entity eman = null;
+ Double closest = Double.valueOf(9999);
+ 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);
+ if (dist < closest) {
+ if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) {
+ closest = dist;
+ eman = entity1;
+ } if(Main.configFile.macroRadius == 0) {
+ closest = dist;
+ eman = entity1;
+ }
+ }
+ }
+ }
+ return eman;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/HardstoneMacro.java b/src/main/java/rosegoldaddons/features/HardstoneMacro.java
new file mode 100644
index 0000000..95c1808
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/HardstoneMacro.java
@@ -0,0 +1,201 @@
+package rosegoldaddons.features;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiChest;
+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.server.S2APacketParticles;
+import net.minecraft.util.*;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+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.ReceivePacketEvent;
+import rosegoldaddons.utils.RenderUtils;
+import rosegoldaddons.utils.RotationUtils;
+
+import java.awt.*;
+import java.util.ArrayList;
+
+public class HardstoneMacro {
+ private ArrayList<Vec3> solved = new ArrayList<>();
+ private BlockPos closestStone = null;
+ private Vec3 closestChest = null;
+ private Thread thread;
+ private boolean breaking = false;
+ 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;
+ }
+ 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 (breaking) {
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false);
+ breaking = false;
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void receivePacket(ReceivePacketEvent event) {
+ if (!Main.autoHardStone) return;
+ if (event.packet instanceof S2APacketParticles) {
+ S2APacketParticles packet = (S2APacketParticles) event.packet;
+ if (packet.getParticleType().equals(EnumParticleTypes.CRIT)) {
+ Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate());
+ if (closestChest != null) {
+ stopHardstone = true;
+ double dist = closestChest.distanceTo(particlePos);
+ if (dist < 1) {
+ particlePos = particlePos.add(new Vec3(0, -1, 0));
+ int drill = PowderMacro.findItemInHotbar("X655");
+ if (drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill;
+ RotationUtils.facePos(particlePos);
+ }
+ }
+ }
+ }
+ }
+
+ @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();
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ @SubscribeEvent
+ public void renderWorld(RenderWorldLastEvent event) {
+ if (!Main.autoHardStone) return;
+ closestStone = closestStone();
+ closestChest = closestChest();
+ if (closestStone != null) {
+ RenderUtils.drawBlockBox(closestStone, new Color(128, 128, 128), true, event.partialTicks);
+ }
+ if (closestChest != null) {
+ RenderUtils.drawBlockBox(new BlockPos(closestChest.xCoord, closestChest.yCoord, closestChest.zCoord), new Color(255, 128, 0), true, event.partialTicks);
+ } else {
+ stopHardstone = false;
+ }
+ }
+
+ @SubscribeEvent
+ public void clear(WorldEvent.Load event) {
+ solved.clear();
+ }
+
+ private BlockPos closestStone() {
+ int r = 6;
+ 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 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) {
+ stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5));
+ }
+ }
+ }
+ double smallest = 9999;
+ Vec3 closest = null;
+ for (Vec3 stone : stones) {
+ double dist = stone.distanceTo(playerVec);
+ if (dist < smallest) {
+ smallest = dist;
+ closest = stone;
+ }
+ }
+ if (closest != null && smallest < 5) {
+ return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord);
+ }
+ return null;
+ }
+
+ private Vec3 closestChest() {
+ int r = 6;
+ 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<>();
+ 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.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) {
+ if(!solved.contains(chest)) {
+ double dist = chest.distanceTo(playerVec);
+ if (dist < smallest) {
+ smallest = dist;
+ closest = chest;
+ }
+ }
+ }
+ return closest;
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/ItemFrameAura.java b/src/main/java/rosegoldaddons/features/ItemFrameAura.java
new file mode 100644
index 0000000..0e7426f
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/ItemFrameAura.java
@@ -0,0 +1,413 @@
+package rosegoldaddons.features;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.PlayerControllerMP;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItemFrame;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.IChatComponent;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+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.ArrayList;
+
+public class ItemFrameAura {
+ private static ArrayList<Entity> itemFrames = new ArrayList<Entity>();
+ private static boolean clicking = false;
+ private static ArrayList<Entity> clicked = new ArrayList<Entity>();
+ private Thread thread;
+
+ 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();
+ }
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.PlayerTickEvent event) {
+ if (!Main.legitToggle) return;
+ if (thread == null || !thread.isAlive()) {
+ thread = new Thread(() -> {
+ try {
+ BlockPos topLeft = new BlockPos(196, 125, 278);
+ ArrayList<Entity> redWools = new ArrayList<Entity>();
+ ArrayList<Entity> greenWools = new ArrayList<Entity>();
+
+ itemFrames.forEach(itemFrame -> {
+ ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem();
+ if (itemStack != null) {
+ String itemString = itemStack.toString();
+ if (itemString.contains("cloth@14")) {
+ redWools.add(itemFrame);
+ } else if (itemString.contains("cloth@5")) {
+ greenWools.add(itemFrame);
+ }
+ }
+ });
+ String patternName = getPattern(redWools, greenWools, topLeft);
+ MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver;
+ if (objectMouseOver != null && objectMouseOver.entityHit != null) {
+ Entity entity = objectMouseOver.entityHit;
+ if (entity instanceof EntityItemFrame) {
+ Entity itemFrame = entity;
+ ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem();
+ if (itemStack != null) {
+ String itemString = itemStack.toString();
+ if (itemString.contains("arrow@0")) {
+ int endRotationAmount = howMuchToClick(patternName, itemFrame, topLeft, true);
+ int currRotationAmount = ((EntityItemFrame) itemFrame).getRotation();
+ int toClick = 0;
+ if (currRotationAmount < endRotationAmount) {
+ toClick = endRotationAmount - currRotationAmount;
+ } else if (currRotationAmount > endRotationAmount) {
+ currRotationAmount = currRotationAmount - 8;
+ toClick = endRotationAmount - currRotationAmount;
+ }
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("" + toClick));
+ for (int i = 0; i < toClick; i++) {
+ //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("clicked"));
+ rightClick();
+ Thread.sleep(Main.configFile.auraDelay);
+ }
+ Thread.sleep(200);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }, "Legit Mode");
+ thread.start();
+ }
+ }
+
+ @SubscribeEvent
+ public void renderWorld(RenderWorldLastEvent event) {
+ itemFrames.clear();
+ for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) {
+ if (entity1 instanceof EntityItemFrame) {
+ itemFrames.add(entity1);
+ }
+ }
+ }
+
+ private static void interactWithEntity(Entity entity) {
+ PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController;
+ playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity);
+ }
+
+ public static void mainAura() {
+ BlockPos topLeft = new BlockPos(196, 125, 278);
+ ArrayList<Entity> redWools = new ArrayList<Entity>();
+ ArrayList<Entity> greenWools = new ArrayList<Entity>();
+
+ itemFrames.forEach(itemFrame -> {
+ ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem();
+ if (itemStack != null) {
+ String itemString = itemStack.toString();
+ if (itemString.contains("cloth@14")) {
+ redWools.add(itemFrame);
+ } else if (itemString.contains("cloth@5")) {
+ greenWools.add(itemFrame);
+ }
+ }
+ });
+
+ String patternName = getPattern(redWools, greenWools, topLeft);
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(patternName));
+ clickPatternAura(patternName, topLeft);
+ }
+
+ private static void clickPatternAura(String patternName, BlockPos topLeft) {
+ new Thread(() -> {
+ itemFrames.forEach(itemFrame -> {
+ ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem();
+ if (itemStack != null) {
+ String itemString = itemStack.toString();
+ if (itemString.contains("arrow@0")) {
+ int endRotationAmount = howMuchToClick(patternName, itemFrame, topLeft, false);
+ int currRotationAmount = ((EntityItemFrame) itemFrame).getRotation();
+ int toClick = 0;
+ if (currRotationAmount < endRotationAmount) {
+ toClick = endRotationAmount - currRotationAmount;
+ } else if (currRotationAmount > endRotationAmount) {
+ currRotationAmount = currRotationAmount - 8;
+ toClick = endRotationAmount - currRotationAmount;
+ }
+ for (int i = 0; i < toClick; i++) {
+ interactWithEntity(itemFrame);
+ }
+ }
+ }
+ });
+ }).start();
+ }
+
+ private static int howMuchToClick(String patternName, Entity entity, BlockPos topLeft, boolean legitMode) {
+ //prepare to see top tier code right here boys
+ int y = entity.getPosition().getY();
+ int z = entity.getPosition().getZ();
+ int relativeY = topLeft.getY() - y;
+ int relativeX = topLeft.getZ() - z; //intentional
+
+ //shit tier code!! i didn't know how to use hashmaps when i made this :)
+ if (patternName == "legs") {
+ if (relativeY == 0) {
+ if (relativeX == 3 || relativeX == 2) {
+ return 5;
+ } else if (relativeX == 1) {
+ return 3;
+ }
+ }
+ if (relativeY == 1 || relativeY == 2 || relativeY == 3) {
+ if (relativeX == 1) {
+ return 3;
+ } else if (relativeX == 3) {
+ return 7;
+ }
+ }
+ if (relativeY == 4) {
+ if (relativeX == 1) {
+ if (legitMode) return 5;
+ return 4;
+ }
+ if (relativeX == 3) {
+ return 7;
+ }
+ }
+ }
+ if (patternName == "lines") {
+ if (relativeY == 4 && relativeX == 2) {
+ if (legitMode) return 5;
+ return 4;
+ }
+ return 5;
+ }
+ if (patternName == "S") {
+ if (relativeY == 0) {
+ if (relativeX == 4) {
+ return 3;
+ }
+ if (relativeX < 4) {
+ return 1;
+ }
+ }
+ if (relativeY == 1) {
+ if (relativeX == 2) {
+ return 7;
+ }
+ if (relativeX == 4) {
+ return 3;
+ }
+ }
+ if (relativeY == 3) {
+ if (relativeX == 0) {
+ return 7;
+ }
+ if (relativeX == 2) {
+ if (legitMode) return 3;
+ return 2;
+ }
+ }
+ if (relativeY == 4) {
+ if (relativeX == 0) {
+ return 7;
+ }
+ if (relativeX > 0) {
+ return 5;
+ }
+ }
+ }
+ if (patternName == "W") {
+ if (relativeY == 1 || relativeY == 2) {
+ return 3;
+ }
+ if (relativeY == 3) {
+ if (relativeX == 0 || relativeX == 4) {
+ return 3;
+ }
+ if (relativeX == 2) {
+ if (legitMode) return 7;
+ return 6;
+ }
+ }
+ if (relativeY == 4) {
+ if (relativeX < 2) {
+ return 1;
+ }
+ if (relativeX == 2) {
+ return 7;
+ }
+ if (relativeX > 2) {
+ return 5;
+ }
+ }
+ }
+ if (patternName == "spiral") {
+ if (relativeY == 0) {
+ if (relativeX == 0) {
+ return 3;
+ }
+ return 5;
+ }
+ if (relativeY == 3 && relativeX == 2) {
+ if (legitMode) return 7;
+ return 6;
+ }
+ if (relativeY < 4) {
+ if (relativeX == 0) {
+ return 3;
+ }
+ if (relativeX == 2 || relativeX == 4) {
+ return 7;
+ }
+ }
+ if (relativeY == 4) {
+ if (relativeX == 2) {
+ return 7;
+ }
+ return 1;
+ }
+ }
+ if (patternName == "zigzag") {
+ if (relativeY == 3) {
+ if (relativeX == 2) {
+ if (legitMode) return 5;
+ return 4;
+ }
+ }
+ if (relativeY == 1 || relativeY == 3 || relativeX == 3) {
+ return 5;
+ }
+ if (relativeX == 2) {
+ if (relativeY == 0) {
+ return 3;
+ }
+ if (relativeY == 2 || relativeY == 4) {
+ return 7;
+ }
+ }
+ }
+ if (patternName == "N") {
+ if (relativeY == 3 && relativeX == 2) {
+ if (legitMode) return 3;
+ return 2;
+ }
+ if (relativeY == 0) {
+ if (relativeX == 2) {
+ return 3;
+ }
+ return 5;
+ }
+ if (relativeY < 4) {
+ if (relativeX == 0 || relativeX == 4) {
+ return 7;
+ }
+ if (relativeX == 2) {
+ return 3;
+ }
+ }
+ if (relativeY == 4) {
+ if (relativeX > 0) {
+ return 5;
+ }
+ if (relativeX == 0) {
+ return 7;
+ }
+ }
+ }
+ if (patternName == "bottleneck") {
+ if (relativeY == 3 && relativeX == 1) {
+ if (legitMode) return 7;
+ return 6;
+ }
+ if (relativeY == 0) {
+ if (relativeX < 2) {
+ return 1;
+ }
+ if (relativeX > 2) {
+ return 5;
+ }
+ }
+ if (relativeY == 1 || relativeY == 3) {
+ return 7;
+ }
+ if (relativeY == 2) {
+ if (relativeX == 0 || relativeX == 4) {
+ return 7;
+ }
+ if (relativeX == 1) {
+ return 5;
+ }
+ if (relativeX == 3) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ private static String getPattern(ArrayList<Entity> redWools, ArrayList<Entity> greenWools, BlockPos topleft) {
+ if (redWools.size() == 1) {
+ if (greenWools.size() == 1) {
+ Entity ry1 = (Entity) redWools.toArray()[0];
+ Entity gy1 = (Entity) greenWools.toArray()[0];
+ BlockPos redPos1 = ry1.getPosition();
+ BlockPos greenPos1 = gy1.getPosition();
+ //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("red 1: "+redPos1));
+ int relativeR1 = topleft.getY() - redPos1.getY();
+ int relativeG1 = topleft.getY() - greenPos1.getY();
+ if (relativeG1 == 4 && relativeR1 == 4) {
+ return "legs";
+ }
+ if (relativeG1 == 4 && relativeR1 == 0) {
+ return "N";
+ }
+ if (relativeG1 == 4 && relativeR1 == 2) {
+ return "spiral";
+ }
+ } else if (greenWools.size() == 2) {
+ Entity ry1 = (Entity) redWools.toArray()[0];
+ BlockPos redPos1 = ry1.getPosition();
+ int relativeR1 = topleft.getY() - redPos1.getY();
+ if (relativeR1 == 2) {
+ return "W";
+ }
+ return "bottleneck";
+ }
+
+ } else if (redWools.size() == 2) {
+ Entity ry1 = (Entity) redWools.toArray()[0];
+ Entity ry2 = (Entity) redWools.toArray()[0];
+ BlockPos redPos1 = ry1.getPosition();
+ BlockPos redPos2 = ry2.getPosition();
+ int relativeR1 = topleft.getY() - redPos1.getY();
+ int relativeR2 = topleft.getY() - redPos2.getY();
+ if (greenWools.size() > 1) return "zigzag";
+ return "S";
+
+ } else if (redWools.size() == 3) {
+ return "lines";
+ }
+
+ return "Unrecognized";
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/PartyUntransfer.java b/src/main/java/rosegoldaddons/features/PartyUntransfer.java
new file mode 100644
index 0000000..c88b4e3
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/PartyUntransfer.java
@@ -0,0 +1,34 @@
+package rosegoldaddons.features;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import rosegoldaddons.Main;
+
+public class PartyUntransfer {
+ @SubscribeEvent
+ public void chat(ClientChatReceivedEvent event) {
+ if (!Main.configFile.AutoUntransfer) return;
+ String message = StringUtils.stripControlCodes(event.message.getUnformattedText()).toLowerCase();
+ if (message.contains("the party was transferred to")) {
+ String playerName = Minecraft.getMinecraft().thePlayer.getName();
+ String leader = stripRank(message.substring(message.indexOf("by")+3));
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader);
+ }
+ if(message.contains("has promoted")) {
+ String playerName = Minecraft.getMinecraft().thePlayer.getName();
+ String leader = stripRank(message.substring(0 ,message.indexOf("has promoted")-1));
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader);
+ }
+ }
+
+ private String stripRank(String name) {
+ if(!name.contains("]")) {
+ System.out.println("non detected");
+ return name;
+ }
+ return name.substring(name.indexOf("]")+2);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java
new file mode 100644
index 0000000..3666e0d
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/PowderMacro.java
@@ -0,0 +1,98 @@
+package rosegoldaddons.features;
+
+import net.minecraft.block.Block;
+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.network.play.server.S2APacketParticles;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.event.entity.living.LivingEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import rosegoldaddons.Main;
+import rosegoldaddons.events.ReceivePacketEvent;
+import rosegoldaddons.utils.RenderUtils;
+import rosegoldaddons.utils.RotationUtils;
+
+import java.awt.*;
+import java.util.ArrayList;
+
+public class PowderMacro {
+ private static Vec3 closestChest = null;
+
+ @SubscribeEvent
+ public void receivePacket(ReceivePacketEvent event) {
+ if (!Main.powderMacro) return;
+ if (event.packet instanceof S2APacketParticles) {
+ S2APacketParticles packet = (S2APacketParticles) event.packet;
+ if (packet.getParticleType().equals(EnumParticleTypes.CRIT)) {
+ Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate());
+ 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");
+ if(drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill;
+ RotationUtils.facePos(particlePos);
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void renderWorld(RenderWorldLastEvent event) {
+ if (!Main.powderMacro) return;
+ closestChest = closestChest();
+ if (closestChest != null) {
+ RenderUtils.drawBlockBox(new BlockPos(closestChest.xCoord, closestChest.yCoord, closestChest.zCoord), new Color(255, 128, 0), true, event.partialTicks);
+ }
+ }
+
+ private static Vec3 closestChest() {
+ int r = 6;
+ 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.chest) {
+ 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);
+ }
+ }
+ return closest;
+ }
+
+ public 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/SwordSwapping.java b/src/main/java/rosegoldaddons/features/SwordSwapping.java
new file mode 100644
index 0000000..099b9d7
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/SwordSwapping.java
@@ -0,0 +1,106 @@
+package rosegoldaddons.features;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+import net.minecraft.world.World;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import rosegoldaddons.Main;
+
+import java.lang.reflect.Method;
+
+public class SwordSwapping {
+ public static int tickCount = 0;
+ private Thread thread;
+
+ 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();
+ }
+ }
+
+ 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;
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.PlayerTickEvent event) {
+ if (Minecraft.getMinecraft().currentScreen != null) return;
+ if (!Main.AOTSMacro && !Main.SoulWhipMacro) {
+ tickCount = 0;
+ return;
+ }
+ if (thread == null || !thread.isAlive()) {
+ thread = new Thread(() -> {
+ try {
+ Thread.sleep(Main.configFile.swapFrequency);
+ int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem;
+ int orbSlot = findItemInHotbar("Power Orb");
+ int tubaSlot = findItemInHotbar("Tuba");
+ int wandSlot = findItemInHotbar("Atonement");
+ int whipSlot = -1;
+ int aotsSlot = -1;
+ if(Main.AOTSMacro) {
+ aotsSlot = findItemInHotbar("Shredded");
+ }
+ if(Main.SoulWhipMacro) {
+ whipSlot = findItemInHotbar("Whip");
+ }
+ if(whipSlot != -1) {
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = whipSlot;
+ rightClick();
+ }
+ if(aotsSlot != -1) {
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = aotsSlot;
+ rightClick();
+ }
+ if(Main.configFile.UseUtility) {
+ if(tickCount % Math.round((1000/Main.configFile.swapFrequency*20)) == 1 && tubaSlot != -1) {
+ Thread.sleep(1);
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = tubaSlot;
+ rightClick();
+ }
+ if(tickCount % Math.round((1000/Main.configFile.swapFrequency*59)) == 1 && orbSlot != -1) {
+ Thread.sleep(1);
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = orbSlot;
+ rightClick();
+ }
+ if(tickCount % Math.round((1000/Main.configFile.swapFrequency*7)) == 1 && wandSlot != -1) {
+ Thread.sleep(1);
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = wandSlot;
+ rightClick();
+ }
+ }
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem;
+ tickCount++;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }, "Sword Swap");
+ thread.start();
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/features/WartMacro.java b/src/main/java/rosegoldaddons/features/WartMacro.java
new file mode 100644
index 0000000..8b47fcb
--- /dev/null
+++ b/src/main/java/rosegoldaddons/features/WartMacro.java
@@ -0,0 +1,146 @@
+package rosegoldaddons.features;
+
+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.init.Blocks;
+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.commands.WartSetup;
+import rosegoldaddons.utils.RenderUtils;
+
+import java.awt.*;
+import java.util.ArrayList;
+
+public class WartMacro {
+ private boolean breaking = false;
+ private boolean walking = false;
+ private double savex = -999;
+ private double savez = -999;
+ private Thread thread;
+ private Thread thread2;
+
+ @SubscribeEvent
+ public void move(TickEvent.ClientTickEvent event) {
+ if (!Main.wartToggle || Minecraft.getMinecraft().currentScreen != null) {
+ if (walking) {
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindForward.getKeyCode(), false);
+ walking = false;
+ }
+ return;
+ }
+ if (thread == null || !thread.isAlive()) {
+ thread = new Thread(() -> {
+ try {
+ //if (event.phase.toString().equals("START")) {
+ if (!walking) {
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindForward.getKeyCode(), true);
+ walking = true;
+ }
+ float prevYaw = Minecraft.getMinecraft().thePlayer.rotationYaw;
+ float nextYaw = -1;
+ if (WartSetup.cardinal.equals("east")) {
+ if (Minecraft.getMinecraft().thePlayer.getPosition().getZ() == WartSetup.wartEnd) {
+ nextYaw = 230;
+ } else if (Minecraft.getMinecraft().thePlayer.getPosition().getZ() == -WartSetup.wartEnd) {
+ nextYaw = 310;
+ }
+ } else if (WartSetup.cardinal.equals("north")) {
+ if (Minecraft.getMinecraft().thePlayer.getPosition().getX() == WartSetup.wartEnd) {
+ nextYaw = 140;
+ } else if (Minecraft.getMinecraft().thePlayer.getPosition().getX() == -WartSetup.wartEnd) {
+ nextYaw = 220;
+ }
+ } else if (WartSetup.cardinal.equals("west")) {
+ if (Minecraft.getMinecraft().thePlayer.getPosition().getZ() == WartSetup.wartEnd) {
+ nextYaw = 130;
+ } else if (Minecraft.getMinecraft().thePlayer.getPosition().getZ() == -WartSetup.wartEnd) {
+ nextYaw = 50;
+ }
+ } else if (WartSetup.cardinal.equals("south")) {
+ if (Minecraft.getMinecraft().thePlayer.getPosition().getX() == WartSetup.wartEnd) {
+ nextYaw = 40;
+ } else if (Minecraft.getMinecraft().thePlayer.getPosition().getX() == -WartSetup.wartEnd) {
+ nextYaw = 320;
+ }
+ }
+ if(nextYaw != -1) {
+ for (int i = 0; i < 50; i++) {
+ Minecraft.getMinecraft().thePlayer.rotationYaw += (nextYaw - prevYaw) / 50;
+ Thread.sleep(10);
+ }
+ }
+ //}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }, "Wart Rotation");
+ thread.start();
+ }
+ }
+
+
+ @SubscribeEvent
+ public void click(TickEvent.ClientTickEvent event) {
+ if (!Main.wartToggle || Minecraft.getMinecraft().currentScreen != null) {
+ if (breaking) {
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false);
+ breaking = false;
+ }
+ return;
+ }
+ if (event.phase.toString().equals("START")) {
+ 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.nether_wart) {
+ 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 antiStuck(TickEvent.ClientTickEvent event) {
+ if (!Main.wartToggle || Minecraft.getMinecraft().currentScreen != null) return;
+ if (event.phase.toString().equals("START")) {
+ if (thread2 == null || !thread2.isAlive()) {
+ thread2 = new Thread(() -> {
+ try {
+ Thread.sleep(1500);
+ double xdiff = Math.abs(savex - Minecraft.getMinecraft().thePlayer.posX);
+ double zdiff = Math.abs(savez - Minecraft.getMinecraft().thePlayer.posZ);
+ if(xdiff < 2 && zdiff < 2) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("stuck detected."));
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), true);
+ Thread.sleep(500);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), false);
+ Thread.sleep(1000);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), true);
+ Thread.sleep(500);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), false);
+ }
+ savex = Minecraft.getMinecraft().thePlayer.posX;
+ savez = Minecraft.getMinecraft().thePlayer.posZ;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }, "Anti Stuck");
+ thread2.start();
+ }
+ }
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/MixinNetworkManager.java b/src/main/java/rosegoldaddons/mixins/MixinNetworkManager.java
new file mode 100644
index 0000000..29fc19d
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/MixinNetworkManager.java
@@ -0,0 +1,20 @@
+package rosegoldaddons.mixins;
+
+import io.netty.channel.ChannelHandlerContext;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraftforge.common.MinecraftForge;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.events.ReceivePacketEvent;
+
+@Mixin(NetworkManager.class)
+public class MixinNetworkManager {
+
+ @Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true)
+ private void onReceivePacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
+ if (MinecraftForge.EVENT_BUS.post(new ReceivePacketEvent(packet))) ci.cancel();
+ }
+}
diff --git a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java
new file mode 100644
index 0000000..bc1033f
--- /dev/null
+++ b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java
@@ -0,0 +1,28 @@
+package rosegoldaddons.mixins;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.entity.RendererLivingEntity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import rosegoldaddons.events.RenderLivingEntityEvent;
+
+@Mixin(RendererLivingEntity.class)
+@SideOnly(Side.CLIENT)
+public abstract class MixinRendererLivingEntity {
+
+ @Shadow
+ protected ModelBase mainModel;
+
+ @Inject(method = "renderModel", at = @At("HEAD"), cancellable = true)
+ private <T extends EntityLivingBase> void renderModel(T entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor, CallbackInfo ci) {
+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEntityEvent(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor, mainModel)))
+ ci.cancel();
+ }
+}
diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
new file mode 100644
index 0000000..6eed707
--- /dev/null
+++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
@@ -0,0 +1,154 @@
+package rosegoldaddons.utils;
+
+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.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import rosegoldaddons.commands.Backpack;
+import rosegoldaddons.commands.LobbySwap;
+
+import java.util.List;
+
+public class OpenSkyblockGui {
+ int windowId;
+ boolean openingWardrobe = false;
+ boolean lobbySwapping = false;
+ boolean openingBP = false;
+
+ @SubscribeEvent
+ public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!rosegoldaddons.commands.Rosedrobe.openWardrobe || openingWardrobe) return;
+ new Thread(() -> {
+ try {
+ openingWardrobe = true;
+ if (event.gui instanceof GuiChest) {
+ Container container = ((GuiChest) event.gui).inventorySlots;
+ if (container instanceof ContainerChest) {
+ String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
+ List<Slot> invSlots = container.inventorySlots;
+ if (chestName.contains("Pets")) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName());
+ //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(slotName));
+ if (slotName.equals("Go Back")) {
+ clickSlot(invSlots.get(i));
+ }
+ }
+ } else if (chestName.contains("SkyBlock")) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Wardrobe")) {
+ clickSlot(invSlots.get(i));
+ if (rosegoldaddons.commands.Rosedrobe.slot == 0)
+ rosegoldaddons.commands.Rosedrobe.openWardrobe = false;
+ }
+ }
+ } else if (chestName.contains("Wardrobe")) {
+ if (rosegoldaddons.commands.Rosedrobe.slot != 0) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ String slotName = "Slot " + rosegoldaddons.commands.Rosedrobe.slot + ":";
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) {
+ clickSlot(invSlots.get(i));
+ Minecraft.getMinecraft().thePlayer.closeScreen();
+ rosegoldaddons.commands.Rosedrobe.openWardrobe = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ openingWardrobe = false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ @SubscribeEvent
+ public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!LobbySwap.swapLobby || lobbySwapping) return;
+ new Thread(() -> {
+ try {
+ lobbySwapping = true;
+ if (event.gui instanceof GuiChest) {
+ Container container = ((GuiChest) event.gui).inventorySlots;
+ if (container instanceof ContainerChest) {
+ String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
+ List<Slot> invSlots = container.inventorySlots;
+ if (chestName.contains("SkyBlock")) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Enter the Crystal Hollows")) {
+ clickSlot(invSlots.get(i));
+ }
+ }
+ } else if (chestName.contains("Enter the")) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Confirm")) {
+ clickSlot(invSlots.get(i));
+ LobbySwap.swapLobby = false;
+ }
+ }
+ Thread.sleep(2000);
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(Minecraft.getMinecraft().theWorld.getWorldTime() + " ticks"));
+ }
+ }
+ }
+ lobbySwapping = false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ @SubscribeEvent
+ public void guiDraw3(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!Backpack.openBP || openingBP) return;
+ new Thread(() -> {
+ try {
+ openingBP = true;
+ if (event.gui instanceof GuiChest) {
+ Container container = ((GuiChest) event.gui).inventorySlots;
+ if (container instanceof ContainerChest) {
+ String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
+ List<Slot> invSlots = container.inventorySlots;
+ if (chestName.contains("Storage")) {
+ if (Backpack.bpSlot != 0) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+ String slotName = "Slot " + Backpack.bpSlot;
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) {
+ clickSlot(invSlots.get(i));
+ Backpack.openBP = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ openingBP = false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ private void clickSlot(Slot slot) {
+ windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId;
+ Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 0, 0, Minecraft.getMinecraft().thePlayer);
+ }
+}
diff --git a/src/main/java/rosegoldaddons/utils/OutlineUtils.java b/src/main/java/rosegoldaddons/utils/OutlineUtils.java
new file mode 100644
index 0000000..0b1bde2
--- /dev/null
+++ b/src/main/java/rosegoldaddons/utils/OutlineUtils.java
@@ -0,0 +1,152 @@
+package rosegoldaddons.utils;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.entity.EntityLivingBase;
+import org.lwjgl.opengl.EXTFramebufferObject;
+import org.lwjgl.opengl.EXTPackedDepthStencil;
+import rosegoldaddons.events.RenderLivingEntityEvent;
+
+import java.awt.*;
+
+import static org.lwjgl.opengl.GL11.*;
+
+public class OutlineUtils {
+
+ public static void outlineESP(EntityLivingBase entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor, ModelBase modelBase, Color color) {
+ Minecraft mc = Minecraft.getMinecraft();
+ boolean fancyGraphics = mc.gameSettings.fancyGraphics;
+ float gamma = mc.gameSettings.gammaSetting;
+ mc.gameSettings.fancyGraphics = false;
+ mc.gameSettings.gammaSetting = 100000F;
+
+ GlStateManager.resetColor();
+ setColor(color);
+ renderOne(2);
+ modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
+ setColor(color);
+ renderTwo();
+ modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
+ setColor(color);
+ renderThree();
+ modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
+ setColor(color);
+ renderFour(color);
+ modelBase.render(entity, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
+ setColor(color);
+ renderFive();
+ setColor(Color.WHITE);
+
+ mc.gameSettings.fancyGraphics = fancyGraphics;
+ mc.gameSettings.gammaSetting = gamma;
+ }
+
+ public static void outlineESP(RenderLivingEntityEvent event, Color color) {
+ Minecraft mc = Minecraft.getMinecraft();
+ boolean fancyGraphics = mc.gameSettings.fancyGraphics;
+ float gamma = mc.gameSettings.gammaSetting;
+ mc.gameSettings.fancyGraphics = false;
+ mc.gameSettings.gammaSetting = 100000F;
+
+ GlStateManager.resetColor();
+ setColor(color);
+ renderOne(2);
+ event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor);
+ setColor(color);
+ renderTwo();
+ event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor);
+ setColor(color);
+ renderThree();
+ event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor);
+ setColor(color);
+ renderFour(color);
+ event.modelBase.render(event.entity, event.p_77036_2_, event.p_77036_3_, event.p_77036_4_, event.p_77036_5_, event.p_77036_6_, event.scaleFactor);
+ setColor(color);
+ renderFive();
+ setColor(Color.WHITE);
+
+ mc.gameSettings.fancyGraphics = fancyGraphics;
+ mc.gameSettings.gammaSetting = gamma;
+ }
+
+ public static void renderOne(final float lineWidth) {
+ checkSetupFBO();
+ glPushAttrib(GL_ALL_ATTRIB_BITS);
+ glDisable(GL_ALPHA_TEST);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glLineWidth(lineWidth);
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_STENCIL_TEST);
+ glClear(GL_STENCIL_BUFFER_BIT);
+ glClearStencil(0xF);
+ glStencilFunc(GL_NEVER, 1, 0xF);
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+
+ public static void renderTwo() {
+ glStencilFunc(GL_NEVER, 0, 0xF);
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+
+ public static void renderThree() {
+ glStencilFunc(GL_EQUAL, 1, 0xF);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+
+ public static void renderFour(final Color color) {
+ setColor(color);
+ glDepthMask(false);
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_POLYGON_OFFSET_LINE);
+ glPolygonOffset(1.0F, -2000000F);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
+ }
+
+ public static void renderFive() {
+ glPolygonOffset(1.0F, 2000000F);
+ glDisable(GL_POLYGON_OFFSET_LINE);
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(true);
+ glDisable(GL_STENCIL_TEST);
+ glDisable(GL_LINE_SMOOTH);
+ glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
+ glEnable(GL_BLEND);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_ALPHA_TEST);
+ glPopAttrib();
+ }
+
+ public static void setColor(final Color color) {
+ glColor4d(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F);
+ }
+
+ public static void checkSetupFBO() {
+ final Framebuffer fbo = Minecraft.getMinecraft().getFramebuffer();
+ if (fbo != null) {
+ if (fbo.depthBuffer > -1) {
+ setupFBO(fbo);
+ fbo.depthBuffer = -1;
+ }
+ }
+ }
+
+ private static void setupFBO(final Framebuffer fbo) {
+ EXTFramebufferObject.glDeleteRenderbuffersEXT(fbo.depthBuffer);
+ final int stencil_depth_buffer_ID = EXTFramebufferObject.glGenRenderbuffersEXT();
+ EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID);
+ EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
+ EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID);
+ EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID);
+ }
+
+}
diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java
new file mode 100644
index 0000000..5d3e2f2
--- /dev/null
+++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java
@@ -0,0 +1,682 @@
+package rosegoldaddons.utils;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+import java.awt.*;
+import java.util.HashMap;
+import java.util.Map;
+
+import static java.lang.Math.*;
+import static org.lwjgl.opengl.GL11.*;
+
+public class RenderUtils {
+
+ private static final Map<Integer, Boolean> glCapMap = new HashMap<>();
+ private static final int[] DISPLAY_LISTS_2D = new int[4];
+ private static final Minecraft mc = Minecraft.getMinecraft();
+
+ static {
+ for (int i = 0; i < DISPLAY_LISTS_2D.length; i++) {
+ DISPLAY_LISTS_2D[i] = glGenLists(1);
+ }
+
+ glNewList(DISPLAY_LISTS_2D[0], GL_COMPILE);
+
+ quickDrawRect(-7F, 2F, -4F, 3F);
+ quickDrawRect(4F, 2F, 7F, 3F);
+ quickDrawRect(-7F, 0.5F, -6F, 3F);
+ quickDrawRect(6F, 0.5F, 7F, 3F);
+
+ glEndList();
+
+ glNewList(DISPLAY_LISTS_2D[1], GL_COMPILE);
+
+ quickDrawRect(-7F, 3F, -4F, 3.3F);
+ quickDrawRect(4F, 3F, 7F, 3.3F);
+ quickDrawRect(-7.3F, 0.5F, -7F, 3.3F);
+ quickDrawRect(7F, 0.5F, 7.3F, 3.3F);
+
+ glEndList();
+
+ glNewList(DISPLAY_LISTS_2D[2], GL_COMPILE);
+
+ quickDrawRect(4F, -20F, 7F, -19F);
+ quickDrawRect(-7F, -20F, -4F, -19F);
+ quickDrawRect(6F, -20F, 7F, -17.5F);
+ quickDrawRect(-7F, -20F, -6F, -17.5F);
+
+ glEndList();
+
+ glNewList(DISPLAY_LISTS_2D[3], GL_COMPILE);
+
+ quickDrawRect(7F, -20F, 7.3F, -17.5F);
+ quickDrawRect(-7.3F, -20F, -7F, -17.5F);
+ quickDrawRect(4F, -20.3F, 7.3F, -20F);
+ quickDrawRect(-7.3F, -20.3F, -4F, -20F);
+
+ glEndList();
+ }
+
+ public static void drawBlockBox(final BlockPos blockPos, final Color color, final boolean outline, float partialTicks) {
+ final RenderManager renderManager = mc.getRenderManager();
+
+ final double x = blockPos.getX() - renderManager.viewerPosX;
+ final double y = blockPos.getY() - renderManager.viewerPosY;
+ final double z = blockPos.getZ() - renderManager.viewerPosZ;
+
+ AxisAlignedBB axisAlignedBB = new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0);
+ final Block block = mc.theWorld.getBlockState(blockPos).getBlock();
+
+ if (block != null) {
+ final EntityPlayer player = mc.thePlayer;
+
+ final double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
+ final double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
+ final double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
+
+ block.setBlockBoundsBasedOnState(mc.theWorld, blockPos);
+
+ axisAlignedBB = block.getSelectedBoundingBox(mc.theWorld, blockPos)
+ .expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D)
+ .offset(-posX, -posY, -posZ);
+ }
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ enableGlCap(GL_BLEND);
+ disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
+ glDepthMask(false);
+
+ glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : outline ? 26 : 35);
+ drawFilledBox(axisAlignedBB);
+
+ if (outline) {
+ glLineWidth(1F);
+ enableGlCap(GL_LINE_SMOOTH);
+ glColor(color);
+
+ drawSelectionBoundingBox(axisAlignedBB);
+ }
+
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ glDepthMask(true);
+ resetCaps();
+ }
+
+ public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) {
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+
+ worldrenderer.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
+
+ // Lower Rectangle
+ worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
+ worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
+ worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
+
+ // Upper Rectangle
+ worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
+ worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
+ worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
+
+ // Upper Rectangle
+ worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
+
+ worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
+
+ worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
+ worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
+
+ tessellator.draw();
+ }
+
+ public static void drawEntityBox(final Entity entity, final Color color, final boolean outline, float partialTicks) {
+ final RenderManager renderManager = mc.getRenderManager();
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ enableGlCap(GL_BLEND);
+ disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST);
+ glDepthMask(false);
+
+ final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks
+ - renderManager.viewerPosX;
+ final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks
+ - renderManager.viewerPosY;
+ final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks
+ - renderManager.viewerPosZ;
+
+ final AxisAlignedBB entityBox = entity.getEntityBoundingBox();
+ final AxisAlignedBB axisAlignedBB = new AxisAlignedBB(
+ entityBox.minX - entity.posX + x - 0.05D,
+ entityBox.minY - entity.posY + y,
+ entityBox.minZ - entity.posZ + z - 0.05D,
+ entityBox.maxX - entity.posX + x + 0.05D,
+ entityBox.maxY - entity.posY + y + 0.15D,
+ entityBox.maxZ - entity.posZ + z + 0.05D
+ );
+
+ if (outline) {
+ glLineWidth(1F);
+ enableGlCap(GL_LINE_SMOOTH);
+ glColor(color.getRed(), color.getGreen(), color.getBlue(), 95);
+ drawSelectionBoundingBox(axisAlignedBB);
+ }
+
+ glColor(color.getRed(), color.getGreen(), color.getBlue(), outline ? 26 : 35);
+ drawFilledBox(axisAlignedBB);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ glDepthMask(true);
+ resetCaps();
+ }
+
+ public static void drawAxisAlignedBB(final AxisAlignedBB axisAlignedBB, final Color color) {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glLineWidth(2F);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_DEPTH_TEST);
+ glDepthMask(false);
+ glColor(color);
+ drawFilledBox(axisAlignedBB);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(true);
+ glDisable(GL_BLEND);
+ }
+
+ public static void drawPlatform(final double y, final Color color, final double size) {
+ final RenderManager renderManager = mc.getRenderManager();
+ final double renderY = y - renderManager.viewerPosY;
+
+ drawAxisAlignedBB(new AxisAlignedBB(size, renderY + 0.02D, size, -size, renderY, -size), color);
+ }
+
+ public static void drawPlatform(final Entity entity, final Color color, float partialTicks) {
+ final RenderManager renderManager = mc.getRenderManager();
+
+ final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks
+ - renderManager.viewerPosX;
+ final double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks
+ - renderManager.viewerPosY;
+ final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks
+ - renderManager.viewerPosZ;
+
+ final AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox()
+ .offset(-entity.posX, -entity.posY, -entity.posZ)
+ .offset(x, y, z);
+
+ drawAxisAlignedBB(
+ new AxisAlignedBB(axisAlignedBB.minX, axisAlignedBB.maxY + 0.2, axisAlignedBB.minZ, axisAlignedBB.maxX, axisAlignedBB.maxY + 0.26, axisAlignedBB.maxZ),
+ color
+ );
+ }
+
+ public static void drawFilledBox(final AxisAlignedBB axisAlignedBB) {
+ final Tessellator tessellator = Tessellator.getInstance();
+ final WorldRenderer worldRenderer = tessellator.getWorldRenderer();
+
+ worldRenderer.begin(7, DefaultVertexFormats.POSITION);
+
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
+ worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
+ tessellator.draw();
+ }
+
+ public static void quickDrawRect(final float x, final float y, final float x2, final float y2) {
+ glBegin(GL_QUADS);
+
+ glVertex2d(x2, y);
+ glVertex2d(x, y);
+ glVertex2d(x, y2);
+ glVertex2d(x2, y2);
+
+ glEnd();
+ }
+
+ public static void drawRect(final float x, final float y, final float x2, final float y2, final int color) {
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor(color);
+ glBegin(GL_QUADS);
+
+ glVertex2f(x2, y);
+ glVertex2f(x, y);
+ glVertex2f(x, y2);
+ glVertex2f(x2, y2);
+ glEnd();
+
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH);
+ }
+
+ public static void drawRect(final int x, final int y, final int x2, final int y2, final int color) {
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor(color);
+ glBegin(GL_QUADS);
+
+ glVertex2i(x2, y);
+ glVertex2i(x, y);
+ glVertex2i(x, y2);
+ glVertex2i(x2, y2);
+ glEnd();
+
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH);
+ }
+
+ /**
+ * Like {@link #drawRect(float, float, float, float, int)}, but without setup
+ */
+ public static void quickDrawRect(final float x, final float y, final float x2, final float y2, final int color) {
+ glColor(color);
+ glBegin(GL_QUADS);
+
+ glVertex2d(x2, y);
+ glVertex2d(x, y);
+ glVertex2d(x, y2);
+ glVertex2d(x2, y2);
+
+ glEnd();
+ }
+
+ public static void drawRect(final float x, final float y, final float x2, final float y2, final Color color) {
+ drawRect(x, y, x2, y2, color.getRGB());
+ }
+
+ public static void drawBorderedRect(final float x, final float y, final float x2, final float y2, final float width,
+ final int color1, final int color2) {
+ drawRect(x, y, x2, y2, color2);
+ drawBorder(x, y, x2, y2, width, color1);
+ }
+
+ public static void drawBorder(float x, float y, float x2, float y2, float width, int color1) {
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor(color1);
+ glLineWidth(width);
+
+ glBegin(GL_LINE_LOOP);
+
+ glVertex2d(x2, y);
+ glVertex2d(x, y);
+ glVertex2d(x, y2);
+ glVertex2d(x2, y2);
+
+ glEnd();
+
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH);
+ }
+
+ public static void quickDrawBorderedRect(final float x, final float y, final float x2, final float y2, final float width, final int color1, final int color2) {
+ quickDrawRect(x, y, x2, y2, color2);
+
+ glColor(color1);
+ glLineWidth(width);
+
+ glBegin(GL_LINE_LOOP);
+
+ glVertex2d(x2, y);
+ glVertex2d(x, y);
+ glVertex2d(x, y2);
+ glVertex2d(x2, y2);
+
+ glEnd();
+ }
+
+ public static void drawLoadingCircle(float x, float y) {
+ for (int i = 0; i < 4; i++) {
+ int rot = (int) ((System.nanoTime() / 5000000 * i) % 360);
+ drawCircle(x, y, i * 10, rot - 180, rot);
+ }
+ }
+
+ public static void drawCircle(float x, float y, float radius, int start, int end) {
+ GlStateManager.enableBlend();
+ GlStateManager.disableTexture2D();
+ GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
+ glColor(Color.WHITE);
+
+ glEnable(GL_LINE_SMOOTH);
+ glLineWidth(2F);
+ glBegin(GL_LINE_STRIP);
+ for (float i = end; i >= start; i -= (360 / 90.0f)) {
+ glVertex2f((float) (x + (cos(i * PI / 180) * (radius * 1.001F))), (float) (y + (sin(i * PI / 180) * (radius * 1.001F))));
+ }
+ glEnd();
+ glDisable(GL_LINE_SMOOTH);
+
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+
+ public static void drawFilledCircle(final int xx, final int yy, final float radius, final Color color) {
+ int sections = 50;
+ double dAngle = 2 * Math.PI / sections;
+ float x, y;
+
+ glPushAttrib(GL_ENABLE_BIT);
+
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_LINE_SMOOTH);
+ glBegin(GL_TRIANGLE_FAN);
+
+ for (int i = 0; i < sections; i++) {
+ x = (float) (radius * Math.sin((i * dAngle)));
+ y = (float) (radius * Math.cos((i * dAngle)));
+
+ glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F);
+ glVertex2f(xx + x, yy + y);
+ }
+
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ glEnd();
+
+ glPopAttrib();
+ }
+
+ public static void drawImage(ResourceLocation image, int x, int y, int width, int height) {
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glDepthMask(false);
+ GL14.glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
+ glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ mc.getTextureManager().bindTexture(image);
+ drawModalRectWithCustomSizedTexture(x, y, 0, 0, width, height, width, height);
+ glDepthMask(true);
+ glDisable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+ }
+
+ /**
+ * Draws a textured rectangle at z = 0. Args: x, y, u, v, width, height, textureWidth, textureHeight
+ */
+ public static void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight) {
+ float f = 1.0F / textureWidth;
+ float f1 = 1.0F / textureHeight;
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION);
+ worldrenderer.pos(x, y + height, 0.0D).tex(u * f, (v + height) * f1).endVertex();
+ worldrenderer.pos(x + width, y + height, 0.0D).tex((u + width) * f, (v + height) * f1).endVertex();
+ worldrenderer.pos(x + width, y, 0.0D).tex((u + width) * f, v * f1).endVertex();
+ worldrenderer.pos(x, y, 0.0D).tex(u * f, v * f1).endVertex();
+ tessellator.draw();
+ }
+
+ public static void glColor(final int red, final int green, final int blue, final int alpha) {
+ GL11.glColor4f(red / 255F, green / 255F, blue / 255F, alpha / 255F);
+ }
+
+ public static void glColor(final Color color) {
+ glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
+ }
+
+ private static void glColor(final int hex) {
+ glColor(hex >> 16 & 0xFF, hex >> 8 & 0xFF, hex & 0xFF, hex >> 24 & 0xFF);
+ }
+
+ public static void draw2D(final EntityLivingBase entity, final double posX, final double posY, final double posZ, final int color, final int backgroundColor) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(posX, posY, posZ);
+ GL11.glRotated(-mc.getRenderManager().viewerPosY, 0F, 1F, 0F);
+ GL11.glScaled(-0.1D, -0.1D, 0.1D);
+
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ GL11.glDepthMask(true);
+
+ glColor(color);
+
+ glCallList(DISPLAY_LISTS_2D[0]);
+
+ glColor(backgroundColor);
+
+ glCallList(DISPLAY_LISTS_2D[1]);
+
+ GL11.glTranslated(0, 21 + -(entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY) * 12, 0);
+
+ glColor(color);
+ glCallList(DISPLAY_LISTS_2D[2]);
+
+ glColor(backgroundColor);
+ glCallList(DISPLAY_LISTS_2D[3]);
+
+ // Stop render
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+
+ GL11.glPopMatrix();
+ }
+
+ public static void draw2D(final BlockPos blockPos, final int color, final int backgroundColor) {
+ final RenderManager renderManager = mc.getRenderManager();
+
+ final double posX = (blockPos.getX() + 0.5) - renderManager.viewerPosX;
+ final double posY = blockPos.getY() - renderManager.viewerPosY;
+ final double posZ = (blockPos.getZ() + 0.5) - renderManager.viewerPosZ;
+
+ GL11.glPushMatrix();
+ GL11.glTranslated(posX, posY, posZ);
+ GL11.glRotated(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
+ GL11.glScaled(-0.1D, -0.1D, 0.1D);
+
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ GL11.glDepthMask(true);
+
+ glColor(color);
+
+ glCallList(DISPLAY_LISTS_2D[0]);
+
+ glColor(backgroundColor);
+
+ glCallList(DISPLAY_LISTS_2D[1]);
+
+ GL11.glTranslated(0, 9, 0);
+
+ glColor(color);
+
+ glCallList(DISPLAY_LISTS_2D[2]);
+
+ glColor(backgroundColor);
+
+ glCallList(DISPLAY_LISTS_2D[3]);
+
+ // Stop render
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+
+ GL11.glPopMatrix();
+ }
+
+ public static void renderNameTag(final String string, final double x, final double y, final double z) {
+ final RenderManager renderManager = mc.getRenderManager();
+
+ glPushMatrix();
+ glTranslated(x - renderManager.viewerPosX, y - renderManager.viewerPosY, z - renderManager.viewerPosZ);
+ glNormal3f(0F, 1F, 0F);
+ glRotatef(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
+ glRotatef(mc.getRenderManager().playerViewX, 1F, 0F, 0F);
+ glScalef(-0.05F, -0.05F, 0.05F);
+ setGlCap(GL_LIGHTING, false);
+ setGlCap(GL_DEPTH_TEST, false);
+ setGlCap(GL_BLEND, true);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ final int width = mc.fontRendererObj.getStringWidth(string) / 2;
+
+ drawRect(-width - 1, -1, width + 1, mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE);
+ mc.fontRendererObj.drawString(string, -width, 1.5F, Color.WHITE.getRGB(), true);
+
+ resetCaps();
+ glColor4f(1F, 1F, 1F, 1F);
+ glPopMatrix();
+ }
+
+ public static void drawLine(final double x, final double y, final double x1, final double y1, final float width) {
+ glDisable(GL_TEXTURE_2D);
+ glLineWidth(width);
+ glBegin(GL_LINES);
+ glVertex2d(x, y);
+ glVertex2d(x1, y1);
+ glEnd();
+ glEnable(GL_TEXTURE_2D);
+ }
+
+ public static void makeScissorBox(final float x, final float y, final float x2, final float y2) {
+ final ScaledResolution scaledResolution = new ScaledResolution(mc);
+ final int factor = scaledResolution.getScaleFactor();
+ glScissor((int) (x * factor), (int) ((scaledResolution.getScaledHeight() - y2) * factor), (int) ((x2 - x) * factor), (int) ((y2 - y) * factor));
+ }
+
+ /**
+ * GL CAP MANAGER
+ * <p>
+ * TODO: Remove gl cap manager and replace by something better
+ */
+
+ public static void resetCaps() {
+ glCapMap.forEach(RenderUtils::setGlState);
+ }
+
+ public static void enableGlCap(final int cap) {
+ setGlCap(cap, true);
+ }
+
+ public static void enableGlCap(final int... caps) {
+ for (final int cap : caps)
+ setGlCap(cap, true);
+ }
+
+ public static void disableGlCap(final int cap) {
+ setGlCap(cap, true);
+ }
+
+ public static void disableGlCap(final int... caps) {
+ for (final int cap : caps)
+ setGlCap(cap, false);
+ }
+
+ public static void setGlCap(final int cap, final boolean state) {
+ glCapMap.put(cap, glGetBoolean(cap));
+ setGlState(cap, state);
+ }
+
+ public static void setGlState(final int cap, final boolean state) {
+ if (state)
+ glEnable(cap);
+ else
+ glDisable(cap);
+ }
+
+ public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) {
+ float f = 1.0F / tileWidth;
+ float f1 = 1.0F / tileHeight;
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION);
+ worldrenderer.pos(x, y + height, 0.0D).tex(u * f, (v + (float) vHeight) * f1).endVertex();
+ worldrenderer.pos(x + width, y + height, 0.0D).tex((u + (float) uWidth) * f, (v + (float) vHeight) * f1).endVertex();
+ worldrenderer.pos(x + width, y, 0.0D).tex((u + (float) uWidth) * f, v * f1).endVertex();
+ worldrenderer.pos(x, y, 0.0D).tex(u * f, v * f1).endVertex();
+ tessellator.draw();
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/rosegoldaddons/utils/RotationUtils.java b/src/main/java/rosegoldaddons/utils/RotationUtils.java
new file mode 100644
index 0000000..fb4152a
--- /dev/null
+++ b/src/main/java/rosegoldaddons/utils/RotationUtils.java
@@ -0,0 +1,110 @@
+package rosegoldaddons.utils;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.monster.EntityCreeper;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.Vec3;
+import rosegoldaddons.Main;
+
+import java.security.Key;
+
+public class RotationUtils {
+ static boolean working = false;
+ static boolean snek = false;
+ static boolean antiafking = false;
+
+ public static void antiAfk() {
+ if(snek || Minecraft.getMinecraft().currentScreen != null) return;
+ KeyBinding right = Minecraft.getMinecraft().gameSettings.keyBindRight;
+ KeyBinding left = Minecraft.getMinecraft().gameSettings.keyBindLeft;
+ new Thread(() -> {
+ try {
+ KeyBinding.setKeyBindState(right.getKeyCode(), true);
+ Thread.sleep(50);
+ KeyBinding.setKeyBindState(right.getKeyCode(), false);
+ Thread.sleep(200);
+ KeyBinding.setKeyBindState(left.getKeyCode(), true);
+ Thread.sleep(50);
+ KeyBinding.setKeyBindState(left.getKeyCode(), false);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ public static void shootEman() {
+ if(snek || Minecraft.getMinecraft().currentScreen != null) return;
+ new Thread(() -> {
+ try {
+ snek = true;
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true);
+ Thread.sleep(100);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false);
+ Thread.sleep(100);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true);
+ Thread.sleep(100);
+ KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false);
+ snek = false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ public static void facePos(Vec3 vector) {
+ if(working || Minecraft.getMinecraft().currentScreen != null) return;
+ new Thread(() -> {
+ try {
+ working = true;
+ double diffX = vector.xCoord - (Minecraft.getMinecraft()).thePlayer.posX;
+ double diffY = vector.yCoord - (Minecraft.getMinecraft()).thePlayer.posY;
+ double diffZ = vector.zCoord - (Minecraft.getMinecraft()).thePlayer.posZ;
+ double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
+
+ float pitch = (float) -Math.atan2(dist, diffY);
+ float yaw = (float) Math.atan2(diffZ, diffX);
+ pitch = (float) wrapAngleTo180((pitch * 180F / Math.PI + 90)*-1 - Minecraft.getMinecraft().thePlayer.rotationPitch);
+ yaw = (float) wrapAngleTo180((yaw * 180 / Math.PI) - 90 - Minecraft.getMinecraft().thePlayer.rotationYaw);
+
+ for(int i = 0; i < Main.configFile.smoothLookVelocity; i++) {
+ Minecraft.getMinecraft().thePlayer.rotationYaw += yaw/Main.configFile.smoothLookVelocity;
+ Minecraft.getMinecraft().thePlayer.rotationPitch += pitch/Main.configFile.smoothLookVelocity;
+ Thread.sleep(1);
+ }
+ working = false;
+ if(Main.endermanMacro) {
+ shootEman();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ public static void faceEntity(Entity en) {
+ if(en instanceof EntityCreeper) {
+ facePos(new Vec3(en.posX, en.posY-1.5, en.posZ));
+ } else {
+ facePos(new Vec3(en.posX, en.posY, en.posZ));
+ }
+ }
+
+ public static void faceEntity2(Entity en) {
+ facePos(new Vec3(en.posX, en.posY + en.getEyeHeight() - en.height / 1.5D, en.posZ));
+ }
+
+ private static double wrapAngleTo180(double angle) {
+ angle %= 360;
+ while (angle >= 180) {
+ angle -= 360;
+ }
+ while (angle < -180) {
+ angle += 360;
+ }
+ return angle;
+ }
+
+}