diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
8 files changed, 531 insertions, 579 deletions
diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java new file mode 100644 index 0000000..4744766 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -0,0 +1,333 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Items; +import net.minecraft.item.ItemCloth; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +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.ClickEvent; +import rosegoldaddons.utils.ChatUtils; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public class AutoArrowAlign { + private static final ArrayList<Entity> itemFrames = new ArrayList<>(); + private static final ArrayList<Entity> arrowItemFrames = new ArrayList<>(); + private static final Map<BlockPos, Integer> clicksPerFrame = new HashMap<>(); + private static final Map<BlockPos, Integer> toClickMap = new HashMap<>(); + private static boolean init = false; + private static final BlockPos topLeft = new BlockPos(196, 125, 278); + + /*@SubscribeEvent + public void debugging(TickEvent.ClientTickEvent event) { + if (!Main.configFile.autoArrowAlign) return; + if (init) { + for (int y = 126; y > 119; y--) { + String line = ""; + for (int z = 278; z < 283; z++) { + BlockPos BP = new BlockPos(topLeft.getX(), y, z); + int toClick = -1; + if (toClickMap.containsKey(BP)) { + toClick = toClickMap.get(BP); + } + line += (toClick + " "); + } + ChatUtils.sendMessage(y + ": " + line); + } + itemFrames.forEach(itemFrame -> { + BlockPos BP = new BlockPos(itemFrame.getPosition().getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + ChatUtils.sendMessage(BP+""); + }); + } + }*/ + + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + if (!Main.configFile.autoArrowAlign) return; + itemFrames.clear(); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (entity1 instanceof EntityItemFrame) { + itemFrames.add(entity1); + } + } + arrowItemFrames.clear(); + itemFrames.forEach(itemFrame -> { + ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem(); + if (itemStack != null) { + if (itemStack.getItem() == Items.arrow) { + arrowItemFrames.add(itemFrame); + } + } + }); + } + + @SubscribeEvent + public void worldUnload(WorldEvent.Unload event) { + init = false; + toClickMap.clear(); + clicksPerFrame.clear(); + } + + public static void cheat() { + initFrame(); + arrowItemFrames.forEach(itemFrame -> { + BlockPos BP = new BlockPos(topLeft.getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + int endRotationAmount = 0; + if (clicksPerFrame.containsKey(BP)) { + endRotationAmount = clicksPerFrame.get(BP); + } + int currRotationAmount = ((EntityItemFrame) itemFrame).getRotation(); + int toClick = 0; + if (currRotationAmount < endRotationAmount) { + toClick = endRotationAmount - currRotationAmount; + } else if (currRotationAmount > endRotationAmount) { + currRotationAmount = currRotationAmount - 8; + toClick = endRotationAmount - currRotationAmount; + } + toClickMap.put(BP, toClick); + }); + if (init) { + int j = 0; + Entity save = null; + for (Entity itemFrame : arrowItemFrames) { + BlockPos BP = new BlockPos(topLeft.getX(), itemFrame.getPosition().getY(), itemFrame.getPosition().getZ()); + if (toClickMap.containsKey(BP)) { + j++; + int toClick2 = toClickMap.get(BP); + if (j == arrowItemFrames.size()) { + save = itemFrame; + toClick2 -= 1; + } + for (int i = 0; i < toClick2; i++) { + interactWithEntity(itemFrame); + } + } + } + Entity finalSave = save; + new Thread(() -> { + try { + Thread.sleep(60); + if(finalSave != null) { + interactWithEntity(finalSave); + } + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } + } + + private static String findPattern() { + ArrayList<Entity> redWools = new ArrayList<>(); + ArrayList<Entity> greenWools = new ArrayList<>(); + + itemFrames.forEach(itemFrame -> { + ItemStack itemStack = ((EntityItemFrame) itemFrame).getDisplayedItem(); + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemCloth && itemStack.getItemDamage() == 14) { + redWools.add(itemFrame); + } + if (itemStack.getItem() instanceof ItemCloth && itemStack.getItemDamage() == 5) { + greenWools.add(itemFrame); + } + } + }); + if (redWools.size() != 0 && greenWools.size() != 0) { + int relativeR1 = topLeft.getY() - (((Entity) redWools.toArray()[0]).getPosition()).getY(); + switch (redWools.size()) { + case 1: + switch (greenWools.size()) { + case 1: + if (relativeR1 == 4) { + return "legs"; + } + if (relativeR1 == 0) { + return "N"; + } + return "spiral"; + case 2: + if (relativeR1 == 2) { + return "W"; + } + return "bottleneck"; + } + break; + case 2: + if (greenWools.size() > 1) return "zigzag"; + return "S"; + case 3: + return "lines"; + } + } + return "Unrecognized"; + } + + private static void initFrame() { + if (init) return; + String pattern = findPattern(); + ChatUtils.sendMessage("Pattern Found: " + pattern); + switch (pattern) { + case "legs": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 3), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 7); + init = true; + break; + case "N": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + init = true; + break; + case "spiral": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + init = true; + break; + case "W": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 4), 5); + init = true; + break; + case "bottleneck": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ()), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 4), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 3), 7); + init = true; + break; + case "S": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 1); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 4), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ()), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + break; + case "lines": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + init = true; + break; + case "zigzag": + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 2), 3); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY(), topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 1, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 2, topLeft.getZ() - 3), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 1), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 3, topLeft.getZ() - 2), 5); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 2), 7); + clicksPerFrame.put(new BlockPos(topLeft.getX(), topLeft.getY() - 4, topLeft.getZ() - 3), 5); + init = true; + break; + } + + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Minecraft.getMinecraft()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void interactWithEntity(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + } + + + private static boolean isInSection3() { + int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); + int z = Minecraft.getMinecraft().thePlayer.getPosition().getZ(); + return x < 218 && z > 251 && x > 196 && z < 319; + } +} diff --git a/src/main/java/rosegoldaddons/features/BlockBreakAura.java b/src/main/java/rosegoldaddons/features/BlockBreakAura.java index e8b7219..528ccc1 100644 --- a/src/main/java/rosegoldaddons/features/BlockBreakAura.java +++ b/src/main/java/rosegoldaddons/features/BlockBreakAura.java @@ -65,7 +65,7 @@ public class BlockBreakAura { } private BlockPos closestGemstone() { - int r = 4; + int r = 5; BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 88ce213..41d1f90 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; public class BloodTriggerBot { - private static String[] names = {"Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul"}; + private static String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor"}; private static ArrayList<Entity> bloodMobs = null; private Thread thread; @@ -34,7 +34,7 @@ public class BloodTriggerBot { thread = new Thread(() -> { try { for (Entity entity : bloodMobs) { - if (isLookingAtBloodMob(entity.getEntityBoundingBox(), event)) { + if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { click(); Thread.sleep(100); } @@ -47,10 +47,11 @@ public class BloodTriggerBot { } } - private static boolean isLookingAtBloodMob(AxisAlignedBB aabb, RenderWorldLastEvent event) { + private static boolean isLookingAtAABB(AxisAlignedBB aabb, RenderWorldLastEvent event) { Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); - for (int i = 0; i < 30; i++) { + look = scaleVec(look, 0.5F); + for (int i = 0; i < 64; i++) { if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { return true; } @@ -77,6 +78,10 @@ public class BloodTriggerBot { return bloodMobs; } + private static Vec3 scaleVec(Vec3 vec, float f) { + return new Vec3(vec.xCoord * (double)f, vec.yCoord * (double)f, vec.zCoord * (double)f); + } + public static void click() { try { Method clickMouse; diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 57c650f..3133cb8 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -10,7 +10,6 @@ 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; @@ -26,9 +25,8 @@ public class CustomItemMacro { 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) { + for (String i : UseCooldown.RCitems.keySet()) { + if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { int slot = findItemInHotbar(i); if (slot != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; @@ -37,6 +35,16 @@ public class CustomItemMacro { } } } + for (String i : UseCooldown.LCitems.keySet()) { + if (milis % Math.floor(UseCooldown.LCitems.get(i)/100) == 0) { + int slot = findItemInHotbar(i); + if (slot != -1) { + Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; + Thread.sleep(100); + click(); + } + } + } Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; Thread.sleep(100); } catch (Exception e) { @@ -62,6 +70,21 @@ public class CustomItemMacro { } } + public static void click() { + try { + Method clickMouse; + try { + clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); + } catch (NoSuchMethodException e) { + clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); + } + clickMouse.setAccessible(true); + clickMouse.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++) { diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java new file mode 100644 index 0000000..9db81f1 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -0,0 +1,125 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.Entity; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.Item; +import net.minecraft.item.ItemSkull; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.ClickEvent; +import rosegoldaddons.utils.ChatUtils; +import rosegoldaddons.utils.RenderUtils; + +import java.awt.*; +import java.util.ArrayList; + +public class EntityReach { + private Thread thread; + private static Entity toInteract; + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Main.configFile.entityReach) return; + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (toInteract != null) { + if (toInteract instanceof EntityArmorStand) { + interactWithEntity2(toInteract); + } + interactWithEntity(toInteract); + toInteract = null; + } + } + } + + @SubscribeEvent + public void renderWorld(RenderWorldLastEvent event) { + if (!Main.configFile.entityReach) return; + ArrayList<Entity> entities = getAllEntitiesInRange(); + for (Entity entity : entities) { + if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { + toInteract = entity; + return; + } + } + if (!Main.configFile.sticky) { + toInteract = null; + } + } + + @SubscribeEvent + public void renderWorld2(RenderWorldLastEvent event) { + if (!Main.configFile.entityReach) return; + if (toInteract != null) { + RenderUtils.drawEntityBox(toInteract, Color.RED, true, event.partialTicks); + } + } + + /*@SubscribeEvent + public void onInteract(ClickEvent.Right event) { + MovingObjectPosition objectMouseOver = Minecraft.getMinecraft().objectMouseOver; + if (objectMouseOver != null) { + ChatUtils.sendMessage(""+objectMouseOver.entityHit); + } + }*/ + + private static boolean isLookingAtAABB(AxisAlignedBB aabb, RenderWorldLastEvent event) { + Vec3 position = new Vec3(Minecraft.getMinecraft().thePlayer.posX, (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()), Minecraft.getMinecraft().thePlayer.posZ); + Vec3 look = Minecraft.getMinecraft().thePlayer.getLook(event.partialTicks); + look = scaleVec(look, 0.2F); + for (int i = 0; i < 200; i++) { + if (aabb.minX <= position.xCoord && aabb.maxX >= position.xCoord && aabb.minY <= position.yCoord && aabb.maxY >= position.yCoord && aabb.minZ <= position.zCoord && aabb.maxZ >= position.zCoord) { + return true; + } + position = position.add(look); + } + + return false; + } + + private static ArrayList<Entity> getAllEntitiesInRange() { + ArrayList<Entity> entities = new ArrayList<>(); + Vec3 playerPos = Minecraft.getMinecraft().thePlayer.getPositionVector(); + playerPos.add(new Vec3(0, 1, 0)); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (playerPos.distanceTo(entity1.getPositionVector()) < 30 && !(entity1 instanceof EntityPlayerSP)) { + entities.add(entity1); + } + } + return entities; + } + + private static void interactWithEntity(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + } + + private static void interactWithEntity2(Entity entity) { + PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; + MovingObjectPosition mop = new MovingObjectPosition(entity); + playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, mop); + } + + + private static Vec3 scaleVec(Vec3 vec, float f) { + return new Vec3(vec.xCoord * (double) f, vec.yCoord * (double) f, vec.zCoord * (double) f); + } + +} + + diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index 3dc301e..ecf314b 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -16,6 +16,7 @@ import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; +import scala.actors.threadpool.helpers.ThreadHelpers; import java.awt.*; import java.lang.reflect.Method; @@ -24,6 +25,7 @@ import java.util.Random; public class ForagingIslandMacro { private Thread thread; + private String[] cum = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { @@ -34,6 +36,9 @@ public class ForagingIslandMacro { BlockPos furthestDirt = furthestEmptyDirt(); //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); int sapling = findItemInHotbar("Jungle Sapling"); + if(sapling == -1) { + sapling = findItemInHotbar("Oak Sapling"); + } int bonemeal = findItemInHotbar("Bone Meal"); int treecap = findItemInHotbar("Treecapitator"); int rod = findItemInHotbar("Rod"); @@ -76,19 +81,25 @@ public class ForagingIslandMacro { RotationUtils.facePos(new Vec3(dirt.getX() + 0.5, dirt.getY(), dirt.getZ() + 0.5)); if (bonemeal != -1 && treecap != -1) { Minecraft.getMinecraft().thePlayer.inventory.currentItem = bonemeal; - Thread.sleep(200); + Random rand = new Random(); + int toAdd = 0; + if(Main.configFile.randomizeForaging) { + toAdd = rand.nextInt(20); + } + ChatUtils.sendMessage("extra delay: "+toAdd+"%"); + Thread.sleep(Math.round(150*(1+(toAdd/100)))); rightClick(); rightClick(); Minecraft.getMinecraft().thePlayer.inventory.currentItem = treecap; - Thread.sleep(150); + Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100)))); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); - Thread.sleep(100); + Thread.sleep(Math.round(150*(1+(toAdd/100)))); KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); - Thread.sleep(25); + Thread.sleep(Math.round(25*(1+(toAdd/100)))); Minecraft.getMinecraft().thePlayer.inventory.currentItem = rod; - Thread.sleep(200); + Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100)))); rightClick(); - Thread.sleep((2000 - Main.configFile.monkeyLevel * 10L)); + Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100)))); } } } @@ -104,9 +115,25 @@ public class ForagingIslandMacro { @SubscribeEvent public void renderWorld2(RenderWorldLastEvent event) { if (!Main.forageOnIsland) return; - BlockPos furthestDirt = furthestEmptyDirt(); - if (furthestDirt != null) { - RenderUtils.drawBlockBox(furthestDirt, Color.RED, true, event.partialTicks); + BlockPos e = closestDirt(); + if(e == null) { + Main.forageOnIsland = false; + ChatUtils.sendMessage("§cNo dirt in range of player"); + ChatUtils.sendMessage("§cForaging Macro Deactivated"); + if(Main.configFile.forageantisus) { + int rand = new Random().nextInt(cum.length); + int rand2 = new Random().nextInt(5000); + new Thread(() -> { + try { + Thread.sleep(rand2); + Minecraft.getMinecraft().thePlayer.sendChatMessage(cum[rand]); + Thread.sleep(rand2*2); + Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); + } catch (Exception exception) { + exception.printStackTrace(); + } + }).start(); + } } } diff --git a/src/main/java/rosegoldaddons/features/ItemFrameAura.java b/src/main/java/rosegoldaddons/features/ItemFrameAura.java deleted file mode 100644 index 973bd39..0000000 --- a/src/main/java/rosegoldaddons/features/ItemFrameAura.java +++ /dev/null @@ -1,414 +0,0 @@ -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 rosegoldaddons.utils.ChatUtils; - -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; - } - ChatUtils.sendMessage("" + 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); - ChatUtils.sendMessage(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/WartMacro.java b/src/main/java/rosegoldaddons/features/WartMacro.java deleted file mode 100644 index b96f25b..0000000 --- a/src/main/java/rosegoldaddons/features/WartMacro.java +++ /dev/null @@ -1,147 +0,0 @@ -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.ChatUtils; -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) { - ChatUtils.sendMessage("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(); - } - } - } -} |