diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
commit | 5e484b169e736408ada925d9cdcea9ac6df7374a (patch) | |
tree | d43c997cf821910a53a918f39ea6b51096a0b485 /src | |
parent | 20894963147ef84a7ad7d578191de69a856f6403 (diff) | |
download | RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.gz RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.bz2 RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.zip |
2.7.3
lag fixed (real) and other stuff
Diffstat (limited to 'src')
24 files changed, 286 insertions, 60 deletions
diff --git a/src/main/java/rosegoldaddons/Config.java b/src/main/java/rosegoldaddons/Config.java index 2886ec2..807e687 100644 --- a/src/main/java/rosegoldaddons/Config.java +++ b/src/main/java/rosegoldaddons/Config.java @@ -15,6 +15,14 @@ public class Config extends Vigilant { category = "Dungeons", subcategory = "General") public boolean AutoReady = false; + @Property(type = PropertyType.SLIDER, name = "Highlight Line Width", description = "Determine the line thickness of all ESPs, 0 to disable ESPs", + category = "ESP", subcategory = "General", max = 10) + public int lineWidth = 3; + + @Property(type = PropertyType.SWITCH, name = "Dungeon ESPs", description = "Edited from ShadyAddons' ESP", + category = "ESP", subcategory = "General") + public boolean dungeonESP = 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; @@ -37,8 +45,12 @@ public class Config extends Vigilant { category = "RoseGoldAddons", subcategory = "General") public boolean AutoUntransfer = false; + @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.SWITCH, name = "Enderman ESP", description = "**NOT** Needed for enderman macro.", - category = "RoseGoldAddons", subcategory = "General") + category = "ESP", 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", @@ -57,10 +69,6 @@ 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 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) public int macroRadius = 0; @@ -137,6 +145,11 @@ public class Config extends Vigilant { category = "Farming", subcategory = "General", options = {"Closest Block", "Facing Axis"}) public int farmShapeIndex = 0; + @Property(type = PropertyType.SELECTOR, name = "Crop Nuker Speed", description = "Choose how many blocks per second Crop Nuker will break", + category = "Farming", subcategory = "General", options = {"40 BPS", "80 BPS"}) + public int farmSpeedIndex = 0; + + @Property(type = PropertyType.SWITCH, name = "Look at nuked block", description = "Looks at currently nuked block to look less sus", category = "Mining", subcategory = "General") public boolean mithrilLook = false; diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index def14cd..3efcf31 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -38,7 +38,7 @@ import java.util.*; public class Main { public static GuiScreen display = null; public static Config configFile = Config.INSTANCE; - public static KeyBinding[] keyBinds = new KeyBinding[19]; + public static KeyBinding[] keyBinds = new KeyBinding[20]; public static boolean endermanMacro = false; public static boolean powderMacro = false; public static boolean AOTSMacro = false; @@ -60,6 +60,7 @@ public class Main { public static boolean init = false; public static boolean mithrilMacro = false; private boolean issue = false; + public static boolean pauseCustom = false; public static final Minecraft mc = Minecraft.getMinecraft(); public static JsonObject rga; @@ -121,6 +122,8 @@ public class Main { MinecraftForge.EVENT_BUS.register(new MithrilMacro()); MinecraftForge.EVENT_BUS.register(new AutoGhostBlock()); MinecraftForge.EVENT_BUS.register(new ShadyRotation()); + MinecraftForge.EVENT_BUS.register(new DungeonESP()); + MinecraftForge.EVENT_BUS.register(new ScoreboardUtils()); configFile.initialize(); ClientCommandHandler.instance.registerCommand(new OpenSettings()); ClientCommandHandler.instance.registerCommand(new Rosedrobe()); @@ -155,7 +158,7 @@ public class Main { set.forEach(stringJsonElementEntry -> { names.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + //System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); }); replacions = rga.get("ranks").getAsJsonObject(); @@ -163,7 +166,7 @@ public class Main { set.forEach(stringJsonElementEntry -> { ranks.put(stringJsonElementEntry.getKey(), stringJsonElementEntry.getValue().getAsString().replace("&", "§")); - System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); + //System.out.println(stringJsonElementEntry.getKey()+": "+stringJsonElementEntry.getValue().getAsString().replace("&", "§")); }); init = true; @@ -221,6 +224,7 @@ public class Main { keyBinds[16] = new KeyBinding("Foraging Nuker Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Foraging"); keyBinds[17] = new KeyBinding("Cane Placer Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Farming"); keyBinds[18] = new KeyBinding("Mithril Macro Toggle", Keyboard.KEY_NONE, "RoseGoldAddons - Mining"); + keyBinds[19] = new KeyBinding("Peek Custom Names", Keyboard.KEY_NONE, "RoseGoldAddons"); for (KeyBinding keyBind : keyBinds) { ClientRegistry.registerKeyBinding(keyBind); @@ -285,6 +289,11 @@ public class Main { } @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + pauseCustom = keyBinds[19].isKeyDown(); + } + + @SubscribeEvent public void key(InputEvent.KeyInputEvent event) { int rnd = new Random().nextInt(configFile.skiblock); if(rnd == 0 && configFile.funnyStuff) { diff --git a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java index 54616e7..f726052 100644 --- a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java +++ b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java @@ -28,11 +28,11 @@ public class ArmorStandESPs { ItemStack itemStack = ((EntityArmorStand) entity).getCurrentArmor(3); if (itemStack != null && itemStack.getItem() instanceof ItemSkull) { if (itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODZhZGRiZDVkZWRhZDQwOTk5NDczYmU0YTdmNDhmNjIzNmE3OWEwZGNlOTcxYjVkYmQ3MzcyMDE0YWUzOTRkIn19fQ==")) { - RenderUtils.drawEntityBox(entity, Color.GREEN, true, event.partialTicks); + RenderUtils.drawEntityBox(entity, Color.GREEN, Main.configFile.lineWidth, event.partialTicks); } else if (itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGRhNDE0ZDI5Y2M5ZWJiZmMxY2JkY2QyMTFlZWU0NzI2ZDA2NzZiZTI2MmU5Y2I4ZWVmZmFmZDFmYzM4MGIxNCJ9fX0=")) { - RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + RenderUtils.drawEntityBox(entity, Color.YELLOW, Main.configFile.lineWidth, event.partialTicks); } else if (itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjMxMmE1YTEyZWNiMjRkNjg1MmRiMzg4ZTZhMzQ3MjFjYzY3ZjUyMmNjZGU3ZTgyNGI5Zjc1ZTk1MDM2YWM5MyJ9fX0=")) { - RenderUtils.drawEntityBox(entity, Color.WHITE, true, event.partialTicks); + RenderUtils.drawEntityBox(entity, Color.WHITE, Main.configFile.lineWidth, event.partialTicks); } } } diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java index e2fc381..242fd33 100644 --- a/src/main/java/rosegoldaddons/features/BrewingMacro.java +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -183,7 +183,7 @@ public class BrewingMacro { if (!Main.brewingMacro) return; stand = closestStand(); if (stand != null) { - RenderUtils.drawBlockBox(stand, Color.YELLOW, true, event.partialTicks); + RenderUtils.drawBlockBox(stand, Color.YELLOW, Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java index 915acae..ab76cc3 100644 --- a/src/main/java/rosegoldaddons/features/CropNuker.java +++ b/src/main/java/rosegoldaddons/features/CropNuker.java @@ -23,7 +23,7 @@ public class CropNuker { @SubscribeEvent public void onTick(TickEvent.PlayerTickEvent event) { - //if(event.phase == TickEvent.Phase.END) return; + if(Main.configFile.farmSpeedIndex == 0 && event.phase == TickEvent.Phase.END) return; if (!Main.nukeCrops || Main.mc.thePlayer == null) { broken.clear(); return; @@ -41,7 +41,7 @@ public class CropNuker { public void onRender(RenderWorldLastEvent event) { if (!Main.nukeCrops) return; if(crop != null) { - RenderUtils.drawBlockBox(crop, new Color(255, 0, 0), true, event.partialTicks); + RenderUtils.drawBlockBox(crop, new Color(255, 0, 0), Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/DungeonESP.java b/src/main/java/rosegoldaddons/features/DungeonESP.java new file mode 100644 index 0000000..b611fe9 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/DungeonESP.java @@ -0,0 +1,87 @@ +package rosegoldaddons.features; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.RenderLivingEntityEvent; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; +import rosegoldaddons.utils.ScoreboardUtils; + +import java.awt.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +public class DungeonESP { + private static HashMap<Entity, Color> highlightedEntities = new HashMap<>(); + private static HashSet<Entity> checkedStarNameTags = new HashSet<>(); + + private static void highlightEntity(Entity entity, Color color) { + highlightedEntities.put(entity, color); + } + + @SubscribeEvent + public void onEntityJoinWorld(EntityJoinWorldEvent event) { + if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP) return; + if (event.entity instanceof EntityPlayer) { + String name = event.entity.getName(); + switch (name) { + case "Shadow Assassin": + event.entity.setInvisible(false); + highlightEntity(event.entity, Color.MAGENTA); + break; + + case "Lost Adventurer": + highlightEntity(event.entity, Color.BLUE); + break; + + case "Diamond Guy": + highlightEntity(event.entity, Color.CYAN); + break; + } + } + if (event.entity instanceof EntityBat) { + highlightEntity(event.entity, Color.RED); + } + } + + @SubscribeEvent + public void onRenderEntityLiving(RenderLivingEntityEvent event) { + if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity)) + return; + if (event.entity instanceof EntityArmorStand) { + if (event.entity.hasCustomName() && event.entity.getCustomNameTag().contains("✯")) { + List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().expand(0, 3, 0), entity -> !(entity instanceof EntityArmorStand)); + if (!possibleEntities.isEmpty()) { + highlightEntity(possibleEntities.get(0), Color.ORANGE); + } + checkedStarNameTags.add(event.entity); + } + } + } + + @SubscribeEvent + public void onRenderWorld(RenderWorldLastEvent event) { + if(ScoreboardUtils.inDungeon && Main.configFile.dungeonESP) { + Main.mc.theWorld.loadedEntityList.forEach(entity -> { + if(highlightedEntities.containsKey(entity)) { + RenderUtils.drawEntityBox(entity, highlightedEntities.get(entity), Main.configFile.lineWidth, event.partialTicks); + } + }); + } + } + + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + highlightedEntities.clear(); + checkedStarNameTags.clear(); + } +} diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index c0f3c6a..0e99af4 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -42,7 +42,7 @@ public class EndermanMacro { public void renderWorld(RenderWorldLastEvent event) { if (!Main.configFile.EndermanESP) return; if (enderman == null) return; - RenderUtils.drawEntityBox(enderman, Color.RED, true, event.partialTicks); + RenderUtils.drawEntityBox(enderman, Color.RED, Main.configFile.lineWidth, event.partialTicks); } private static Entity getClosestEnderman() { diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index 97a1c09..ae24a98 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -66,7 +66,7 @@ public class EntityReach { if(entityName.equals("") && stand != null) { entityName = stand.getName(); } - RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + RenderUtils.drawEntityBox(toInteract, Color.RED, Main.configFile.lineWidth, event.partialTicks); RenderUtils.renderWaypointText(entityName, toInteract.posX, toInteract.posY + toInteract.height, toInteract.posZ, event.partialTicks); } boolean found = false; @@ -81,9 +81,9 @@ public class EntityReach { if (itemStack != null && itemStack.getItem() instanceof ItemSkull) { if(itemStack.serializeNBT().getCompoundTag("tag").getCompoundTag("SkullOwner").getCompoundTag("Properties").toString().contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjk2OTIzYWQyNDczMTAwMDdmNmFlNWQzMjZkODQ3YWQ1Mzg2NGNmMTZjMzU2NWExODFkYzhlNmIyMGJlMjM4NyJ9fX0=")) { if(solved.contains(entity)) { - RenderUtils.drawEntityBox(entity, Color.YELLOW, true, event.partialTicks); + RenderUtils.drawEntityBox(entity, Color.YELLOW, Main.configFile.lineWidth, event.partialTicks); } else { - RenderUtils.drawEntityBox(entity, Color.MAGENTA, true, event.partialTicks); + RenderUtils.drawEntityBox(entity, Color.MAGENTA, Main.configFile.lineWidth, event.partialTicks); } } } diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index af919f9..4389d41 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -30,7 +30,10 @@ public class GemstoneAura { } 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(Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem) != null) { + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + PlayerUtils.pickaxeAbilityReady = false; + } } if (currentDamage > 100) { currentDamage = 0; @@ -91,7 +94,7 @@ public class GemstoneAura { } else if (dyeColor == EnumDyeColor.MAGENTA) { color = new Color(214, 15, 150); } - RenderUtils.drawBlockBox(blockPos, color, true, event.partialTicks); + RenderUtils.drawBlockBox(blockPos, color, Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 1e9f467..a7cf2dc 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -30,7 +30,7 @@ public class GhostMacro { public void renderWorld(RenderWorldLastEvent event) { if (!Main.GhostMacro) return; if (creeper == null) return; - RenderUtils.drawEntityBox(creeper, Color.RED, true, event.partialTicks); + RenderUtils.drawEntityBox(creeper, Color.RED, Main.configFile.lineWidth, event.partialTicks); } private static Entity getClosestCreeper() { diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 4f92056..2551d56 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -130,10 +130,10 @@ public class HardstoneAura { closestStone = closestStone(); closestChest = closestChest(); if (closestStone != null) { - RenderUtils.drawBlockBox(closestStone, new Color(128, 128, 128), true, event.partialTicks); + RenderUtils.drawBlockBox(closestStone, new Color(128, 128, 128), Main.configFile.lineWidth, event.partialTicks); } if (closestChest != null) { - RenderUtils.drawBlockBox(new BlockPos(closestChest.xCoord, closestChest.yCoord, closestChest.zCoord), new Color(255, 128, 0), true, event.partialTicks); + RenderUtils.drawBlockBox(new BlockPos(closestChest.xCoord, closestChest.yCoord, closestChest.zCoord), new Color(255, 128, 0), Main.configFile.lineWidth, event.partialTicks); } else { stopHardstone = false; } @@ -162,7 +162,7 @@ public class HardstoneAura { } else if (dyeColor == EnumDyeColor.MAGENTA) { color = new Color(214, 15, 150); } - RenderUtils.drawBlockBox(gemstone, color, true, event.partialTicks); + RenderUtils.drawBlockBox(gemstone, color, Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/MithrilMacro.java b/src/main/java/rosegoldaddons/features/MithrilMacro.java index e2645c5..4ee8fa1 100644 --- a/src/main/java/rosegoldaddons/features/MithrilMacro.java +++ b/src/main/java/rosegoldaddons/features/MithrilMacro.java @@ -44,8 +44,10 @@ public class MithrilMacro { } if (PlayerUtils.pickaxeAbilityReady) { KeyBinding.setKeyBindState(lc.getKeyCode(), false); - Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); - PlayerUtils.pickaxeAbilityReady = false; + if(Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem) != null) { + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + PlayerUtils.pickaxeAbilityReady = false; + } } if (currentDamage > 100) { KeyBinding.setKeyBindState(lc.getKeyCode(), false); @@ -80,7 +82,7 @@ public class MithrilMacro { RenderUtils.drawPixelBox(vec, Color.RED, 0.01, event.partialTicks); } if (blockPos != null) { - RenderUtils.drawBlockBox(blockPos, Color.CYAN, true, event.partialTicks); + RenderUtils.drawBlockBox(blockPos, Color.CYAN, Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index 2e7a36a..9667eed 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -33,7 +33,10 @@ public class MithrilNuker { } if (event.phase == TickEvent.Phase.END) { 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(Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem) != null) { + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); + PlayerUtils.pickaxeAbilityReady = false; + } } if(currentDamage > 100) { currentDamage = 0; @@ -72,9 +75,9 @@ public class MithrilNuker { if (blockPos != null) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(blockState.getBlock() == Blocks.stone) { - RenderUtils.drawBlockBox(blockPos, Color.WHITE, true, event.partialTicks); + RenderUtils.drawBlockBox(blockPos, Color.WHITE, Main.configFile.lineWidth, event.partialTicks); } else { - RenderUtils.drawBlockBox(blockPos, Color.BLUE, true, event.partialTicks); + RenderUtils.drawBlockBox(blockPos, Color.BLUE, Main.configFile.lineWidth, event.partialTicks); } } } diff --git a/src/main/java/rosegoldaddons/features/NecronAimbot.java b/src/main/java/rosegoldaddons/features/NecronAimbot.java index b491951..c1669c1 100644 --- a/src/main/java/rosegoldaddons/features/NecronAimbot.java +++ b/src/main/java/rosegoldaddons/features/NecronAimbot.java @@ -19,7 +19,7 @@ public class NecronAimbot { if (!Main.necronAimbot) return; Entity necron = getClosestWither(); if (necron == null) return; - RenderUtils.drawEntityBox(necron, Color.RED, true, event.partialTicks); + RenderUtils.drawEntityBox(necron, Color.RED, Main.configFile.lineWidth, event.partialTicks); RotationUtils.faceEntity(necron); } diff --git a/src/main/java/rosegoldaddons/features/PinglessMining.java b/src/main/java/rosegoldaddons/features/PinglessMining.java index c617ae4..7ad3fec 100644 --- a/src/main/java/rosegoldaddons/features/PinglessMining.java +++ b/src/main/java/rosegoldaddons/features/PinglessMining.java @@ -81,7 +81,7 @@ public class PinglessMining { } block = closestBlock(event); if (block != null) { - RenderUtils.drawBlockBox(block, new Color(255, 0, 0), true, event.partialTicks); + RenderUtils.drawBlockBox(block, new Color(255, 0, 0), Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index 61555a3..d23b27b 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -46,7 +46,7 @@ public class PowderMacro { 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); + RenderUtils.drawBlockBox(new BlockPos(closestChest.xCoord, closestChest.yCoord, closestChest.zCoord), new Color(255, 128, 0), Main.configFile.lineWidth, event.partialTicks); } } diff --git a/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java new file mode 100644 index 0000000..1584dac --- /dev/null +++ b/src/main/java/rosegoldaddons/mixins/MixinEntityPlayer.java @@ -0,0 +1,33 @@ +package rosegoldaddons.mixins; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +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.CallbackInfoReturnable; +import rosegoldaddons.Main; + +import java.util.Map; + +@Mixin(EntityPlayer.class) +public class MixinEntityPlayer { + @Inject(method = "getDisplayName", at = @At(value = "RETURN"), cancellable = true) + public void getFormattedText(CallbackInfoReturnable<IChatComponent> cir) { + if(Main.pauseCustom) return; + if (Main.init && Main.configFile.alchsleep != 63 || Main.configFile.skiblock != 263) { + IChatComponent ict = new ChatComponentText(""); + ict.setChatStyle(cir.getReturnValue().getChatStyle()); + String text = cir.getReturnValue().getFormattedText(); + for (Map.Entry<String, String> entry : Main.nameCache.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + + text = text.replace(key, value); + } + ict.appendText(text); + cir.setReturnValue(ict); + } + } +} diff --git a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java index e4888e0..d7a80b8 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRenderString.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRenderString.java @@ -14,6 +14,7 @@ public abstract class MixinRenderString { @ModifyVariable(method = "drawString(Ljava/lang/String;FFIZ)I", at = @At(value = "FIELD")) private String replaceName(String text) { if (Main.mc.theWorld == null || Main.mc.thePlayer == null) return text; + if(Main.pauseCustom) return text; if (Main.configFile.wydsi && text.contains("727")) { text = text.replace("727", "726"); } @@ -21,6 +22,7 @@ public abstract class MixinRenderString { String[] words = stripString(text).replace(":"," ").replace("'"," ").split(" "); String[] formatteds = text.replace(":"," ").replace("'"," ").split(" "); for (String word : words) { + if(word.equals("")) continue; if (Main.hashedCache.contains(word)) continue; if(Main.rankCache.containsKey(word)) { String rank = getRank(text, word); @@ -39,6 +41,7 @@ public abstract class MixinRenderString { } } for (String word : words) { + if(word.equals("")) continue; if (Main.hashedCache.contains(word)) continue; if (Main.nameCache.containsKey(word)) { String[] replaces = Main.nameCache.get(word).split(" "); @@ -84,9 +87,13 @@ public abstract class MixinRenderString { } private String stripString(String s) { - char[] nonValidatedString = StringUtils.stripControlCodes(s).toCharArray(); + char[] nonValidatedString; + try { + nonValidatedString = StringUtils.stripControlCodes(s).toCharArray(); + } catch (Exception e) { + return ""; + } StringBuilder validated = new StringBuilder(); - for (char a : nonValidatedString) { if ((int) a < 127 && (int) a > 20) { validated.append(a); diff --git a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java index 25f1a2e..dc06069 100644 --- a/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/rosegoldaddons/mixins/MixinRendererLivingEntity.java @@ -8,6 +8,7 @@ import net.minecraft.util.StringUtils; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.apache.commons.codec.digest.DigestUtils; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -29,13 +30,17 @@ public abstract class MixinRendererLivingEntity { ci.cancel(); } + /* @Redirect(method = "renderName(Lnet/minecraft/entity/EntityLivingBase;DDD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IChatComponent;getFormattedText()Ljava/lang/String;")) public String redirectGetFormattedText(IChatComponent instance) { + if(!Main.configFile.customNames) return instance.getFormattedText(); if (Main.init && Main.configFile.alchsleep == 63 && Main.configFile.skiblock == 263) return instance.getFormattedText(); String unformatted = stripString(instance.getUnformattedText()).replace(":"," ").replace("'"," "); String[] words = unformatted.split(" "); String[] formatteds = instance.getUnformattedText().replace(":"," ").replace("'"," ").split(" "); for(String word : words) { + if (Main.hashedCache.contains(word)) continue; + if(word.equals("")) continue; if (Main.nameCache.containsKey(word)) { String[] replaces = Main.nameCache.get(word).split(" "); for(String replace : replaces) { @@ -45,11 +50,18 @@ public abstract class MixinRendererLivingEntity { } String color = getColorBeforeIndex(instance.getUnformattedText(), instance.getUnformattedText().indexOf(word)); return instance.getUnformattedText().replace(word, Main.nameCache.get(word) + color); + } else { + String hashed = DigestUtils.sha256Hex(word + word); + if (Main.names.containsKey(hashed)) { + Main.nameCache.put(word, Main.names.get(hashed)); + } else { + Main.hashedCache.add(word); + } } } return instance.getFormattedText(); } - + */ private String getColorBeforeIndex(String str, int index) { String lastColor = ""; diff --git a/src/main/java/rosegoldaddons/utils/PlayerUtils.java b/src/main/java/rosegoldaddons/utils/PlayerUtils.java index f0662c0..7411660 100644 --- a/src/main/java/rosegoldaddons/utils/PlayerUtils.java +++ b/src/main/java/rosegoldaddons/utils/PlayerUtils.java @@ -25,12 +25,17 @@ public class PlayerUtils { @SubscribeEvent public void chat(ClientChatReceivedEvent event) { - String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - if (message.contains(":") || message.contains(">")) return; - if(message.startsWith("You used your")) { - pickaxeAbilityReady = false; - } else if(message.endsWith("is now available!")) { - pickaxeAbilityReady = true; + try { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + if (message.contains(":") || message.contains(">")) return; + if(message.startsWith("You used your")) { + pickaxeAbilityReady = false; + } else if(message.endsWith("is now available!")) { + pickaxeAbilityReady = true; + } + } catch (Exception e) { + e.printStackTrace(); } + } } diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java index cf83c28..d6a7f8f 100644 --- a/src/main/java/rosegoldaddons/utils/RenderUtils.java +++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java @@ -72,7 +72,8 @@ public class RenderUtils { glEndList(); } - public static void drawBlockBox(final BlockPos blockPos, final Color color, final boolean outline, float partialTicks) { + public static void drawBlockBox(final BlockPos blockPos, final Color color, final int width, float partialTicks) { + if(width == 0) return; final RenderManager renderManager = mc.getRenderManager(); final double x = blockPos.getX() - renderManager.viewerPosX; @@ -101,16 +102,15 @@ public class RenderUtils { disableGlCap(GL_TEXTURE_2D, GL_DEPTH_TEST); glDepthMask(false); - glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : outline ? 26 : 35); + glColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() != 255 ? color.getAlpha() : 26); //drawFilledBox(axisAlignedBB); - if (outline) { - glLineWidth(3F); - enableGlCap(GL_LINE_SMOOTH); - glColor(color); + glLineWidth((float) width); + enableGlCap(GL_LINE_SMOOTH); + glColor(color); + + drawSelectionBoundingBox(axisAlignedBB); - drawSelectionBoundingBox(axisAlignedBB); - } GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glDepthMask(true); @@ -178,7 +178,8 @@ public class RenderUtils { tessellator.draw(); } - public static void drawEntityBox(final Entity entity, final Color color, final boolean outline, float partialTicks) { + public static void drawEntityBox(final Entity entity, final Color color, final int width, float partialTicks) { + if(width == 0) return; final RenderManager renderManager = mc.getRenderManager(); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -203,14 +204,12 @@ public class RenderUtils { entityBox.maxZ - entity.posZ + z + 0.05D ); - if (outline) { - glLineWidth(3F); - enableGlCap(GL_LINE_SMOOTH); - glColor(color.getRed(), color.getGreen(), color.getBlue(), 95); - drawSelectionBoundingBox(axisAlignedBB); - } + glLineWidth((float) width); + enableGlCap(GL_LINE_SMOOTH); + glColor(color.getRed(), color.getGreen(), color.getBlue(), 95); + drawSelectionBoundingBox(axisAlignedBB); - glColor(color.getRed(), color.getGreen(), color.getBlue(), outline ? 26 : 35); + glColor(color.getRed(), color.getGreen(), color.getBlue(), 26); //drawFilledBox(axisAlignedBB); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glDepthMask(true); diff --git a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java index a9d7d63..d3a8463 100644 --- a/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java +++ b/src/main/java/rosegoldaddons/utils/ScoreboardUtils.java @@ -23,6 +23,8 @@ import java.util.stream.Collectors; public class ScoreboardUtils { public static boolean inSkyblock = false; + public static boolean inDungeon = false; + public static String cleanSB(String scoreboard) { char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray(); StringBuilder cleaned = new StringBuilder(); @@ -65,11 +67,56 @@ public class ScoreboardUtils { return lines; } + @SuppressWarnings({"ExecutionException", "IllegalArgumentException"}) + public static List<String> getScoreboard() { + List<String> lines = new ArrayList<>(); + if (Minecraft.getMinecraft().theWorld == null) return lines; + Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + if (scoreboard == null) return lines; + + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + if (objective == null) return lines; + + Collection<Score> scores = scoreboard.getSortedScores(objective); + List<Score> list = scores.stream() + .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() + .startsWith("#")) + .collect(Collectors.toList()); + + if (list.size() > 15) { + scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); + } else { + scores = list; + } + + for (Score score : scores) { + ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName()); + lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName())); + } + + return lines; + } + + public static boolean scoreboardContains(String string) { + boolean result = false; + List<String> scoreboard = getScoreboard(); + for (String line : scoreboard) { + line = cleanSB(line); + line = removeFormatting(line); + if(line.contains(string)) { + result = true; + break; + } + } + return result; + } + public static String removeFormatting(String input) { return input.replaceAll("§[0-9a-fk-or]", ""); } private int ticks = 0; + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if(ticks % 20 == 0) { @@ -78,6 +125,7 @@ public class ScoreboardUtils { if(scoreboardObj != null) { inSkyblock = removeFormatting(scoreboardObj.getDisplayName()).contains("SKYBLOCK"); } + inDungeon = inSkyblock && ScoreboardUtils.scoreboardContains("The Catacombs"); } ticks = 0; } diff --git a/src/main/java/rosegoldaddons/utils/ShadyRotation.java b/src/main/java/rosegoldaddons/utils/ShadyRotation.java index fdacc59..111ea6e 100644 --- a/src/main/java/rosegoldaddons/utils/ShadyRotation.java +++ b/src/main/java/rosegoldaddons/utils/ShadyRotation.java @@ -30,6 +30,10 @@ public class ShadyRotation { return angle - Math.floor(angle / 360 + 0.5) * 360; } + private static float wrapAngleTo180(float angle) { + return (float) (angle - Math.floor(angle / 360 + 0.5) * 360); + } + public static Rotation getRotationToBlock(BlockPos block) { double diffX = block.getX() - Main.mc.thePlayer.posX + 0.5; double diffY = block.getY() - Main.mc.thePlayer.posY + 0.5 - Main.mc.thePlayer.getEyeHeight(); @@ -81,8 +85,8 @@ public class ShadyRotation { ShadyRotation.callback = callback; - pitchDifference = rotation.pitch - Main.mc.thePlayer.rotationPitch; - yawDifference = rotation.yaw - Main.mc.thePlayer.rotationYaw; + pitchDifference = wrapAngleTo180(rotation.pitch - Main.mc.thePlayer.rotationPitch); + yawDifference = wrapAngleTo180(rotation.yaw - Main.mc.thePlayer.rotationYaw); ShadyRotation.ticks = ticks * 20; ShadyRotation.tickCounter = 0; diff --git a/src/main/resources/mixins.rosegoldaddons.json b/src/main/resources/mixins.rosegoldaddons.json index 5f4d645..caa4d26 100644 --- a/src/main/resources/mixins.rosegoldaddons.json +++ b/src/main/resources/mixins.rosegoldaddons.json @@ -9,6 +9,7 @@ "client": [ "MixinMinecraft", "MixinRendererLivingEntity", + "MixinEntityPlayer", "MixinRenderString" ] } |