From 20894963147ef84a7ad7d578191de69a856f6403 Mon Sep 17 00:00:00 2001 From: RoseGoldIsntGay Date: Fri, 4 Feb 2022 14:17:32 +0200 Subject: 2.7.1 --- src/main/java/rosegoldaddons/Config.java | 42 +++++- src/main/java/rosegoldaddons/Main.java | 148 +++++++++++---------- src/main/java/rosegoldaddons/OpenSettings.java | 3 - .../rosegoldaddons/features/AutoGhostBlock.java | 143 ++++++++++++++++++++ .../java/rosegoldaddons/features/CanePlanter.java | 78 ----------- .../rosegoldaddons/features/CustomItemMacro.java | 6 +- .../rosegoldaddons/features/EndermanMacro.java | 22 ++- .../java/rosegoldaddons/features/EntityReach.java | 1 + .../features/ForagingIslandMacro.java | 23 ++-- .../java/rosegoldaddons/features/GemstoneAura.java | 19 +-- .../rosegoldaddons/features/HardstoneAura.java | 77 ++++++++--- .../java/rosegoldaddons/features/MithrilMacro.java | 34 +++-- .../java/rosegoldaddons/features/MithrilNuker.java | 10 +- .../java/rosegoldaddons/features/PowderMacro.java | 8 +- src/main/java/rosegoldaddons/features/SexAura.java | 20 --- .../rosegoldaddons/mixins/MixinRenderString.java | 90 +++++++++++-- .../mixins/MixinRendererLivingEntity.java | 53 +++++++- .../java/rosegoldaddons/utils/RotationUtils.java | 115 ---------------- .../java/rosegoldaddons/utils/ScoreboardUtils.java | 22 +++ .../java/rosegoldaddons/utils/ShadyRotation.java | 118 ++++++++++++++++ 20 files changed, 658 insertions(+), 374 deletions(-) create mode 100644 src/main/java/rosegoldaddons/features/AutoGhostBlock.java delete mode 100644 src/main/java/rosegoldaddons/features/CanePlanter.java create mode 100644 src/main/java/rosegoldaddons/utils/ShadyRotation.java (limited to 'src/main/java') diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index f3394e1..2886ec2 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -13,7 +13,23 @@ public class Config extends Vigilant { @Property(type = PropertyType.SWITCH, name = "Auto Start Dungeon + Ready", description = "Automatically starts the dungeon and gets ready.", category = "Dungeons", subcategory = "General") - public boolean AutoReady = true; + public boolean AutoReady = false; + + @Property(type = PropertyType.SELECTOR, name = "Auto Ghost Block", description = "Choose which mode auto ghost block will follow", + category = "Dungeons", subcategory = "General", options = {"While Held", "On Press"}) + public int ghostIndex = 0; + + @Property(type = PropertyType.SWITCH, name = "Auto Ghost Block Stairs", description = "Automatically ghost block stairs you are standing on when you sneak", + category = "Dungeons", subcategory = "General") + public boolean AutoGB = false; + + @Property(type = PropertyType.SWITCH, name = "Add Flipped Stairs", description = "Ghost Block upside-down stair when jumped into", + category = "Dungeons", subcategory = "General") + public boolean AutoGBTopStair = false; + + @Property(type = PropertyType.SWITCH, name = "Add Misc. Blocks", description = "Adds other phase-able blocks to Auto Ghost Block", + category = "Dungeons", subcategory = "General") + public boolean AutoGBMisc = false; public boolean autoArrowAlign = true; @@ -41,9 +57,9 @@ public class Config extends Vigilant { category = "RoseGoldAddons", subcategory = "General", max = 2000) public int swapFrequency = 500; - @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 = "Smooth Look Velocity", description = "How fast should head rotation changes be (in ticks)", + category = "RoseGoldAddons", subcategory = "General", min = 1, max = 40) + public int smoothLookVelocity = 5; @Property(type = PropertyType.SLIDER, name = "Macro Range", description = "Look for entities only in radius of the player, 0 = unlimited", category = "RoseGoldAddons", subcategory = "General", max = 300) @@ -75,7 +91,7 @@ public class Config extends Vigilant { @Property(type = PropertyType.SWITCH, name = "Radomize Delay", description = "Add slight randomization to delay", category = "Foraging", subcategory = "General") - public boolean randomizeForaging = true; + public boolean randomizeForaging = false; @Property(type = PropertyType.SWITCH, name = "Admin Antisus", description = "Act as if you're there when you get AFK checked (not recommended to leave on)", category = "Foraging", subcategory = "General") @@ -86,9 +102,13 @@ public class Config extends Vigilant { public boolean prioblocks = false; @Property(type = PropertyType.SLIDER, name = "Hardstone Nuker Height", description = "Range to break above the player", - category = "Mining", subcategory = "General", max = 5) + category = "Mining", subcategory = "General",max = 5) public int hardrange = 0; + @Property(type = PropertyType.SLIDER, name = "Hardstone Nuker Depth", description = "Range to break below the player", + category = "Mining", subcategory = "General",max = 3) + public int hardrangeDown = 0; + @Property(type = PropertyType.SELECTOR, name = "Hardstone Nuker Shape", description = "Choose which pattern hardstone nuker will follow", category = "Mining", subcategory = "General", options = {"Closest Block", "Facing Axis"}) public int hardIndex = 0; @@ -125,10 +145,18 @@ public class Config extends Vigilant { category = "Mining", subcategory = "General") public boolean ignoreTitanium = false; - @Property(type = PropertyType.SWITCH, name = "Include Ores", description = "Hardstone & Mithril Nukers will also nuke ores", + @Property(type = PropertyType.SWITCH, name = "Include Ores", description = "Hardstone Nuker, Mithril Nuker and Mithril Macro will also target ores", category = "Mining", subcategory = "General") public boolean includeOres = false; + @Property(type = PropertyType.SWITCH, name = "Include Sand & Gravel", description = "Hardstone Nuker will also target sand and gravel", + category = "Mining", subcategory = "General") + public boolean includeExcavatable = false; + + @Property(type = PropertyType.SWITCH, name = "Only Ores", description = "Mithril Macro will only target ores", + category = "Mining", subcategory = "General") + public boolean onlyOres = false; + @Property(type = PropertyType.SELECTOR, name = "Mithril Macro Priority", description = "Determine the order the macro will breaks blocks in", category = "Mining", subcategory = "General", options = {"Highest value to lowest", "Lowest value to highest","Any"}) public int mithrilMacroPrio = 0; diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index 120e944..def14cd 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -1,6 +1,8 @@ package rosegoldaddons; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonParser; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -20,24 +22,17 @@ 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.*; -import rosegoldaddons.utils.ChatUtils; -import rosegoldaddons.utils.OpenSkyblockGui; -import rosegoldaddons.utils.PlayerUtils; -import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.*; import java.io.*; import java.net.URL; import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Base64; -import java.util.HashMap; -import java.util.Objects; -import java.util.Random; +import java.util.*; @Mod(modid = "timechanger", name = "RoseGoldAddons", version = "2.1") public class Main { @@ -64,14 +59,20 @@ public class Main { private static boolean oldanim = false; public static boolean init = false; public static boolean mithrilMacro = false; + private boolean issue = false; public static final Minecraft mc = Minecraft.getMinecraft(); + public static JsonObject rga; - //Hello decompiler and / or source code checker! this is just some funny stuff, you do not have to worry about it! + String info = "Hello decompiler! this is just some funny stuff, you do not have to worry about it!"; private String[] cumsters = null; private String[] ILILILLILILLILILILL = null; - public static HashMap resp = new HashMap<>(); + public static HashMap nameCache = new HashMap<>(); + public static HashMap rankCache = new HashMap<>(); + public static ArrayList hashedCache = new ArrayList<>(); + public static HashMap names = new HashMap<>(); + public static HashMap ranks = new HashMap<>(); @Mod.EventHandler public void onFMLInitialization(FMLPreInitializationEvent event) { @@ -79,10 +80,18 @@ public class Main { if (!directory.exists()) { directory.mkdirs(); } + + try { + rga = getJson("https://gist.githubusercontent.com/RoseGoldIsntGay/2d15ef10d53629455a40f5c027db1dfb/raw/").getAsJsonObject(); + } catch (Exception e) { + e.printStackTrace(); + issue = true; + } } @Mod.EventHandler public void init(FMLInitializationEvent event) { + if (issue) return; MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new AutoReady()); MinecraftForge.EVENT_BUS.register(new OpenSkyblockGui()); @@ -107,11 +116,11 @@ public class Main { MinecraftForge.EVENT_BUS.register(new ForagingNuker()); MinecraftForge.EVENT_BUS.register(new AutoSlayer()); MinecraftForge.EVENT_BUS.register(new PlayerUtils()); - MinecraftForge.EVENT_BUS.register(new CanePlanter()); MinecraftForge.EVENT_BUS.register(new ArmorStandESPs()); MinecraftForge.EVENT_BUS.register(new PinglessMining()); MinecraftForge.EVENT_BUS.register(new MithrilMacro()); - MinecraftForge.EVENT_BUS.register(new RotationUtils()); + MinecraftForge.EVENT_BUS.register(new AutoGhostBlock()); + MinecraftForge.EVENT_BUS.register(new ShadyRotation()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -122,22 +131,42 @@ public class Main { ClientCommandHandler.instance.registerCommand(new AllEntities()); ClientCommandHandler.instance.registerCommand(new SexPlayer()); - String[] temp = getUrlContents("https://gist.github.com/RoseGoldIsntGay/6fa79111ae8efe3f5d269a095d748aa5/raw").split("\n"); - for(String str : temp) { - if(str.contains(":")) { - resp.put(str.substring(0, str.indexOf(":")), str.substring(str.indexOf(": ") + 2).replace("&", "§")); - } else { - System.out.println(str); - } + JsonArray funnynames = rga.get("funnynames").getAsJsonArray(); + cumsters = new String[funnynames.size()]; + Iterator fn = funnynames.iterator(); + int count = 0; + while(fn.hasNext()) { + JsonElement name = fn.next(); + cumsters[count] = name.getAsString(); + count++; } - init = true; - - cumsters = getUrlContents("https://gist.githubusercontent.com/RoseGoldIsntGay/14108940b5c97d01de20213e567b7b9c/raw/").split("\n"); - ILILILLILILLILILILL = getUrlContents("https://gist.githubusercontent.com/RoseGoldIsntGay/2534fa591573120a5f71bbca2ccf0af2/raw/").split("\n"); - for(String str : ILILILLILILLILILILL) { - System.out.println(str); + JsonArray funnymessages = rga.get("funnymessages").getAsJsonArray(); + ILILILLILILLILILILL = new String[funnymessages.size()]; + Iterator fm = funnymessages.iterator(); + count = 0; + while(fm.hasNext()) { + JsonElement message = fm.next(); + ILILILLILILLILILILL[count] = message.getAsString(); + count++; } + JsonObject replacions = rga.get("replacions").getAsJsonObject(); + Set> set = replacions.entrySet(); + + set.forEach(stringJsonElementEntry -> { + names.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + }); + + replacions = rga.get("ranks").getAsJsonObject(); + set = replacions.entrySet(); + + set.forEach(stringJsonElementEntry -> { + ranks.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + }); + init = true; + try { Reader reader = Files.newBufferedReader(Paths.get("./config/rosegoldaddons/rcmacros.json")); int data = reader.read(); @@ -146,9 +175,7 @@ public class Main { str += (char) data; data = reader.read(); } - str = str.replace("\"",""); - str = str.replace("{",""); - str = str.replace("}",""); + str = str.replace("\"","").replace("{","").replace("}",""); String[] arr = str.split(","); for(int i = 0; i < arr.length; i++) { String[] arr2 = arr[i].split(":"); @@ -163,9 +190,7 @@ public class Main { str2 += (char) data2; data2 = reader.read(); } - str2 = str2.replace("\"",""); - str2 = str2.replace("{",""); - str2 = str2.replace("}",""); + str2 = str2.replace("\"","").replace("{","").replace("}",""); String[] arr3 = str2.split(","); for(int i = 0; i < arr3.length; i++) { String[] arr4 = arr3[i].split(":"); @@ -211,58 +236,41 @@ public class Main { }); } - - @SubscribeEvent - public void onConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { - if(firstLoginThisSession) { - new Thread(() -> { - try { - Thread.sleep(4000); - ChatComponentText msg1 = new ChatComponentText("§0§7Thanks to ShadyAddons:§b https://cheatersgetbanned.me"); - msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://cheatersgetbanned.me")); - ChatComponentText msg2 = new ChatComponentText("§0§7Thanks to Harry282 (SBClient):§b https://github.com/Harry282/Skyblock-Client"); - msg2.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/Harry282/Skyblock-Client")); - ChatComponentText msg3 = new ChatComponentText("§0§7Thanks to pizza boy (Pizza Client):§b https://github.com/PizzaboiBestLegit/Pizza-Client"); - msg3.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/PizzaboiBestLegit/Pizza-Client")); - ChatComponentText msg4 = new ChatComponentText("§0§7Check out the RoseGoldAddons §bDiscord Server!"); - msg4.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://discord.gg/Tmk2hwzdxm")); - mc.thePlayer.addChatMessage(msg1); - mc.thePlayer.addChatMessage(msg2); - mc.thePlayer.addChatMessage(msg3); - mc.thePlayer.addChatMessage(msg4); - firstLoginThisSession = false; - } catch (Exception e) { - e.printStackTrace(); - } - }).start(); - } - if(oldanim) { - new Thread(() -> { - try { - Thread.sleep(6000); - ChatUtils.sendMessage("§l§4Old Animations Mod was detected in your mods folder. This mod breaks some key RoseGoldAddons features, please uninstall it before asking for support as it is known to cause a lot of issues. Thanks."); - } catch (Exception e) { - e.printStackTrace(); - } - }).start(); - } - } - @SubscribeEvent public void onWorldChange(WorldEvent.Unload event) { - if(forageOnIsland || nukeWood || nukeCrops || mithrilNuker || gemNukeToggle) { + if(forageOnIsland || nukeWood || nukeCrops || mithrilNuker || gemNukeToggle || mithrilMacro) { ChatUtils.sendMessage("§cDetected World Change, Stopping All Macros"); forageOnIsland = false; nukeWood = false; nukeCrops = false; mithrilNuker = false; gemNukeToggle = false; + mithrilMacro = false; } } @SubscribeEvent public void tick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.START) return; + if(mc.thePlayer == null || mc.theWorld == null) return; + if(firstLoginThisSession) { + ChatComponentText msg1 = new ChatComponentText("§0§7Thanks to ShadyAddons:§b https://cheatersgetbanned.me"); + msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://cheatersgetbanned.me")); + ChatComponentText msg2 = new ChatComponentText("§0§7Thanks to Harry282 (SBClient):§b https://github.com/Harry282/Skyblock-Client"); + msg2.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/Harry282/Skyblock-Client")); + ChatComponentText msg3 = new ChatComponentText("§0§7Thanks to pizza boy (Pizza Client):§b https://github.com/PizzaboiBestLegit/Pizza-Client"); + msg3.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/PizzaboiBestLegit/Pizza-Client")); + ChatComponentText msg4 = new ChatComponentText("§0§7Check out the RoseGoldAddons §bDiscord Server!"); + msg4.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://discord.gg/Tmk2hwzdxm")); + mc.thePlayer.addChatMessage(msg1); + mc.thePlayer.addChatMessage(msg2); + mc.thePlayer.addChatMessage(msg3); + mc.thePlayer.addChatMessage(msg4); + if(oldanim) { + ChatUtils.sendMessage("§l§4Old Animations Mod was detected in your mods folder. This mod breaks some key RoseGoldAddons features, please uninstall it before asking for support as it is known to cause a lot of issues. Thanks."); + } + firstLoginThisSession = false; + } if(mc.gameSettings.limitFramerate == 1) { mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 260.0F); } diff --git a/src/main/java/rosegoldaddons/OpenSettings.java b/src/main/java/rosegoldaddons/OpenSettings.java index 0e79b74..73a562d 100644 --- a/src/main/java/rosegoldaddons/OpenSettings.java +++ b/src/main/java/rosegoldaddons/OpenSettings.java @@ -28,10 +28,7 @@ public class OpenSettings implements ICommand { @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 diff --git a/src/main/java/rosegoldaddons/features/AutoGhostBlock.java b/src/main/java/rosegoldaddons/features/AutoGhostBlock.java new file mode 100644 index 0000000..76ca185 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoGhostBlock.java @@ -0,0 +1,143 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.BlockState; +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.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +public class AutoGhostBlock { + private final KeyBinding sneakBind = Minecraft.getMinecraft().gameSettings.keyBindSneak; + private final KeyBinding jumpBind = Minecraft.getMinecraft().gameSettings.keyBindJump; + + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(Main.configFile.ghostIndex == 0) { + if (!Main.configFile.AutoGB || !Main.configFile.AutoGBTopStair) return; + if (sneakBind.isKeyDown() && Main.configFile.AutoGB) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 1, 3); + Vec3i vec3i2 = new Vec3i(3, 2, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if (diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if (isStair(blockState) && diffY == -0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + if (Main.configFile.AutoGBMisc) { + if (blockState.getBlock() == Blocks.skull && diffY == 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } else if (blockState.getBlock() == Blocks.hopper && diffY == -0.625) { + Main.mc.theWorld.setBlockToAir(blockPos); + } else if (isFence(blockState) && diffY <= 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + } + if(jumpBind.isKeyDown() && Main.configFile.AutoGBTopStair) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 2, 3); + Vec3i vec3i2 = new Vec3i(3, 0, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY > 1.2 && diffY < 1.3) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + + @SubscribeEvent + public void onKeyPress(InputEvent.KeyInputEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(Main.configFile.ghostIndex == 0) return; + if(!Main.configFile.AutoGB || !Main.configFile.AutoGBTopStair) return; + if(sneakBind.isPressed() && Main.configFile.AutoGB) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 1, 3); + Vec3i vec3i2 = new Vec3i(3, 2, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY == -0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + if(Main.configFile.AutoGBMisc) { + if(blockState.getBlock() == Blocks.skull && diffY == 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + else if(blockState.getBlock() == Blocks.hopper && diffY == -0.625) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + else if(isFence(blockState) && diffY <= 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + if(jumpBind.isPressed() && Main.configFile.AutoGBTopStair) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 2, 3); + Vec3i vec3i2 = new Vec3i(3, 0, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY > 1.2 && diffY < 1.3) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + + private boolean isStair(IBlockState blockState) { + if(blockState.getBlock() == Blocks.acacia_stairs || blockState.getBlock() == Blocks.birch_stairs || + blockState.getBlock() == Blocks.brick_stairs || blockState.getBlock() == Blocks.stone_brick_stairs || + blockState.getBlock() == Blocks.stone_stairs || blockState.getBlock() == Blocks.dark_oak_stairs || + blockState.getBlock() == Blocks.jungle_stairs || blockState.getBlock() == Blocks.spruce_stairs || + blockState.getBlock() == Blocks.red_sandstone_stairs || blockState.getBlock() == Blocks.sandstone_stairs || + blockState.getBlock() == Blocks.nether_brick_stairs || blockState.getBlock() == Blocks.oak_stairs || + blockState.getBlock() == Blocks.quartz_stairs) + return true; + return false; + } + + private boolean isFence(IBlockState blockState) { + if(blockState.getBlock() == Blocks.acacia_fence || blockState.getBlock() == Blocks.birch_fence || + blockState.getBlock() == Blocks.cobblestone_wall || blockState.getBlock() == Blocks.dark_oak_fence || + blockState.getBlock() == Blocks.jungle_fence || blockState.getBlock() == Blocks.spruce_fence || + blockState.getBlock() == Blocks.oak_fence || blockState.getBlock() == Blocks.nether_brick_fence) + return true; + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java deleted file mode 100644 index 5f656d9..0000000 --- a/src/main/java/rosegoldaddons/features/CanePlanter.java +++ /dev/null @@ -1,78 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; -import net.minecraft.util.Vec3i; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import rosegoldaddons.Main; - -import java.util.ArrayList; - -public class CanePlanter { - //when you're down bad - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.placeCane || event.phase == TickEvent.Phase.END) { - return; - } - int cane = findItemInHotbar("Cane"); - BlockPos dirt = furthestEmptyDirt(); - if (cane != -1 && dirt != null) { - ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(cane); - Main.mc.thePlayer.inventory.currentItem = cane; - Main.mc.playerController.onPlayerRightClick(Main.mc.thePlayer, Main.mc.theWorld, item, dirt, EnumFacing.UP, Main.mc.thePlayer.getLookVec()); - } - } - - private BlockPos furthestEmptyDirt() { - int r = 5; - BlockPos playerPos = Main.mc.thePlayer.getPosition(); - playerPos.add(0, 1, 0); - Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); - Vec3i vec3i = new Vec3i(r, r, r); - ArrayList dirts = new ArrayList(); - if (playerPos != null) { - for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - IBlockState blockState2 = Main.mc.theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); - if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { - dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - } - } - double biggest = -1; - Vec3 furthest = null; - for (int i = 0; i < dirts.size(); i++) { - double dist = dirts.get(i).distanceTo(playerVec); - if (dist > biggest) { - biggest = dist; - furthest = dirts.get(i); - } - } - if (furthest != null && biggest < 4) { - return new BlockPos(furthest.xCoord, furthest.yCoord, furthest.zCoord); - } - return null; - } - - private static int findItemInHotbar(String name) { - InventoryPlayer inv = Main.mc.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/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index b776f86..37b4ce3 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -16,13 +16,16 @@ import java.lang.reflect.Method; public class CustomItemMacro { private Thread thread; private int milis = 0; + private boolean working = false; @SubscribeEvent - public void onRender(RenderWorldLastEvent event) { + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END || working) return; if (!Main.autoUseItems) return; if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { try { + working = true; int prevItem = Main.mc.thePlayer.inventory.currentItem; for (String i : UseCooldown.RCitems.keySet()) { if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { @@ -46,6 +49,7 @@ public class CustomItemMacro { Main.mc.thePlayer.inventory.currentItem = prevItem; milis++; Thread.sleep(100); + working = false; } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index b0ff72a..c0f3c6a 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -1,14 +1,16 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.network.play.client.C0BPacketEntityAction; 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 rosegoldaddons.utils.ShadyRotation; import java.awt.*; @@ -18,9 +20,21 @@ public class EndermanMacro { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; + if(event.phase == TickEvent.Phase.END) return; enderman = getClosestEnderman(); - if(enderman != null && Main.endermanMacro) { - RotationUtils.faceEntity(enderman); + if(enderman != null && Main.endermanMacro && !ShadyRotation.running) { + ShadyRotation.smoothLook(ShadyRotation.getRotationToEntity(enderman), Main.configFile.smoothLookVelocity, () -> { + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); + + if(!Main.mc.thePlayer.movementInput.sneak) { + Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); + Main.mc.thePlayer.movementInput.sneak = true; + } else { + Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); + Main.mc.thePlayer.movementInput.sneak = false; + } + }); } } diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index 21a4691..97a1c09 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -55,6 +55,7 @@ public class EntityReach { @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; if (!Main.configFile.entityReach) return; if (toInteract != null) { Entity stand = getClosestArmorStand(toInteract); diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index e06d7ea..bf37569 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -10,9 +10,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.lang.reflect.Method; import java.util.ArrayList; @@ -24,7 +26,7 @@ public class ForagingIslandMacro { private final String[] responses = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { + public void onTick(TickEvent.ClientTickEvent event) { if (Main.forageOnIsland) { if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { @@ -57,8 +59,8 @@ public class ForagingIslandMacro { return; } if (furthestDirt != null) { - RotationUtils.facePos(new Vec3(furthestDirt.getX() + 0.5, furthestDirt.getY() - 0.5, furthestDirt.getZ() + 0.5)); - Thread.sleep(Main.configFile.smoothLookVelocity * 2L); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(new Vec3(furthestDirt.getX() +0.5, furthestDirt.getY() + 1, furthestDirt.getZ() + 0.5)), Main.configFile.smoothLookVelocity, () -> {}); + Thread.sleep(Main.configFile.smoothLookVelocity * 40L); if (sapling != -1) { if (Main.mc.objectMouseOver.typeOfHit.toString().equals("BLOCK")) { BlockPos pos = Main.mc.objectMouseOver.getBlockPos(); @@ -75,7 +77,8 @@ public class ForagingIslandMacro { } else { BlockPos dirt = closestDirt(); if (dirt != null) { - RotationUtils.facePos(new Vec3(dirt.getX() + 0.5, dirt.getY(), dirt.getZ() + 0.5)); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(new Vec3(dirt.getX() + 0.5, dirt.getY() + 1, dirt.getZ() + 0.5)), Main.configFile.smoothLookVelocity, () -> {}); + Thread.sleep(Main.configFile.smoothLookVelocity * 40L); if (bonemeal != -1 && treecap != -1) { Main.mc.thePlayer.inventory.currentItem = bonemeal; Random rand = new Random(); @@ -84,19 +87,19 @@ public class ForagingIslandMacro { toAdd = rand.nextInt(20); } //ChatUtils.sendMessage("extra delay: "+toAdd+"%"); - Thread.sleep(Math.round(150*(1+(toAdd/100)))); + Thread.sleep(Math.round(150*(1+(toAdd/100F)))); rightClick(); rightClick(); Main.mc.thePlayer.inventory.currentItem = treecap; - Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100F)))); KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), true); - Thread.sleep(Math.round(150*(1+(toAdd/100)))); + Thread.sleep(Math.round(150*(1+(toAdd/100F)))); KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), false); - Thread.sleep(Math.round(25*(1+(toAdd/100)))); + Thread.sleep(Math.round(25*(1+(toAdd/100F)))); Main.mc.thePlayer.inventory.currentItem = rod; - Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100F)))); rightClick(); - Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100F)))); } } } diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index 28f30af..af919f9 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -1,23 +1,16 @@ package rosegoldaddons.features; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.network.play.client.C0APacketAnimation; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; -import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.PlayerUtils; import rosegoldaddons.utils.RenderUtils; @@ -35,8 +28,8 @@ public class GemstoneAura { currentDamage = 0; return; } - if (event.phase == TickEvent.Phase.END) { - if (PlayerUtils.pickaxeAbilityReady && Main.mc.thePlayer != null) { + if (event.phase == TickEvent.Phase.END && Main.mc.theWorld != null && Main.mc.thePlayer != null) { + if (PlayerUtils.pickaxeAbilityReady) { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if (currentDamage > 100) { @@ -109,7 +102,7 @@ public class GemstoneAura { playerPos = playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); - ArrayList chests = new ArrayList(); + ArrayList chests = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); @@ -133,11 +126,11 @@ public class GemstoneAura { } double smallest = 9999; Vec3 closest = null; - for (int i = 0; i < chests.size(); i++) { - double dist = chests.get(i).distanceTo(playerVec); + for (Vec3 chest : chests) { + double dist = chest.distanceTo(playerVec); if (dist < smallest) { smallest = dist; - closest = chests.get(i); + closest = chest; } } if (closest != null && smallest < 5) { diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 8cecae7..4f92056 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -21,10 +21,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; -import rosegoldaddons.utils.ChatUtils; -import rosegoldaddons.utils.PlayerUtils; -import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.*; +import scala.concurrent.impl.CallbackRunnable; import java.awt.*; import java.util.ArrayList; @@ -100,7 +98,7 @@ public class HardstoneAura { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - RotationUtils.facePos(particlePos); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> {}); } } } @@ -176,23 +174,32 @@ public class HardstoneAura { private BlockPos closestStone() { if(Main.mc.theWorld == null) return null; if(Main.mc.thePlayer == null) return null; - int r = 6; + int r = 5; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); - Vec3i vec3i2 = new Vec3i(r, 0, r); + Vec3i vec3i2 = new Vec3i(r, Main.configFile.hardrangeDown, r); ArrayList stones = new ArrayList(); ArrayList gemstones = new ArrayList(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(Main.configFile.hardIndex == 0) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -207,11 +214,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -222,11 +238,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -237,11 +262,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -252,11 +286,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } diff --git a/src/main/java/rosegoldaddons/features/MithrilMacro.java b/src/main/java/rosegoldaddons/features/MithrilMacro.java index ce9509b..e2645c5 100644 --- a/src/main/java/rosegoldaddons/features/MithrilMacro.java +++ b/src/main/java/rosegoldaddons/features/MithrilMacro.java @@ -1,10 +1,13 @@ package rosegoldaddons.features; +import net.minecraft.block.BlockHardenedClay; +import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -29,6 +32,7 @@ public class MithrilMacro { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) return; + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; if (Main.mc.currentScreen != null) return; if (!Main.mithrilMacro) { if (holdingLeft) { @@ -50,7 +54,6 @@ public class MithrilMacro { lastBlockPos = blockPos; blockPos = closestMithril(); if (lastBlockPos != null && blockPos != null && !lastBlockPos.equals(blockPos)) { - ChatUtils.sendMessage("Block pos was changed."); currentDamage = 0; } if (blockPos != null) { @@ -58,7 +61,7 @@ public class MithrilMacro { if (vec3s.size() > 0) { vec = vec3s.get(0); if (vec != null) { - RotationUtils.facePos(vec); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(vec), Main.configFile.smoothLookVelocity, () -> {}); lastVec = vec; KeyBinding.setKeyBindState(lc.getKeyCode(), true); holdingLeft = true; @@ -117,17 +120,24 @@ public class MithrilMacro { } private boolean isMithril(IBlockState blockState) { - if (blockState.getBlock() == Blocks.prismarine) { - return true; - } else if (blockState.getBlock() == Blocks.wool) { - return true; - } else if (blockState.getBlock() == Blocks.stained_hardened_clay) { - return true; - } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { - return true; - } else if (blockState.getBlock() == Blocks.gold_block) { - return true; + if (!Main.configFile.onlyOres) { + if (blockState.getBlock() == Blocks.prismarine) { + return true; + } else if (blockState.getBlock() == Blocks.wool && (blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.LIGHT_BLUE || blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.GRAY)) { + return true; + } else if (blockState.getBlock() == Blocks.stained_hardened_clay && blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.CYAN) { + return true; + } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if (blockState.getBlock() == Blocks.gold_block) { + return true; + } + } + + if (Main.configFile.includeOres || Main.configFile.onlyOres) { + return blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack; } + return false; } } diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index 2e2e9e5..2e7a36a 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -13,6 +13,7 @@ import rosegoldaddons.Main; import rosegoldaddons.utils.PlayerUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.awt.*; import java.util.ArrayList; @@ -21,15 +22,17 @@ public class MithrilNuker { private static int currentDamage; private static byte blockHitDelay = 0; private static BlockPos blockPos; + private BlockPos lastBlockPos = null; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.mithrilNuker || Main.mc.thePlayer == null || Main.mc.theWorld == null) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if (!Main.mithrilNuker) { currentDamage = 0; return; } if (event.phase == TickEvent.Phase.END) { - if(PlayerUtils.pickaxeAbilityReady) { + if(PlayerUtils.pickaxeAbilityReady && Main.mc.playerController != null) { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if(currentDamage > 100) { @@ -42,6 +45,7 @@ public class MithrilNuker { } } if(currentDamage == 0) { + lastBlockPos = blockPos; blockPos = closestMithril(); } if (blockPos != null) { @@ -52,7 +56,7 @@ public class MithrilNuker { if (currentDamage == 0) { Main.mc.thePlayer.sen