diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
commit | f4b58abbda168b01513a5ac2ba2870bc00df7074 (patch) | |
tree | 2f237367764c74bba1f912acec1da281a2b74d24 /src/main/java/rosegoldaddons/features | |
parent | fdc569f2ab7674d850d25b41519b4e3da244dd00 (diff) | |
download | RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.gz RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.bz2 RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.zip |
2.7.0-pre2
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
26 files changed, 554 insertions, 284 deletions
diff --git a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java index c0958bb..54616e7 100644 --- a/src/main/java/rosegoldaddons/features/ArmorStandESPs.java +++ b/src/main/java/rosegoldaddons/features/ArmorStandESPs.java @@ -42,7 +42,7 @@ public class ArmorStandESPs { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } diff --git a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java index e4c9c14..db9650f 100644 --- a/src/main/java/rosegoldaddons/features/AutoArrowAlign.java +++ b/src/main/java/rosegoldaddons/features/AutoArrowAlign.java @@ -62,7 +62,7 @@ public class AutoArrowAlign { public void onRender(RenderWorldLastEvent event) { if (!Main.configFile.autoArrowAlign) return; itemFrames.clear(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityItemFrame) { itemFrames.add(entity1); } @@ -126,8 +126,8 @@ public class AutoArrowAlign { Thread.sleep(500); if(finalSave != null) { interactWithEntity(finalSave); - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getHeldItem()); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.getHeldItem()); } } catch (Exception e) { e.printStackTrace(); @@ -317,25 +317,25 @@ public class AutoArrowAlign { rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } private static void interactWithEntity2(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Main.mc.thePlayer, entity, Main.mc.objectMouseOver); } private static boolean isInSection3() { - int x = Minecraft.getMinecraft().thePlayer.getPosition().getX(); - int z = Minecraft.getMinecraft().thePlayer.getPosition().getZ(); + int x = Main.mc.thePlayer.getPosition().getX(); + int z = Main.mc.thePlayer.getPosition().getZ(); return x < 218 && z > 251 && x > 196 && z < 319; } } diff --git a/src/main/java/rosegoldaddons/features/AutoReady.java b/src/main/java/rosegoldaddons/features/AutoReady.java index f28910e..675d9f1 100644 --- a/src/main/java/rosegoldaddons/features/AutoReady.java +++ b/src/main/java/rosegoldaddons/features/AutoReady.java @@ -22,8 +22,8 @@ public class AutoReady { static int windowId; private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } @SubscribeEvent @@ -34,7 +34,7 @@ public class AutoReady { checkingEntities = true; Thread.sleep(500); Entity mort = null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1.getName().contains("Mort")) { mort = entity1; interactWithEntity(mort); @@ -64,7 +64,7 @@ public class AutoReady { if (container instanceof ContainerChest) { String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); List<Slot> invSlots = container.inventorySlots; - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(chestName)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(chestName)); if (chestName.contains("Start Dungeon?")) { int i; for(i = 0; i < invSlots.size(); i++) { @@ -79,7 +79,7 @@ public class AutoReady { for(i = 0; i < invSlots.size(); i++) { if(!invSlots.get(i).getHasStack()) continue; String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()); - if(slotName.contains(Minecraft.getMinecraft().thePlayer.getName())) { + if(slotName.contains(Main.mc.thePlayer.getName())) { i += 9; if(invSlots.get(i).getHasStack()) { if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Not Ready")) { @@ -94,7 +94,7 @@ public class AutoReady { } private void clickSlot(Slot slot) { - windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId; - Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 1, 0, Minecraft.getMinecraft().thePlayer); + windowId = Main.mc.thePlayer.openContainer.windowId; + Main.mc.playerController.windowClick(windowId, slot.slotNumber, 1, 0, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/AutoSlayer.java b/src/main/java/rosegoldaddons/features/AutoSlayer.java index bcea552..64b173a 100644 --- a/src/main/java/rosegoldaddons/features/AutoSlayer.java +++ b/src/main/java/rosegoldaddons/features/AutoSlayer.java @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; +import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.ScoreboardUtils; import java.util.List; @@ -26,6 +27,7 @@ public class AutoSlayer { private static boolean waitingForMaddox = false; private static int slayerSlot = 0; private static int slotLevel = 0; + private static int debounce = 0; @SubscribeEvent public void chat(ClientChatReceivedEvent event) { @@ -45,18 +47,18 @@ public class AutoSlayer { @SubscribeEvent public void onInteract(InputEvent.KeyInputEvent event) { - if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox) return; + if (!Main.configFile.autoSlayer || !Main.configFile.clickMaddox || waitingForMaddox || debounce != 0) return; List<String> scoreboard = ScoreboardUtils.getSidebarLines(); for (String line : scoreboard) { String cleanedLine = ScoreboardUtils.cleanSB(line); if (cleanedLine.contains("Boss slain!")) { int maddox = findItemInHotbar("Batphone"); if (maddox != -1) { - ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(maddox); - int save = Minecraft.getMinecraft().thePlayer.inventory.currentItem; - Minecraft.getMinecraft().thePlayer.inventory.currentItem = maddox; - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = save; + ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(maddox); + int save = Main.mc.thePlayer.inventory.currentItem; + Main.mc.thePlayer.inventory.currentItem = maddox; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, item); + Main.mc.thePlayer.inventory.currentItem = save; waitingForMaddox = true; break; } @@ -67,8 +69,11 @@ public class AutoSlayer { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.configFile.autoSlayer) return; + if (debounce > 0) { + debounce--; + } if (!openMaddox) return; - Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + Main.mc.thePlayer.sendChatMessage(lastMaddoxCommand); switch (Main.configFile.slayerTypeIndex) { case 1: slayerSlot = 10; //zombie @@ -125,7 +130,7 @@ public class AutoSlayer { if (container instanceof ContainerChest) { String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); if (chestName.contains("Slayer")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; if (!chestInventory.get(13).getHasStack()) return; if (chestInventory.get(13).getStack().getDisplayName().contains("Ongoing")) { @@ -134,10 +139,12 @@ public class AutoSlayer { clickSlot(slayerSlot, 2, 1); clickSlot(slotLevel, 2, 2); clickSlot(11, 2, 3); //confirm + debounce = 80; } else { clickSlot(slayerSlot, 2, 0); clickSlot(slotLevel, 2, 1); clickSlot(11, 2, 2); //confirm + debounce = 80; } slayerSlot = 0; slotLevel = 0; @@ -149,7 +156,7 @@ public class AutoSlayer { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -162,6 +169,6 @@ public class AutoSlayer { } private void clickSlot(int slot, int type, int windowAdd) { - Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Minecraft.getMinecraft().thePlayer); + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 7f5909d..1620794 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -21,14 +21,14 @@ public class BloodTriggerBot { if (event.phase == TickEvent.Phase.END) return; for (Entity entity : getAllBloodMobs()) { if (isLookingAtAABB(entity.getEntityBoundingBox(), 1F)) { - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } } } private static boolean isLookingAtAABB(AxisAlignedBB aabb, float partialTicks) { - 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(partialTicks); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(partialTicks); 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) { @@ -42,8 +42,8 @@ public class BloodTriggerBot { private static ArrayList<Entity> getAllBloodMobs() { ArrayList<Entity> bloodMobs = new ArrayList<>(); - if (Minecraft.getMinecraft().theWorld == null) return bloodMobs; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if (Main.mc.theWorld == null) return bloodMobs; + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityOtherPlayerMP && !entity1.isDead) { for (String name : names) { if (entity1.getName().contains(name)) { diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java index f7febb3..e2fc381 100644 --- a/src/main/java/rosegoldaddons/features/BrewingMacro.java +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -32,16 +32,16 @@ public class BrewingMacro { public void onTick(TickEvent.ClientTickEvent event) { if (!Main.brewingMacro || !Main.configFile.openstand || Main.configFile.alchindex != 0) return; if (event.phase == TickEvent.Phase.END) { - if (Minecraft.getMinecraft().currentScreen == null && stand != null && !sell) { - if (Minecraft.getMinecraft().playerController.onPlayerRightClick( - Minecraft.getMinecraft().thePlayer, - Minecraft.getMinecraft().theWorld, - Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), + if (Main.mc.currentScreen == null && stand != null && !sell) { + if (Main.mc.playerController.onPlayerRightClick( + Main.mc.thePlayer, + Main.mc.theWorld, + Main.mc.thePlayer.inventory.getCurrentItem(), stand, - EnumFacing.fromAngle(Minecraft.getMinecraft().thePlayer.rotationYaw), + EnumFacing.fromAngle(Main.mc.thePlayer.rotationYaw), new Vec3(Math.random(), Math.random(), Math.random()) )) { - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } } } @@ -60,7 +60,7 @@ public class BrewingMacro { try { if (Main.configFile.alchindex == 0) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber < 54) { @@ -68,7 +68,7 @@ public class BrewingMacro { Thread.sleep(sleep); if (isInventoryFull()) { sell = true; - Minecraft.getMinecraft().thePlayer.sendChatMessage("/sbmenu"); + Main.mc.thePlayer.sendChatMessage("/sbmenu"); } } } @@ -78,7 +78,7 @@ public class BrewingMacro { Thread.sleep(sleep); clickSlot(22, 0, 0); } else if (chestName.contains("Trades")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if ((slot.getStack().getDisplayName().contains("Speed") || slot.getStack().getDisplayName().contains("Weakness")) && slot.slotNumber >= 54) { @@ -86,13 +86,13 @@ public class BrewingMacro { Thread.sleep(sleep); } } - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); sell = false; } } } else if (Main.configFile.alchindex == 1) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(42).getHasStack()) { @@ -103,12 +103,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 2) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -123,12 +123,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 3) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -143,12 +143,12 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } else if (Main.configFile.alchindex == 4) { if (chestName.contains("Brewing Stand")) { - List<Slot> chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; + List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots; for (Slot slot : chestInventory) { if (!slot.getHasStack()) continue; if (!chestInventory.get(13).getHasStack()) { @@ -163,7 +163,7 @@ public class BrewingMacro { } } if (Main.configFile.alchclose) { - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } @@ -188,7 +188,7 @@ public class BrewingMacro { } private boolean isInventoryFull() { - List<Slot> inventory = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots; + List<Slot> inventory = Main.mc.thePlayer.inventoryContainer.inventorySlots; for (Slot slot : inventory) { if (!slot.getHasStack() && slot.slotNumber > 8) { return false; @@ -199,16 +199,16 @@ public class BrewingMacro { private BlockPos closestStand() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> stands = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.brewing_stand) { stands.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -230,6 +230,6 @@ public class BrewingMacro { } private void clickSlot(int slot, int type, int mode) { - Minecraft.getMinecraft().playerController.windowClick(Minecraft.getMinecraft().thePlayer.openContainer.windowId, slot, type, mode, Minecraft.getMinecraft().thePlayer); + Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId, slot, type, mode, Main.mc.thePlayer); } } diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java index 0a93a85..5f656d9 100644 --- a/src/main/java/rosegoldaddons/features/CanePlanter.java +++ b/src/main/java/rosegoldaddons/features/CanePlanter.java @@ -25,24 +25,24 @@ public class CanePlanter { int cane = findItemInHotbar("Cane"); BlockPos dirt = furthestEmptyDirt(); if (cane != -1 && dirt != null) { - ItemStack item = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(cane); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = cane; - Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, item, dirt, EnumFacing.UP, Minecraft.getMinecraft().thePlayer.getLookVec()); + 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 = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + 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)); } @@ -64,7 +64,7 @@ public class CanePlanter { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/CropNuker.java b/src/main/java/rosegoldaddons/features/CropNuker.java index fc00737..915acae 100644 --- a/src/main/java/rosegoldaddons/features/CropNuker.java +++ b/src/main/java/rosegoldaddons/features/CropNuker.java @@ -22,15 +22,15 @@ public class CropNuker { private static int ticks = 0; @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { + public void onTick(TickEvent.PlayerTickEvent event) { //if(event.phase == TickEvent.Phase.END) return; - if (!Main.nukeCrops || Minecraft.getMinecraft().thePlayer == null) { + if (!Main.nukeCrops || Main.mc.thePlayer == null) { broken.clear(); return; } crop = closestCrop(); if (crop != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, crop, EnumFacing.DOWN)); PlayerUtils.swingItem(); broken.add(crop); } @@ -46,11 +46,11 @@ public class CropNuker { } private BlockPos closestCrop() { - if(Minecraft.getMinecraft().theWorld == null) return null; + if(Main.mc.theWorld == null) return null; double r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); if (Main.configFile.farmShapeIndex == 1) { vec3i = new Vec3i(r, 2, r); @@ -61,16 +61,16 @@ public class CropNuker { switch (Main.configFile.farmNukeIndex) { case 0: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.nether_wart || blockState.getBlock() == Blocks.potatoes || blockState.getBlock() == Blocks.wheat || blockState.getBlock() == Blocks.carrots || blockState.getBlock() == Blocks.pumpkin || blockState.getBlock() == Blocks.melon_block || blockState.getBlock() == Blocks.brown_mushroom || blockState.getBlock() == Blocks.red_mushroom || blockState.getBlock() == Blocks.cocoa) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -107,26 +107,62 @@ public class CropNuker { break; case 1: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3iCane), playerPos.subtract(vec3iCane))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.reeds || blockState.getBlock() == Blocks.cactus) { - if (!broken.contains(blockPos)) { - warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + if (Main.configFile.farmShapeIndex == 0) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } else if (Main.configFile.farmShapeIndex == 1) { + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); + switch (dir) { + case NORTH: + if (blockPos.getZ() < z && blockPos.getX() == x) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case SOUTH: + if (blockPos.getZ() > z && blockPos.getX() == x) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case WEST: + if (blockPos.getX() < x && blockPos.getZ() == z) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + case EAST: + if (blockPos.getX() > x && blockPos.getZ() == z) { + if (!broken.contains(blockPos)) { + warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + break; + } } } } break; case 2: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.nether_wart) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -163,16 +199,16 @@ public class CropNuker { break; case 3: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.wheat) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -209,16 +245,16 @@ public class CropNuker { break; case 4: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.carrots) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -255,16 +291,16 @@ public class CropNuker { break; case 5: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.potatoes) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -301,16 +337,16 @@ public class CropNuker { break; case 6: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.pumpkin) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -347,16 +383,16 @@ public class CropNuker { break; case 7: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.melon_block) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { @@ -393,16 +429,16 @@ public class CropNuker { break; case 8: for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.cocoa) { if (Main.configFile.farmShapeIndex == 0) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } else if (Main.configFile.farmShapeIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: if (blockPos.getZ() < z && blockPos.getX() == x) { diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 41ba9a7..b776f86 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -23,13 +23,13 @@ public class CustomItemMacro { if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { try { - int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + int prevItem = Main.mc.thePlayer.inventory.currentItem; 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; - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(slot)); + Main.mc.thePlayer.inventory.currentItem = slot; + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(slot)); } } } @@ -37,13 +37,13 @@ public class CustomItemMacro { if (milis % Math.floor(UseCooldown.LCitems.get(i)/100) == 0) { int slot = findItemInHotbar(i); if (slot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = slot; + Main.mc.thePlayer.inventory.currentItem = slot; Thread.sleep(100); click(); } } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; + Main.mc.thePlayer.inventory.currentItem = prevItem; milis++; Thread.sleep(100); } catch (Exception e) { @@ -63,15 +63,15 @@ public class CustomItemMacro { clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); } clickMouse.setAccessible(true); - clickMouse.invoke(Minecraft.getMinecraft()); + clickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); }*/ - Minecraft.getMinecraft().thePlayer.swingItem(); + Main.mc.thePlayer.swingItem(); } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/DamagePerSecond.java b/src/main/java/rosegoldaddons/features/DamagePerSecond.java deleted file mode 100644 index e0d990f..0000000 --- a/src/main/java/rosegoldaddons/features/DamagePerSecond.java +++ /dev/null @@ -1,12 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.client.Minecraft; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class DamagePerSecond { - @SubscribeEvent - public void onEntityJoin(EntityJoinWorldEvent event) { - - } -} diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index 5e88e74..b0ff72a 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -34,10 +34,10 @@ public class EndermanMacro { private static Entity getClosestEnderman() { Entity eman = null; double closest = 9999; - if(Minecraft.getMinecraft().theWorld == null) return null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { - if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0) && Minecraft.getMinecraft().thePlayer.canEntityBeSeen(entity1)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + if(Main.mc.theWorld == null) return null; + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { + if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0) && Main.mc.thePlayer.canEntityBeSeen(entity1)) { + double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index f59c37a..21a4691 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -96,7 +96,7 @@ public class EntityReach { private static Entity getClosestArmorStand(Entity entity) { Entity closest = null; double smallest = 9999; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityArmorStand) { double dist = entity.getDistanceToEntity(entity1); if(dist < smallest) { @@ -109,8 +109,8 @@ public class EntityReach { } 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); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(event.partialTicks); look = scaleVec(look, 0.2F); for (int i = 0; i < 320; 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) { @@ -124,7 +124,7 @@ public class EntityReach { private static ArrayList<Entity> getAllEntitiesInRange() { ArrayList<Entity> entities = new ArrayList<>(); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (!(entity1 instanceof EntityItem) && !(entity1 instanceof EntityXPOrb) &&!(entity1 instanceof EntityWither) && !(entity1 instanceof EntityPlayerSP)) { entities.add(entity1); } @@ -133,13 +133,13 @@ public class EntityReach { } private static void interactWithEntity(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.interactWithEntitySendPacket(Minecraft.getMinecraft().thePlayer, entity); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.interactWithEntitySendPacket(Main.mc.thePlayer, entity); } private static void interactWithEntity2(Entity entity) { - PlayerControllerMP playerControllerMP = Minecraft.getMinecraft().playerController; - playerControllerMP.isPlayerRightClickingOnEntity(Minecraft.getMinecraft().thePlayer, entity, Minecraft.getMinecraft().objectMouseOver); + PlayerControllerMP playerControllerMP = Main.mc.playerController; + playerControllerMP.isPlayerRightClickingOnEntity(Main.mc.thePlayer, entity, Main.mc.objectMouseOver); } diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index c284e92..e06d7ea 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -30,7 +30,7 @@ public class ForagingIslandMacro { thread = new Thread(() -> { try { BlockPos furthestDirt = furthestEmptyDirt(); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText("furthest dirt "+furthestDirt)); int sapling = findItemInHotbar("Jungle Sapling"); if(sapling == -1) { sapling = findItemInHotbar("Oak Sapling"); @@ -60,16 +60,16 @@ public class ForagingIslandMacro { RotationUtils.facePos(new Vec3(furthestDirt.getX() + 0.5, furthestDirt.getY() - 0.5, furthestDirt.getZ() + 0.5)); Thread.sleep(Main.configFile.smoothLookVelocity * 2L); if (sapling != -1) { - if (Minecraft.getMinecraft().objectMouseOver.typeOfHit.toString().equals("BLOCK")) { - BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); - Block block = Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock(); + if (Main.mc.objectMouseOver.typeOfHit.toString().equals("BLOCK")) { + BlockPos pos = Main.mc.objectMouseOver.getBlockPos(); + Block block = Main.mc.theWorld.getBlockState(pos).getBlock(); if (block == Blocks.sapling) { click(); Thread.sleep(20); } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = sapling; - //Minecraft.getMinecraft().playerController.onPlayerRightClick(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(), furthestDirt, EnumFacing.NORTH, Minecraft.getMinecraft().objectMouseOver.hitVec); + Main.mc.thePlayer.inventory.currentItem = sapling; + //Main.mc.playerController.onPlayerRightClick(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getCurrentItem(), furthestDirt, EnumFacing.NORTH, Main.mc.objectMouseOver.hitVec); rightClick(); } } else { @@ -77,7 +77,7 @@ public class ForagingIslandMacro { if (dirt != null) { 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; + Main.mc.thePlayer.inventory.currentItem = bonemeal; Random rand = new Random(); int toAdd = 0; if(Main.configFile.randomizeForaging) { @@ -87,13 +87,13 @@ public class ForagingIslandMacro { Thread.sleep(Math.round(150*(1+(toAdd/100)))); rightClick(); rightClick(); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = treecap; + Main.mc.thePlayer.inventory.currentItem = treecap; Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100)))); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), true); Thread.sleep(Math.round(150*(1+(toAdd/100)))); - KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), false); Thread.sleep(Math.round(25*(1+(toAdd/100)))); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = rod; + Main.mc.thePlayer.inventory.currentItem = rod; Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100)))); rightClick(); Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100)))); @@ -124,9 +124,9 @@ public class ForagingIslandMacro { new Thread(() -> { try { Thread.sleep(rand2); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac "+responses[rand]); + Main.mc.thePlayer.sendChatMessage("/ac "+responses[rand]); Thread.sleep(rand2*2); - Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); + Main.mc.getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Antisus activated lets hope you didnt get banned")); } catch (Exception exception) { exception.printStackTrace(); } @@ -137,16 +137,16 @@ public class ForagingIslandMacro { private BlockPos furthestEmptyDirt() { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - IBlockState blockState2 = Minecraft.getMinecraft().theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + 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)); } @@ -169,15 +169,15 @@ public class ForagingIslandMacro { private BlockPos closestDirt() { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> dirts = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.dirt) { dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -199,7 +199,7 @@ public class ForagingIslandMacro { } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -220,7 +220,7 @@ public class ForagingIslandMacro { rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } @@ -235,32 +235,32 @@ public class ForagingIslandMacro { clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); } clickMouse.setAccessible(true); - clickMouse.invoke(Minecraft.getMinecraft()); + clickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static void playAlert() { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } private static void playAnnoyingAlert() { new Thread(() -> { try { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); Thread.sleep(100); - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } catch (Exception exception) { exception.printStackTrace(); } diff --git a/src/main/java/rosegoldaddons/features/ForagingNuker.java b/src/main/java/rosegoldaddons/features/ForagingNuker.java index dcd3100..67b6cd7 100644 --- a/src/main/java/rosegoldaddons/features/ForagingNuker.java +++ b/src/main/java/rosegoldaddons/features/ForagingNuker.java @@ -19,7 +19,7 @@ public class ForagingNuker { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.nukeWood || Minecraft.getMinecraft().thePlayer == null || !Minecraft.getMinecraft().thePlayer.onGround) { + if (!Main.nukeWood || Main.mc.thePlayer == null || !Main.mc.thePlayer.onGround) { broken.clear(); return; } @@ -28,7 +28,7 @@ public class ForagingNuker { if(broken.size() > 10) { broken.clear(); } - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, wood, EnumFacing.DOWN)); PlayerUtils.swingItem(); broken.add(wood); } @@ -37,14 +37,14 @@ public class ForagingNuker { private BlockPos closestWood() { int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> warts = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.log || blockState.getBlock() == Blocks.log2) { if (!broken.contains(blockPos)) { warts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index 3e0952b..28f30af 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -36,14 +36,14 @@ public class GemstoneAura { return; } if (event.phase == TickEvent.Phase.END) { - if (PlayerUtils.pickaxeAbilityReady && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + if (PlayerUtils.pickaxeAbilityReady && Main.mc.thePlayer != null) { + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if (currentDamage > 100) { currentDamage = 0; } if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() != Blocks.stained_glass && blockState.getBlock() != Blocks.stained_glass_pane) { currentDamage = 0; } @@ -56,11 +56,11 @@ public class GemstoneAura { blockHitDelay--; return; } - MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition fake = Main.mc.objectMouseOver; fake.hitVec = new Vec3(blockPos); EnumFacing enumFacing = fake.sideHit; if (currentDamage == 0 && enumFacing != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, enumFacing)); } PlayerUtils.swingItem(); @@ -74,7 +74,7 @@ public class GemstoneAura { public void renderWorld(RenderWorldLastEvent event) { if (!Main.gemNukeToggle) return; if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); EnumDyeColor dyeColor = null; Color color = Color.BLACK; if (blockState.getBlock() == Blocks.stained_glass) { @@ -104,15 +104,15 @@ public class GemstoneAura { private BlockPos closestGemstone() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.stained_glass) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -124,7 +124,7 @@ public class GemstoneAura { } if (Main.configFile.prioblocks) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.stained_glass_pane) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 364471b..1e9f467 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -36,10 +36,10 @@ public class GhostMacro { private static Entity getClosestCreeper() { Entity eman = null; double closest = 9999.0; - if(Minecraft.getMinecraft().theWorld == null) return null; - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + if(Main.mc.theWorld == null) return null; + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityCreeper && !(((EntityCreeper) entity1).getHealth() == 0)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + double dist = entity1.getDistance(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 51f3aeb..8cecae7 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -1,5 +1,8 @@ package rosegoldaddons.features; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; @@ -7,6 +10,7 @@ import net.minecraft.client.settings.GameSettings; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; +import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S2APacketParticles; import net.minecraft.util.*; @@ -18,6 +22,7 @@ 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; @@ -32,6 +37,8 @@ public class HardstoneAura { private static Vec3 closestChest; private boolean stopHardstone = false; private static int ticks = 0; + private static BlockPos gemstone; + private static BlockPos lastGem; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { @@ -48,26 +55,35 @@ public class HardstoneAura { } } if(Main.configFile.hardIndex == 1) { - if (broken.size() > 4) { + if (broken.size() > 6) { broken.clear(); } } - if(ticks > 15) { + if(ticks > 20) { broken.clear(); ticks = 0; } closestStone = closestStone(); - if (closestStone != null) { - MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; + if(gemstone != null && Main.mc.thePlayer != null) { + if(lastGem != null && !lastGem.equals(gemstone)) { + currentDamage = 0; + } + lastGem = gemstone; + if (currentDamage == 0) { + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, gemstone, EnumFacing.DOWN)); + } + PlayerUtils.swingItem(); + currentDamage++; + } + if (closestStone != null && gemstone == null) { + currentDamage = 0; + MovingObjectPosition fake = Main.mc.objectMouseOver; fake.hitVec = new Vec3(closestStone); EnumFacing enumFacing = fake.sideHit; - if (currentDamage == 0 && enumFacing != null && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); - } - MovingObjectPosition real = Minecraft.getMinecraft().objectMouseOver; - if (real != null && real.entityHit == null && Minecraft.getMinecraft().thePlayer != null) { - Minecraft.getMinecraft().thePlayer.swingItem(); + if (enumFacing != null && Main.mc.thePlayer != null) { + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); } + PlayerUtils.swingItem(); broken.add(closestStone); } } @@ -79,14 +95,11 @@ public class HardstoneAura { if (event.packet instanceof S2APacketParticles) { S2APacketParticles packet = (S2APacketParticles) event.packet; if (packet.getParticleType().equals(EnumParticleTypes.CRIT)) { - Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate() - 0.7, packet.getZCoordinate()); + Vec3 particlePos = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate()); if (closestChest != null) { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - particlePos = particlePos.add(new Vec3(0, -1, 0)); - int drill = PowderMacro.findItemInHotbar("X655"); - if (drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill; RotationUtils.facePos(particlePos); } } @@ -97,7 +110,7 @@ public class HardstoneAura { @SubscribeEvent public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) { if(Main.configFile.guilag) { - Minecraft.getMinecraft().gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); + Main.mc.gameSettings.setOptionFloatValue(GameSettings.Options.FRAMERATE_LIMIT, 1); } if(!Main.autoHardStone) return; if (event.gui instanceof GuiChest) { @@ -107,7 +120,7 @@ public class HardstoneAura { if (chestName.contains("Treasure")) { solved.add(closestChest); stopHardstone = false; - Minecraft.getMinecraft().thePlayer.closeScreen(); + Main.mc.thePlayer.closeScreen(); } } } @@ -126,6 +139,33 @@ public class HardstoneAura { } else { stopHardstone = false; } + if (gemstone != null) { + IBlockState blockState = Main.mc.theWorld.getBlockState(gemstone); + EnumDyeColor dyeColor = null; + Color color = Color.BLACK; + if (blockState.getBlock() == Blocks.stained_glass) { + dyeColor = blockState.getValue(BlockStainedGlass.COLOR); + } + if (blockState.getBlock() == Blocks.stained_glass_pane) { + dyeColor = blockState.getValue(BlockStainedGlassPane.COLOR); + } + if (dyeColor == EnumDyeColor.RED) { + color = new Color(188, 3, 29); + } else if (dyeColor == EnumDyeColor.PURPLE) { + color = new Color(137, 0, 201); + } else if (dyeColor == EnumDyeColor.LIME) { + color = new Color(157, 249, 32); + } else if (dyeColor == EnumDyeColor.LIGHT_BLUE) { + color = new Color(60, 121, 224); + } else if (dyeColor == EnumDyeColor.ORANGE) { + color = new Color(237, 139, 35); + } else if (dyeColor == EnumDyeColor.YELLOW) { + color = new Color(249, 215, 36); + } else if (dyeColor == EnumDyeColor.MAGENTA) { + color = new Color(214, 15, 150); + } + RenderUtils.drawBlockBox(gemstone, color, true, event.partialTicks); + } } @SubscribeEvent @@ -134,18 +174,19 @@ public class HardstoneAura { } private BlockPos closestStone() { - if(Minecraft.getMinecraft().theWorld == null) return null; - if(Minecraft.getMinecraft().thePlayer == null) return null; + if(Main.mc.theWorld == null) return null; + if(Main.mc.thePlayer == null) return null; int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); Vec3i vec3i2 = new Vec3i(r, 0, r); ArrayList<Vec3> stones = new ArrayList<Vec3>(); + ArrayList<Vec3> gemstones = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(Main.configFile.hardIndex == 0) { if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); @@ -157,13 +198,16 @@ public class HardstoneAura { } } if(Main.configFile.hardIndex == 1) { - EnumFacing dir = Minecraft.getMinecraft().thePlayer.getHorizontalFacing(); - int x = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posX); - int z = (int) Math.floor(Minecraft.getMinecraft().thePlayer.posZ); + EnumFacing dir = Main.mc.thePlayer.getHorizontalFacing(); + int x = (int) Math.floor(Main.mc.thePlayer.posX); + int z = (int) Math.floor(Main.mc.thePlayer.posZ); switch (dir) { case NORTH: - if(blockPos.getZ() < z && blockPos.getX() == x) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if(blockPos.getZ() <= z && blockPos.getX() == x) { + 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)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { @@ -174,8 +218,11 @@ public class HardstoneAura { } break; case SOUTH: - if(blockPos.getZ() > z && blockPos.getX() == x) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if(blockPos.getZ() >= z && blockPos.getX() == x) { + 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)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { @@ -186,8 +233,11 @@ public class HardstoneAura { } break; case WEST: - if(blockPos.getX() < x && blockPos.getZ() == z) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if(blockPos.getX() <= x && blockPos.getZ() == z) { + 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)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { @@ -198,8 +248,11 @@ public class HardstoneAura { } break; case EAST: - if(blockPos.getX() > x && blockPos.getZ() == z) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if(blockPos.getX() >= x && blockPos.getZ() == z) { + 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)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { @@ -222,6 +275,21 @@ public class HardstoneAura { closest = stone; } } + + double smallestgem = 9999; + Vec3 closestgem = null; + for (Vec3 gem : gemstones) { + double dist = gem.distanceTo(playerVec); + if (dist < smallestgem) { + smallestgem = dist; + closestgem = gem; + } + } + if (closestgem != null) { + gemstone = new BlockPos(closestgem.xCoord, closestgem.yCoord, closestgem.zCoord); + } else { + gemstone = null; + } if (closest != null && smallest < 5) { return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); } @@ -229,18 +297,18 @@ public class HardstoneAura { } private Vec3 closestChest() { - if(Minecraft.getMinecraft().theWorld == null) return null; - if(Minecraft.getMinecraft().thePlayer == null) return null; + if(Main.mc.theWorld == null) return null; + if(Main.mc.thePlayer == null) return null; int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.chest) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -259,4 +327,21 @@ public class HardstoneAura { } return closest; } + + private boolean isSlow(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; + } else if(blockState.getBlock() == Blocks.stained_glass_pane || blockState.getBlock() == Blocks.stained_glass) { + return true; + } + return false; + } } diff --git a/src/main/java/rosegoldaddons/features/MithrilMacro.java b/src/main/java/rosegoldaddons/features/MithrilMacro.java new file mode 100644 index 0000000..ce9509b --- /dev/null +++ b/src/main/java/rosegoldaddons/features/MithrilMacro.java @@ -0,0 +1,133 @@ +package rosegoldaddons.features; + +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.network.play.client.C07PacketPlayerDigging; +import net.minecraft.util.*; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; +import rosegoldaddons.utils.*; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Random; + +public class MithrilMacro { + private Vec3 vec = null; + private int currentDamage; + private BlockPos blockPos = null; + private Vec3 lastVec = null; + private BlockPos lastBlockPos = null; + private final KeyBinding lc = Main.mc.gameSettings.keyBindAttack; + private boolean holdingLeft = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) return; + if (Main.mc.currentScreen != null) return; + if (!Main.mithrilMacro) { + if (holdingLeft) { + KeyBinding.setKeyBindState(lc.getKeyCode(), false); + holdingLeft = false; + } + currentDamage = 0; + return; + } + 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 (currentDamage > 100) { + KeyBinding.setKeyBindState(lc.getKeyCode(), false); + currentDamage = 0; + } + lastBlockPos = blockPos; + blockPos = closestMithril(); + if (lastBlockPos != null && blockPos != null && !lastBlockPos.equals(blockPos)) { + ChatUtils.sendMessage("Block pos was changed."); + currentDamage = 0; + } + if (blockPos != null) { + ArrayList<Vec3> vec3s = BlockUtils.whereToMineBlock(blockPos); + if (vec3s.size() > 0) { + vec = vec3s.get(0); + if (vec != null) { + RotationUtils.facePos(vec); + lastVec = vec; + KeyBinding.setKeyBindState(lc.getKeyCode(), true); + holdingLeft = true; + } + + currentDamage += 1; + } + } + + } + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + if (!Main.mithrilMacro) return; + if (vec != null) { + RenderUtils.drawPixelBox(vec, Color.RED, 0.01, event.partialTicks); + } + if (blockPos != null) { + RenderUtils.drawBlockBox(blockPos, Color.CYAN, true, event.partialTicks); + } + } + + private BlockPos closestMithril() { + int r = 6; + if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition().add(0, 1, 0); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(r, r, r); + ArrayList<Vec3> blocks = new ArrayList<Vec3>(); + if (playerPos != null) { + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if (isMithril(blockState)) { + if (BlockUtils.whereToMineBlock(blockPos).size() > 0) { + blocks.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + } + } + double smallest = 9999; + Vec3 closest = null; + for (Vec3 block : blocks) { + double dist = block.distanceTo(playerVec); + if (lastBlockPos != null) { + dist = block.distanceTo(new Vec3(lastBlockPos.getX() + 0.5, lastBlockPos.getY() + 0.5, lastBlockPos.getZ() + 0.5)); + } + if (dist < smallest) { + smallest = dist; + closest = block; + } + } + if (closest != null && smallest < 5) { + return new BlockPos(closest.xCoord, closest.yCoord, closest.zCoord); + } + return null; + } + + 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; + } + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index c84b378..2e2e9e5 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -24,19 +24,19 @@ public class MithrilNuker { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.mithrilNuker || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) { + if (!Main.mithrilNuker || Main.mc.thePlayer == null || Main.mc.theWorld == null) { currentDamage = 0; return; } if (event.phase == TickEvent.Phase.END) { if(PlayerUtils.pickaxeAbilityReady) { - Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); + Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if(currentDamage > 100) { currentDamage = 0; } - if(blockPos != null && Minecraft.getMinecraft().theWorld != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + if(blockPos != null && Main.mc.theWorld != null) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (blockState.getBlock() == Blocks.bedrock || blockState.getBlock() == Blocks.air) { currentDamage = 0; } @@ -50,7 +50,7 @@ public class MithrilNuker { return; } if (currentDamage == 0) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.DOWN)); if(Main.configFile.mithrilLook) { RotationUtils.facePos(new Vec3(blockPos.getX() + 0.5, blockPos.getY() - 1, blockPos.getZ() + 0.5)); } @@ -64,9 +64,9 @@ public class MithrilNuker { @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { - if (!Main.mithrilNuker || Minecraft.getMinecraft().theWorld == null) return; + if (!Main.mithrilNuker || Main.mc.theWorld == null) return; if (blockPos != null) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if(blockState.getBlock() == Blocks.stone) { RenderUtils.drawBlockBox(blockPos, Color.WHITE, true, event.partialTicks); } else { @@ -77,15 +77,15 @@ public class MithrilNuker { private BlockPos closestMithril() { int r = 6; - if (Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) return null; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + if (Main.mc.thePlayer == null || Main.mc.theWorld == null) return null; + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos = playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (isMithril(blockState)) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } diff --git a/src/main/java/rosegoldaddons/features/NecronAimbot.java b/src/main/java/rosegoldaddons/features/NecronAimbot.java index 59e1493..b491951 100644 --- a/src/main/java/rosegoldaddons/features/NecronAimbot.java +++ b/src/main/java/rosegoldaddons/features/NecronAimbot.java @@ -26,9 +26,9 @@ public class NecronAimbot { private static Entity getClosestWither() { Entity necron = null; Double closest = Double.valueOf(9999); - for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + for (Entity entity1 : (Main.mc.theWorld.loadedEntityList)) { if (entity1 instanceof EntityWither && !(((EntityWither) entity1).getHealth() == 0)) { - double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); + double dist = entity1.getDistanceSq(Main.mc.thePlayer.posX, Main.mc.thePlayer.posY, Main.mc.thePlayer.posZ); if (dist < closest) { closest = dist; necron = entity1; diff --git a/src/main/java/rosegoldaddons/features/PartyUntransfer.java b/src/main/java/rosegoldaddons/features/PartyUntransfer.java index c88b4e3..be4f89d 100644 --- a/src/main/java/rosegoldaddons/features/PartyUntransfer.java +++ b/src/main/java/rosegoldaddons/features/PartyUntransfer.java @@ -13,14 +13,14 @@ public class PartyUntransfer { if (!Main.configFile.AutoUntransfer) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()).toLowerCase(); if (message.contains("the party was transferred to")) { - String playerName = Minecraft.getMinecraft().thePlayer.getName(); + String playerName = Main.mc.thePlayer.getName(); String leader = stripRank(message.substring(message.indexOf("by")+3)); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader); + Main.mc.thePlayer.sendChatMessage("/p transfer "+leader); } if(message.contains("has promoted")) { - String playerName = Minecraft.getMinecraft().thePlayer.getName(); + String playerName = Main.mc.thePlayer.getName(); String leader = stripRank(message.substring(0 ,message.indexOf("has promoted")-1)); - Minecraft.getMinecraft().thePlayer.sendChatMessage("/p transfer "+leader); + Main.mc.thePlayer.sendChatMessage("/p transfer "+leader); } } diff --git a/src/main/java/rosegoldaddons/features/PingWorldChange.java b/src/main/java/rosegoldaddons/features/PingWorldChange.java index 9f9663b..0ac8cb6 100644 --- a/src/main/java/rosegoldaddons/features/PingWorldChange.java +++ b/src/main/java/rosegoldaddons/features/PingWorldChange.java @@ -17,7 +17,7 @@ public class PingWorldChange { if(Main.configFile.pingworldchange && countdown == 0) { String url = Main.configFile.hookurl; String id = Main.configFile.discordid; - if(url.contains("https://discord.com/api/webhooks/")) { + if(url.contains("https://") && (url.contains("discord.com/api/webhooks/") || url.contains("discordapp.com/api/webhooks/"))) { if(!id.equals("")) { DiscordWebhook webhook = new DiscordWebhook(url); webhook.setContent("<@" + id + "> Detected World Change."); diff --git a/src/main/java/rosegoldaddons/features/PinglessMining.java b/src/main/java/rosegoldaddons/features/PinglessMining.java index 9b21e91..c617ae4 100644 --- a/src/main/java/rosegoldaddons/features/PinglessMining.java +++ b/src/main/java/rosegoldaddons/features/PinglessMining.java @@ -20,7 +20,7 @@ import java.util.ArrayList; public class PinglessMining { private static BlockPos block = null; private static final ArrayList<BlockPos> broken = new ArrayList<>(); - private final KeyBinding lc = Minecraft.getMinecraft().gameSettings.keyBindAttack; + private final KeyBinding lc = Main.mc.gameSettings.keyBindAttack; private static int ticks = 0; @SubscribeEvent @@ -33,13 +33,14 @@ public class PinglessMining { } if (lc != null && lc.isKeyDown()) { if (block != null) { - MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); + Block b = Main.mc.theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore || - b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) { + b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore || + b == Blocks.nether_wart || b == Blocks.reeds || b == Blocks.potatoes || b == Blocks.carrots) { broken.add(block); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); PlayerUtils.swingItem(); } } @@ -48,7 +49,7 @@ public class PinglessMining { } @SubscribeEvent - public void onTick40(TickEvent.PlayerTickEvent event) { + public void onTick40(TickEvent.ClientTickEvent event) { if (!Main.configFile.pinglessMining) return; if (Main.configFile.pinglessSpeed == 2) return; if (Main.configFile.pinglessSpeed == 0 && event.phase == TickEvent.Phase.END) return; @@ -58,13 +59,13 @@ public class PinglessMining { } if (lc != null && lc.isKeyDown()) { if (block != null) { - MovingObjectPosition movingObjectPosition = Minecraft.getMinecraft().objectMouseOver; + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; if (movingObjectPosition != null && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block b = Minecraft.getMinecraft().theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); + Block b = Main.mc.theWorld.getBlockState(movingObjectPosition.getBlockPos()).getBlock(); if (b == Blocks.stone || b == Blocks.emerald_ore || b == Blocks.lapis_ore || b == Blocks.redstone_ore || b == Blocks.iron_ore || b == Blocks.gold_ore || b == Blocks.coal_ore || b == Blocks.diamond_ore) { broken.add(block); - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); + Main.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, block, EnumFacing.DOWN)); PlayerUtils.swingItem(); } } @@ -74,7 +75,7 @@ public class PinglessMining { @SubscribeEvent public void onRender(RenderWorldLastEvent event) { - if (!Main.configFile.pinglessMining || Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) { + if (!Main.configFile.pinglessMining || Main.mc.thePlayer == null || Main.mc.theWorld == null) { broken.clear(); return; } @@ -86,12 +87,12 @@ public class PinglessMining { private BlockPos closestBlock(RenderWorldLastEvent event) { int r = 5; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition().add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + BlockPos playerPos = Main.mc.thePlayer.getPosition().add(0, 1, 0); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> blocks = new ArrayList<>(); for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); if (isLookingAtBlock(blockPos, event) && !broken.contains(blockPos) && blockState.getBlock() != Blocks.air) { blocks.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -113,8 +114,8 @@ public class PinglessMining { private boolean isLookingAtBlock(BlockPos blockPos, RenderWorldLastEvent event) { AxisAlignedBB aabb = AxisAlignedBB.fromBounds(blockPos.getX(), blockPos.getY(), blockPos.getZ(), blockPos.getX() + 1, blockPos.getY() + 1, blockPos.getZ() + 1); - 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); + Vec3 position = new Vec3(Main.mc.thePlayer.posX, (Main.mc.thePlayer.posY + Main.mc.thePlayer.getEyeHeight()), Main.mc.thePlayer.posZ); + Vec3 look = Main.mc.thePlayer.getLook(event.partialTicks); look = scaleVec(look, 0.2F); for (int i = 0; i < 40; 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) { diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index e350648..b4d0937 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -35,7 +35,7 @@ public class PowderMacro { if (dist < 1) { particlePos = particlePos.add(new Vec3(0, -1, 0)); int drill = findItemInHotbar("X655"); - if(drill != -1) Minecraft.getMinecraft().thePlayer.inventory.currentItem = drill; + if(drill != -1) Main.mc.thePlayer.inventory.currentItem = drill; RotationUtils.facePos(particlePos); } } @@ -54,15 +54,15 @@ public class PowderMacro { private static Vec3 closestChest() { int r = 6; - BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); + BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); - Vec3 playerVec = Minecraft.getMinecraft().thePlayer.getPositionVector(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); ArrayList<Vec3> chests = new ArrayList<Vec3>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.chest) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } @@ -81,7 +81,7 @@ public class PowderMacro { } public static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 72df86d..54e88f2 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -1,10 +1,15 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.RenderLivingEntityEvent; + +import java.util.Map; public class SexAura { @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -15,19 +20,34 @@ public class SexAura { if (message.startsWith("From") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } } } + @SubscribeEvent + public void onEntityRender(RenderLivingEntityEvent event) { + if (Main.init) { + String text = event.entity.getDisplayName().getFormattedText(); + for (Map.Entry<String, String> entry : Main.resp.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (text.contains(key) && !text.contains(value)) { + event.entity.setCustomNameTag(text.replace(key, value)); + break; + } + } + } + } + private static void playAlert() { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } } diff --git a/src/main/java/rosegoldaddons/features/SwordSwapping.java b/src/main/java/rosegoldaddons/features/SwordSwapping.java index 4a309f0..cc45b6e 100644 --- a/src/main/java/rosegoldaddons/features/SwordSwapping.java +++ b/src/main/java/rosegoldaddons/features/SwordSwapping.java @@ -27,14 +27,14 @@ public class SwordSwapping { rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); } rightClickMouse.setAccessible(true); - rightClickMouse.invoke(Minecraft.getMinecraft()); + rightClickMouse.invoke(Main.mc); } catch (Exception e) { e.printStackTrace(); } } private static int findItemInHotbar(String name) { - InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + InventoryPlayer inv = Main.mc.thePlayer.inventory; for (int i = 0; i < 9; i++) { ItemStack curStack = inv.getStackInSlot(i); if (curStack != null) { @@ -48,7 +48,7 @@ public class SwordSwapping { @SubscribeEvent public void onTick(TickEvent.PlayerTickEvent event) { - if (Minecraft.getMinecraft().currentScreen != null) return; + if (Main.mc.currentScreen != null) return; if (!Main.AOTSMacro && !Main.SoulWhipMacro) { tickCount = 0; return; @@ -57,7 +57,7 @@ public class SwordSwapping { thread = new Thread(() -> { try { Thread.sleep(Main.configFile.swapFrequency); - int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; + int prevItem = Main.mc.thePlayer.inventory.currentItem; int orbSlot = findItemInHotbar("Power Orb"); int tubaSlot = findItemInHotbar("Tuba"); int wandSlot = findItemInHotbar("Atonement"); @@ -70,31 +70,31 @@ public class SwordSwapping { whipSlot = findItemInHotbar("Whip"); } if(whipSlot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = whipSlot; + Main.mc.thePlayer.inventory.currentItem = whipSlot; rightClick(); } if(aotsSlot != -1) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = aotsSlot; + Main.mc.thePlayer.inventory.currentItem = aotsSlot; rightClick(); } if(Main.configFile.UseUtility) { if(tickCount % Math.round((1000/Main.configFile.swapFrequency*20)) == 1 && tubaSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = tubaSlot; + Main.mc.thePlayer.inventory.currentItem = tubaSlot; rightClick(); } if(tickCount % Math.round((1000/Main.configFile.swapFrequency*59)) == 1 && orbSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = orbSlot; + Main.mc.thePlayer.inventory.currentItem = orbSlot; rightClick(); } if(tickCount % Math.round((1000/Main.configFile.swapFrequency*7)) == 1 && wandSlot != -1) { Thread.sleep(1); - Minecraft.getMinecraft().thePlayer.inventory.currentItem = wandSlot; + Main.mc.thePlayer.inventory.currentItem = wandSlot; rightClick(); } } - Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; + Main.mc.thePlayer.inventory.currentItem = prevItem; tickCount++; } catch (Exception e) { e.printStackTrace(); |