diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
5 files changed, 26 insertions, 64 deletions
diff --git a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java index 9df02e9..7f5909d 100644 --- a/src/main/java/rosegoldaddons/features/BloodTriggerBot.java +++ b/src/main/java/rosegoldaddons/features/BloodTriggerBot.java @@ -2,54 +2,33 @@ package rosegoldaddons.features; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.GuiIngameMenu; -import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityWither; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; -import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; -import rosegoldaddons.utils.ChatUtils; -import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.RotationUtils; -import java.awt.*; -import java.lang.reflect.Method; import java.util.ArrayList; public class BloodTriggerBot { - private static String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor", "Spirit Bear"}; - private static ArrayList<Entity> bloodMobs = null; - private Thread thread; + private static final String[] names = {"Bonzo", "Revoker", "Psycho", "Reaper", "Cannibal", "Mute", "Ooze", "Putrid", "Freak", "Leech", "Tear", "Parasite", "Flamer", "Skull", "Mr. Dead", "Vader", "Frost", "Walker", "WanderingSoul", "Shadow Assassin", "Lost Adventurer", "Livid", "Professor", "Spirit Bear"}; @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { + public void renderWorld(TickEvent.ClientTickEvent event) { if (!Main.bloodTriggerBot) return; - bloodMobs = getAllBloodMobs(); - if (thread == null || !thread.isAlive()) { - thread = new Thread(() -> { - try { - for (Entity entity : bloodMobs) { - if (isLookingAtAABB(entity.getEntityBoundingBox(), event)) { - click(); - Thread.sleep(100); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - }, "Blood room thingy"); - thread.start(); + if (event.phase == TickEvent.Phase.END) return; + for (Entity entity : getAllBloodMobs()) { + if (isLookingAtAABB(entity.getEntityBoundingBox(), 1F)) { + Minecraft.getMinecraft().thePlayer.swingItem(); + } } } - private static boolean isLookingAtAABB(AxisAlignedBB aabb, RenderWorldLastEvent event) { + 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(event.partialTicks); + Vec3 look = Minecraft.getMinecraft().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) { @@ -63,6 +42,7 @@ 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 (entity1 instanceof EntityOtherPlayerMP && !entity1.isDead) { for (String name : names) { @@ -79,21 +59,6 @@ public class BloodTriggerBot { } private static Vec3 scaleVec(Vec3 vec, float f) { - return new Vec3(vec.xCoord * (double)f, vec.yCoord * (double)f, vec.zCoord * (double)f); - } - - public static void click() { - try { - Method clickMouse; - try { - clickMouse = Minecraft.class.getDeclaredMethod("func_147116_af"); - } catch (NoSuchMethodException e) { - clickMouse = Minecraft.class.getDeclaredMethod("clickMouse"); - } - clickMouse.setAccessible(true); - clickMouse.invoke(Minecraft.getMinecraft()); - } catch (Exception e) { - e.printStackTrace(); - } + return new Vec3(vec.xCoord * (double) f, vec.yCoord * (double) f, vec.zCoord * (double) f); } } diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index 750db14..41ba9a7 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -23,7 +23,6 @@ public class CustomItemMacro { if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { try { - milis++; int prevItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; for (String i : UseCooldown.RCitems.keySet()) { if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { @@ -45,6 +44,7 @@ public class CustomItemMacro { } } Minecraft.getMinecraft().thePlayer.inventory.currentItem = prevItem; + milis++; Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index fbbb98d..3e0952b 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -36,19 +36,19 @@ public class GemstoneAura { return; } if (event.phase == TickEvent.Phase.END) { - if(PlayerUtils.pickaxeAbilityReady && Minecraft.getMinecraft().thePlayer != null) { + 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(currentDamage > 100) { + if (currentDamage > 100) { currentDamage = 0; } - if(blockPos != null) { + if (blockPos != null) { IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); if (blockState.getBlock() != Blocks.stained_glass && blockState.getBlock() != Blocks.stained_glass_pane) { currentDamage = 0; } } - if(currentDamage == 0) { + if (currentDamage == 0) { blockPos = closestGemstone(); } if (blockPos != null) { @@ -113,23 +113,20 @@ public class GemstoneAura { if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); if (blockState.getBlock() == Blocks.stained_glass) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - if(!Main.configFile.prioblocks) { + if (!Main.configFile.prioblocks) { if (blockState.getBlock() == Blocks.stained_glass_pane) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } } - if(Main.configFile.prioblocks) { + if (Main.configFile.prioblocks) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(blockPos); - if(!Main.configFile.prioblocks) { - if (blockState.getBlock() == Blocks.stained_glass_pane) { - chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } + 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/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index 5342f58..a6c2be4 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -91,6 +91,11 @@ public class MithrilNuker { if (isMithril(blockState)) { chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } + if(Main.configFile.includeOres) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack ) { + chests.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } } } double smallest = 9999; diff --git a/src/main/java/rosegoldaddons/features/TpMe.java b/src/main/java/rosegoldaddons/features/TpMe.java deleted file mode 100644 index 4134ca9..0000000 --- a/src/main/java/rosegoldaddons/features/TpMe.java +++ /dev/null @@ -1,5 +0,0 @@ -package rosegoldaddons.features; - -public class TpMe { - -} |