diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-04 14:17:32 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-04 14:17:32 +0200 |
commit | 20894963147ef84a7ad7d578191de69a856f6403 (patch) | |
tree | 34bf1488f2042630c595f557543d324510bd1429 /src/main/java/rosegoldaddons/features | |
parent | f4b58abbda168b01513a5ac2ba2870bc00df7074 (diff) | |
download | RGA-20894963147ef84a7ad7d578191de69a856f6403.tar.gz RGA-20894963147ef84a7ad7d578191de69a856f6403.tar.bz2 RGA-20894963147ef84a7ad7d578191de69a856f6403.zip |
2.7.1
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
12 files changed, 278 insertions, 163 deletions
diff --git a/src/main/java/rosegoldaddons/features/AutoGhostBlock.java b/src/main/java/rosegoldaddons/features/AutoGhostBlock.java new file mode 100644 index 0000000..76ca185 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoGhostBlock.java @@ -0,0 +1,143 @@ +package rosegoldaddons.features; + +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import rosegoldaddons.Main; + +public class AutoGhostBlock { + private final KeyBinding sneakBind = Minecraft.getMinecraft().gameSettings.keyBindSneak; + private final KeyBinding jumpBind = Minecraft.getMinecraft().gameSettings.keyBindJump; + + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(Main.configFile.ghostIndex == 0) { + if (!Main.configFile.AutoGB || !Main.configFile.AutoGBTopStair) return; + if (sneakBind.isKeyDown() && Main.configFile.AutoGB) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 1, 3); + Vec3i vec3i2 = new Vec3i(3, 2, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if (diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if (isStair(blockState) && diffY == -0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + if (Main.configFile.AutoGBMisc) { + if (blockState.getBlock() == Blocks.skull && diffY == 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } else if (blockState.getBlock() == Blocks.hopper && diffY == -0.625) { + Main.mc.theWorld.setBlockToAir(blockPos); + } else if (isFence(blockState) && diffY <= 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + } + if(jumpBind.isKeyDown() && Main.configFile.AutoGBTopStair) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 2, 3); + Vec3i vec3i2 = new Vec3i(3, 0, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY > 1.2 && diffY < 1.3) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + + @SubscribeEvent + public void onKeyPress(InputEvent.KeyInputEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if(Main.configFile.ghostIndex == 0) return; + if(!Main.configFile.AutoGB || !Main.configFile.AutoGBTopStair) return; + if(sneakBind.isPressed() && Main.configFile.AutoGB) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 1, 3); + Vec3i vec3i2 = new Vec3i(3, 2, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY == -0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + if(Main.configFile.AutoGBMisc) { + if(blockState.getBlock() == Blocks.skull && diffY == 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + else if(blockState.getBlock() == Blocks.hopper && diffY == -0.625) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + else if(isFence(blockState) && diffY <= 0 && diffX < 0.5 && diffZ < 0.5) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + if(jumpBind.isPressed() && Main.configFile.AutoGBTopStair) { + BlockPos playerPos = Main.mc.thePlayer.getPosition(); + Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); + Vec3i vec3i = new Vec3i(3, 2, 3); + Vec3i vec3i2 = new Vec3i(3, 0, 3); + for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i2))) { + double diffX = Math.abs(blockPos.getX() + 0.5D - playerVec.xCoord); + double diffZ = Math.abs(blockPos.getZ() + 0.5D - playerVec.zCoord); + double diffY = blockPos.getY() - playerVec.yCoord; + if(diffX < 1 && diffZ < 1) { + IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); + if(isStair(blockState) && diffY > 1.2 && diffY < 1.3) { + Main.mc.theWorld.setBlockToAir(blockPos); + } + } + } + } + } + + private boolean isStair(IBlockState blockState) { + if(blockState.getBlock() == Blocks.acacia_stairs || blockState.getBlock() == Blocks.birch_stairs || + blockState.getBlock() == Blocks.brick_stairs || blockState.getBlock() == Blocks.stone_brick_stairs || + blockState.getBlock() == Blocks.stone_stairs || blockState.getBlock() == Blocks.dark_oak_stairs || + blockState.getBlock() == Blocks.jungle_stairs || blockState.getBlock() == Blocks.spruce_stairs || + blockState.getBlock() == Blocks.red_sandstone_stairs || blockState.getBlock() == Blocks.sandstone_stairs || + blockState.getBlock() == Blocks.nether_brick_stairs || blockState.getBlock() == Blocks.oak_stairs || + blockState.getBlock() == Blocks.quartz_stairs) + return true; + return false; + } + + private boolean isFence(IBlockState blockState) { + if(blockState.getBlock() == Blocks.acacia_fence || blockState.getBlock() == Blocks.birch_fence || + blockState.getBlock() == Blocks.cobblestone_wall || blockState.getBlock() == Blocks.dark_oak_fence || + blockState.getBlock() == Blocks.jungle_fence || blockState.getBlock() == Blocks.spruce_fence || + blockState.getBlock() == Blocks.oak_fence || blockState.getBlock() == Blocks.nether_brick_fence) + return true; + return false; + } +} diff --git a/src/main/java/rosegoldaddons/features/CanePlanter.java b/src/main/java/rosegoldaddons/features/CanePlanter.java deleted file mode 100644 index 5f656d9..0000000 --- a/src/main/java/rosegoldaddons/features/CanePlanter.java +++ /dev/null @@ -1,78 +0,0 @@ -package rosegoldaddons.features; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; -import net.minecraft.util.Vec3i; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import rosegoldaddons.Main; - -import java.util.ArrayList; - -public class CanePlanter { - //when you're down bad - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.placeCane || event.phase == TickEvent.Phase.END) { - return; - } - int cane = findItemInHotbar("Cane"); - BlockPos dirt = furthestEmptyDirt(); - if (cane != -1 && dirt != null) { - ItemStack item = Main.mc.thePlayer.inventory.getStackInSlot(cane); - Main.mc.thePlayer.inventory.currentItem = cane; - Main.mc.playerController.onPlayerRightClick(Main.mc.thePlayer, Main.mc.theWorld, item, dirt, EnumFacing.UP, Main.mc.thePlayer.getLookVec()); - } - } - - private BlockPos furthestEmptyDirt() { - int r = 5; - BlockPos playerPos = Main.mc.thePlayer.getPosition(); - playerPos.add(0, 1, 0); - Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); - Vec3i vec3i = new Vec3i(r, r, r); - ArrayList<Vec3> dirts = new ArrayList<Vec3>(); - if (playerPos != null) { - for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { - IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); - IBlockState blockState2 = Main.mc.theWorld.getBlockState(blockPos.add(0, 1, 0)); - //Main.mc.thePlayer.addChatMessage(new ChatComponentText(blockState.getBlock().toString())); - if (blockState.getBlock() == Blocks.dirt && blockState2.getBlock() == Blocks.air) { - dirts.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); - } - } - } - double biggest = -1; - Vec3 furthest = null; - for (int i = 0; i < dirts.size(); i++) { - double dist = dirts.get(i).distanceTo(playerVec); - if (dist > biggest) { - biggest = dist; - furthest = dirts.get(i); - } - } - if (furthest != null && biggest < 4) { - return new BlockPos(furthest.xCoord, furthest.yCoord, furthest.zCoord); - } - return null; - } - - private static int findItemInHotbar(String name) { - InventoryPlayer inv = Main.mc.thePlayer.inventory; - for (int i = 0; i < 9; i++) { - ItemStack curStack = inv.getStackInSlot(i); - if (curStack != null) { - if (curStack.getDisplayName().contains(name)) { - return i; - } - } - } - return -1; - } -} diff --git a/src/main/java/rosegoldaddons/features/CustomItemMacro.java b/src/main/java/rosegoldaddons/features/CustomItemMacro.java index b776f86..37b4ce3 100644 --- a/src/main/java/rosegoldaddons/features/CustomItemMacro.java +++ b/src/main/java/rosegoldaddons/features/CustomItemMacro.java @@ -16,13 +16,16 @@ import java.lang.reflect.Method; public class CustomItemMacro { private Thread thread; private int milis = 0; + private boolean working = false; @SubscribeEvent - public void onRender(RenderWorldLastEvent event) { + public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase == TickEvent.Phase.END || working) return; if (!Main.autoUseItems) return; if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { try { + working = true; int prevItem = Main.mc.thePlayer.inventory.currentItem; for (String i : UseCooldown.RCitems.keySet()) { if (milis % Math.floor(UseCooldown.RCitems.get(i)/100) == 0) { @@ -46,6 +49,7 @@ public class CustomItemMacro { Main.mc.thePlayer.inventory.currentItem = prevItem; milis++; Thread.sleep(100); + working = false; } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index b0ff72a..c0f3c6a 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -1,14 +1,16 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.awt.*; @@ -18,9 +20,21 @@ public class EndermanMacro { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (!Main.configFile.EndermanESP && !Main.endermanMacro) return; + if(event.phase == TickEvent.Phase.END) return; enderman = getClosestEnderman(); - if(enderman != null && Main.endermanMacro) { - RotationUtils.faceEntity(enderman); + if(enderman != null && Main.endermanMacro && !ShadyRotation.running) { + ShadyRotation.smoothLook(ShadyRotation.getRotationToEntity(enderman), Main.configFile.smoothLookVelocity, () -> { + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true); + KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false); + + if(!Main.mc.thePlayer.movementInput.sneak) { + Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING)); + Main.mc.thePlayer.movementInput.sneak = true; + } else { + Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); + Main.mc.thePlayer.movementInput.sneak = false; + } + }); } } diff --git a/src/main/java/rosegoldaddons/features/EntityReach.java b/src/main/java/rosegoldaddons/features/EntityReach.java index 21a4691..97a1c09 100644 --- a/src/main/java/rosegoldaddons/features/EntityReach.java +++ b/src/main/java/rosegoldaddons/features/EntityReach.java @@ -55,6 +55,7 @@ public class EntityReach { @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; if (!Main.configFile.entityReach) return; if (toInteract != null) { Entity stand = getClosestArmorStand(toInteract); diff --git a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java index e06d7ea..bf37569 100644 --- a/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java +++ b/src/main/java/rosegoldaddons/features/ForagingIslandMacro.java @@ -10,9 +10,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.lang.reflect.Method; import java.util.ArrayList; @@ -24,7 +26,7 @@ public class ForagingIslandMacro { private final String[] responses = {"wtf??", "hello?", "hi?", "uhhhhhh", "what the", "??????"}; @SubscribeEvent - public void renderWorld(RenderWorldLastEvent event) { + public void onTick(TickEvent.ClientTickEvent event) { if (Main.forageOnIsland) { if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { @@ -57,8 +59,8 @@ public class ForagingIslandMacro { return; } if (furthestDirt != null) { - RotationUtils.facePos(new Vec3(furthestDirt.getX() + 0.5, furthestDirt.getY() - 0.5, furthestDirt.getZ() + 0.5)); - Thread.sleep(Main.configFile.smoothLookVelocity * 2L); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(new Vec3(furthestDirt.getX() +0.5, furthestDirt.getY() + 1, furthestDirt.getZ() + 0.5)), Main.configFile.smoothLookVelocity, () -> {}); + Thread.sleep(Main.configFile.smoothLookVelocity * 40L); if (sapling != -1) { if (Main.mc.objectMouseOver.typeOfHit.toString().equals("BLOCK")) { BlockPos pos = Main.mc.objectMouseOver.getBlockPos(); @@ -75,7 +77,8 @@ public class ForagingIslandMacro { } else { BlockPos dirt = closestDirt(); if (dirt != null) { - RotationUtils.facePos(new Vec3(dirt.getX() + 0.5, dirt.getY(), dirt.getZ() + 0.5)); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(new Vec3(dirt.getX() + 0.5, dirt.getY() + 1, dirt.getZ() + 0.5)), Main.configFile.smoothLookVelocity, () -> {}); + Thread.sleep(Main.configFile.smoothLookVelocity * 40L); if (bonemeal != -1 && treecap != -1) { Main.mc.thePlayer.inventory.currentItem = bonemeal; Random rand = new Random(); @@ -84,19 +87,19 @@ public class ForagingIslandMacro { toAdd = rand.nextInt(20); } //ChatUtils.sendMessage("extra delay: "+toAdd+"%"); - Thread.sleep(Math.round(150*(1+(toAdd/100)))); + Thread.sleep(Math.round(150*(1+(toAdd/100F)))); rightClick(); rightClick(); Main.mc.thePlayer.inventory.currentItem = treecap; - Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.treecapDelay*(1+(toAdd/100F)))); KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), true); - Thread.sleep(Math.round(150*(1+(toAdd/100)))); + Thread.sleep(Math.round(150*(1+(toAdd/100F)))); KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindAttack.getKeyCode(), false); - Thread.sleep(Math.round(25*(1+(toAdd/100)))); + Thread.sleep(Math.round(25*(1+(toAdd/100F)))); Main.mc.thePlayer.inventory.currentItem = rod; - Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.prerodDelay*(1+(toAdd/100F)))); rightClick(); - Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100)))); + Thread.sleep(Math.round(Main.configFile.postrodDelay*(1+(toAdd/100F)))); } } } diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index 28f30af..af919f9 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -1,23 +1,16 @@ package rosegoldaddons.features; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.network.play.client.C0APacketAnimation; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; -import rosegoldaddons.utils.ChatUtils; import rosegoldaddons.utils.PlayerUtils; import rosegoldaddons.utils.RenderUtils; @@ -35,8 +28,8 @@ public class GemstoneAura { currentDamage = 0; return; } - if (event.phase == TickEvent.Phase.END) { - if (PlayerUtils.pickaxeAbilityReady && Main.mc.thePlayer != null) { + if (event.phase == TickEvent.Phase.END && Main.mc.theWorld != null && Main.mc.thePlayer != null) { + if (PlayerUtils.pickaxeAbilityReady) { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if (currentDamage > 100) { @@ -109,7 +102,7 @@ public class GemstoneAura { playerPos = playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, r, r); - ArrayList<Vec3> chests = new ArrayList<Vec3>(); + ArrayList<Vec3> chests = new ArrayList<>(); if (playerPos != null) { for (BlockPos blockPos : BlockPos.getAllInBox(playerPos.add(vec3i), playerPos.subtract(vec3i))) { IBlockState blockState = Main.mc.theWorld.getBlockState(blockPos); @@ -133,11 +126,11 @@ public class GemstoneAura { } double smallest = 9999; Vec3 closest = null; - for (int i = 0; i < chests.size(); i++) { - double dist = chests.get(i).distanceTo(playerVec); + for (Vec3 chest : chests) { + double dist = chest.distanceTo(playerVec); if (dist < smallest) { smallest = dist; - closest = chests.get(i); + closest = chest; } } if (closest != null && smallest < 5) { diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index 8cecae7..4f92056 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -21,10 +21,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; -import rosegoldaddons.utils.ChatUtils; -import rosegoldaddons.utils.PlayerUtils; -import rosegoldaddons.utils.RenderUtils; -import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.*; +import scala.concurrent.impl.CallbackRunnable; import java.awt.*; import java.util.ArrayList; @@ -100,7 +98,7 @@ public class HardstoneAura { stopHardstone = true; double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - RotationUtils.facePos(particlePos); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> {}); } } } @@ -176,23 +174,32 @@ public class HardstoneAura { private BlockPos closestStone() { if(Main.mc.theWorld == null) return null; if(Main.mc.thePlayer == null) return null; - int r = 6; + int r = 5; BlockPos playerPos = Main.mc.thePlayer.getPosition(); playerPos.add(0, 1, 0); Vec3 playerVec = Main.mc.thePlayer.getPositionVector(); Vec3i vec3i = new Vec3i(r, 1 + Main.configFile.hardrange, r); - Vec3i vec3i2 = new Vec3i(r, 0, r); + Vec3i vec3i2 = new Vec3i(r, Main.configFile.hardrangeDown, r); ArrayList<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 = Main.mc.theWorld.getBlockState(blockPos); if(Main.configFile.hardIndex == 0) { - if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -207,11 +214,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -222,11 +238,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -237,11 +262,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } @@ -252,11 +286,20 @@ public class HardstoneAura { if(isSlow(blockState)) { gemstones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } - else if (blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { + else if (!Main.configFile.includeExcavatable && blockState.getBlock() == Blocks.stone && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } if (Main.configFile.includeOres) { - if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack && !broken.contains(blockPos)) { + if (blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore + || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore + || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore + || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack + && !broken.contains(blockPos)) { + stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); + } + } + if(Main.configFile.includeExcavatable) { + if (blockState.getBlock() == Blocks.gravel || blockState.getBlock() == Blocks.sand && !broken.contains(blockPos)) { stones.add(new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5)); } } diff --git a/src/main/java/rosegoldaddons/features/MithrilMacro.java b/src/main/java/rosegoldaddons/features/MithrilMacro.java index ce9509b..e2645c5 100644 --- a/src/main/java/rosegoldaddons/features/MithrilMacro.java +++ b/src/main/java/rosegoldaddons/features/MithrilMacro.java @@ -1,10 +1,13 @@ package rosegoldaddons.features; +import net.minecraft.block.BlockHardenedClay; +import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.util.*; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -29,6 +32,7 @@ public class MithrilMacro { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) return; + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; if (Main.mc.currentScreen != null) return; if (!Main.mithrilMacro) { if (holdingLeft) { @@ -50,7 +54,6 @@ public class MithrilMacro { lastBlockPos = blockPos; blockPos = closestMithril(); if (lastBlockPos != null && blockPos != null && !lastBlockPos.equals(blockPos)) { - ChatUtils.sendMessage("Block pos was changed."); currentDamage = 0; } if (blockPos != null) { @@ -58,7 +61,7 @@ public class MithrilMacro { if (vec3s.size() > 0) { vec = vec3s.get(0); if (vec != null) { - RotationUtils.facePos(vec); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(vec), Main.configFile.smoothLookVelocity, () -> {}); lastVec = vec; KeyBinding.setKeyBindState(lc.getKeyCode(), true); holdingLeft = true; @@ -117,17 +120,24 @@ public class MithrilMacro { } private boolean isMithril(IBlockState blockState) { - if (blockState.getBlock() == Blocks.prismarine) { - return true; - } else if (blockState.getBlock() == Blocks.wool) { - return true; - } else if (blockState.getBlock() == Blocks.stained_hardened_clay) { - return true; - } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { - return true; - } else if (blockState.getBlock() == Blocks.gold_block) { - return true; + if (!Main.configFile.onlyOres) { + if (blockState.getBlock() == Blocks.prismarine) { + return true; + } else if (blockState.getBlock() == Blocks.wool && (blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.LIGHT_BLUE || blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.GRAY)) { + return true; + } else if (blockState.getBlock() == Blocks.stained_hardened_clay && blockState.getValue(BlockStainedGlass.COLOR) == EnumDyeColor.CYAN) { + return true; + } else if (!Main.configFile.ignoreTitanium && blockState.getBlock() == Blocks.stone && blockState.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { + return true; + } else if (blockState.getBlock() == Blocks.gold_block) { + return true; + } + } + + if (Main.configFile.includeOres || Main.configFile.onlyOres) { + return blockState.getBlock() == Blocks.coal_ore || blockState.getBlock() == Blocks.diamond_ore || blockState.getBlock() == Blocks.gold_ore || blockState.getBlock() == Blocks.redstone_ore || blockState.getBlock() == Blocks.iron_ore || blockState.getBlock() == Blocks.lapis_ore || blockState.getBlock() == Blocks.emerald_ore || blockState.getBlock() == Blocks.netherrack; } + return false; } } diff --git a/src/main/java/rosegoldaddons/features/MithrilNuker.java b/src/main/java/rosegoldaddons/features/MithrilNuker.java index 2e2e9e5..2e7a36a 100644 --- a/src/main/java/rosegoldaddons/features/MithrilNuker.java +++ b/src/main/java/rosegoldaddons/features/MithrilNuker.java @@ -13,6 +13,7 @@ import rosegoldaddons.Main; import rosegoldaddons.utils.PlayerUtils; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.awt.*; import java.util.ArrayList; @@ -21,15 +22,17 @@ public class MithrilNuker { private static int currentDamage; private static byte blockHitDelay = 0; private static BlockPos blockPos; + private BlockPos lastBlockPos = null; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if (!Main.mithrilNuker || Main.mc.thePlayer == null || Main.mc.theWorld == null) { + if(Main.mc.thePlayer == null || Main.mc.theWorld == null) return; + if (!Main.mithrilNuker) { currentDamage = 0; return; } if (event.phase == TickEvent.Phase.END) { - if(PlayerUtils.pickaxeAbilityReady) { + if(PlayerUtils.pickaxeAbilityReady && Main.mc.playerController != null) { Main.mc.playerController.sendUseItem(Main.mc.thePlayer, Main.mc.theWorld, Main.mc.thePlayer.inventory.getStackInSlot(Main.mc.thePlayer.inventory.currentItem)); } if(currentDamage > 100) { @@ -42,6 +45,7 @@ public class MithrilNuker { } } if(currentDamage == 0) { + lastBlockPos = blockPos; blockPos = closestMithril(); } if (blockPos != null) { @@ -52,7 +56,7 @@ public class MithrilNuker { if (currentDamage == 0) { Main.mc.thePlayer.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)); + ShadyRotation.smoothLook(ShadyRotation.getRotationToBlock(blockPos), Main.configFile.smoothLookVelocity, () -> {}); } } PlayerUtils.swingItem(); diff --git a/src/main/java/rosegoldaddons/features/PowderMacro.java b/src/main/java/rosegoldaddons/features/PowderMacro.java index b4d0937..61555a3 100644 --- a/src/main/java/rosegoldaddons/features/PowderMacro.java +++ b/src/main/java/rosegoldaddons/features/PowderMacro.java @@ -16,6 +16,7 @@ import rosegoldaddons.Main; import rosegoldaddons.events.ReceivePacketEvent; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; +import rosegoldaddons.utils.ShadyRotation; import java.awt.*; import java.util.ArrayList; @@ -29,14 +30,11 @@ public class PowderMacro { 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) { double dist = closestChest.distanceTo(particlePos); if (dist < 1) { - particlePos = particlePos.add(new Vec3(0, -1, 0)); - int drill = findItemInHotbar("X655"); - if(drill != -1) Main.mc.thePlayer.inventory.currentItem = drill; - RotationUtils.facePos(particlePos); + ShadyRotation.smoothLook(ShadyRotation.vec3ToRotation(particlePos), Main.configFile.smoothLookVelocity, () -> {}); } } } diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 54e88f2..543915f 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -1,15 +1,10 @@ package rosegoldaddons.features; -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) @@ -32,21 +27,6 @@ public class SexAura { } } - @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() { Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } |