Till Aura
This commit is contained in:
committed by
Cloudburst
parent
5a7f7b4c25
commit
5893436184
@@ -68,6 +68,7 @@
|
|||||||
- SkeletonESP (Ported from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/render/Skeletons.java))
|
- SkeletonESP (Ported from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/render/Skeletons.java))
|
||||||
- SoundLocator
|
- SoundLocator
|
||||||
- Server Finder (Ported from [MeteorAdditions](https://github.com/JFronny/MeteorAdditions))
|
- Server Finder (Ported from [MeteorAdditions](https://github.com/JFronny/MeteorAdditions))
|
||||||
|
- TillAura (Ported from [Wurst](https://github.com/Wurst-Imperium/Wurst7/tree))
|
||||||
- TreeAura (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/2138))
|
- TreeAura (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/2138))
|
||||||
|
|
||||||
### Modifications
|
### Modifications
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
|||||||
modules.add(new Rendering());
|
modules.add(new Rendering());
|
||||||
modules.add(new SkeletonESP());
|
modules.add(new SkeletonESP());
|
||||||
modules.add(new SoundLocator());
|
modules.add(new SoundLocator());
|
||||||
|
modules.add(new TillAura());
|
||||||
modules.add(new TreeAura());
|
modules.add(new TreeAura());
|
||||||
|
|
||||||
// Module modifications
|
// Module modifications
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import net.minecraft.util.hit.HitResult;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class AutoSoup extends Module {
|
public class AutoSoup extends Module {
|
||||||
private static final String desc = "Automatically eats soup when your health is low.\nNote: This hack ignores hunger and assumes that eating soup directly refills your health. If the server you are playing on is not configured to do that, use AutoEat instead.";
|
private static final String desc = "Automatically eats soup when your health is low. Note: This hack ignores hunger and assumes that eating soup directly refills your health. If the server you are playing on is not configured to do that, use AutoEat instead.";
|
||||||
|
|
||||||
public AutoSoup() {
|
public AutoSoup() {
|
||||||
super(MeteorRejectsAddon.CATEGORY, "auto-soup", desc);
|
super(MeteorRejectsAddon.CATEGORY, "auto-soup", desc);
|
||||||
@@ -34,8 +34,7 @@ public class AutoSoup extends Module {
|
|||||||
|
|
||||||
public final Setting<Double> health = sgGeneral.add(new DoubleSetting.Builder()
|
public final Setting<Double> health = sgGeneral.add(new DoubleSetting.Builder()
|
||||||
.name("health")
|
.name("health")
|
||||||
.description("Eats a soup when your health\n"
|
.description("Eats a soup when your health reaches this value or falls below it.")
|
||||||
+ "reaches this value or falls below it.")
|
|
||||||
.defaultValue(6.5)
|
.defaultValue(6.5)
|
||||||
.min(0.5)
|
.min(0.5)
|
||||||
.sliderMin(0.5)
|
.sliderMin(0.5)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ public class ItemGenerator extends Module {
|
|||||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||||
private final Setting<Integer> speed = sgGeneral.add(new IntSetting.Builder()
|
private final Setting<Integer> speed = sgGeneral.add(new IntSetting.Builder()
|
||||||
.name("speed")
|
.name("speed")
|
||||||
.description("WARNING: High speeds will cause a ton\n"
|
.description("WARNING: High speeds will cause a ton of lag and can easily crash the game!")
|
||||||
+ "of lag and can easily crash the game!")
|
|
||||||
.defaultValue(1)
|
.defaultValue(1)
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(36)
|
.max(36)
|
||||||
@@ -30,8 +29,7 @@ public class ItemGenerator extends Module {
|
|||||||
|
|
||||||
private final Setting<Integer> stackSize = sgGeneral.add(new IntSetting.Builder()
|
private final Setting<Integer> stackSize = sgGeneral.add(new IntSetting.Builder()
|
||||||
.name("stack-size")
|
.name("stack-size")
|
||||||
.description("How many items to place in each stack.\n"
|
.description("How many items to place in each stack. Doesn't seem to affect performance.")
|
||||||
+ "Doesn't seem to affect performance.")
|
|
||||||
.defaultValue(1)
|
.defaultValue(1)
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(64)
|
.max(64)
|
||||||
@@ -42,7 +40,7 @@ public class ItemGenerator extends Module {
|
|||||||
private final Random random = Random.create();
|
private final Random random = Random.create();
|
||||||
|
|
||||||
public ItemGenerator() {
|
public ItemGenerator() {
|
||||||
super(MeteorRejectsAddon.CATEGORY, "item-generator", "Generates random items and drops them on the ground.\nCreative mode only.");
|
super(MeteorRejectsAddon.CATEGORY, "item-generator", "Generates random items and drops them on the ground. Creative mode only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
225
src/main/java/anticope/rejects/modules/TillAura.java
Normal file
225
src/main/java/anticope/rejects/modules/TillAura.java
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
package anticope.rejects.modules;
|
||||||
|
|
||||||
|
import anticope.rejects.MeteorRejectsAddon;
|
||||||
|
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||||
|
import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor;
|
||||||
|
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||||
|
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||||
|
import meteordevelopment.meteorclient.settings.Setting;
|
||||||
|
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||||
|
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||||
|
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||||
|
import meteordevelopment.orbit.EventHandler;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.item.HoeItem;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.hit.HitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.RaycastContext;
|
||||||
|
import net.minecraft.world.RaycastContext.FluidHandling;
|
||||||
|
import net.minecraft.world.RaycastContext.ShapeType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class TillAura extends Module {
|
||||||
|
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||||
|
|
||||||
|
private final Setting<Double> range = sgGeneral.add(new DoubleSetting.Builder()
|
||||||
|
.name("range")
|
||||||
|
.description("How far Tillaura will reach to till blocks.")
|
||||||
|
.defaultValue(5)
|
||||||
|
.min(0)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
private final Setting<Boolean> multiTill = sgGeneral.add(new BoolSetting.Builder().
|
||||||
|
name("multi-till")
|
||||||
|
.description("Tills multiple blocks at once. Faster, but can't bypass NoCheat+.")
|
||||||
|
.defaultValue(false)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
private final Setting<Boolean> checkLOS = sgGeneral.add(new BoolSetting.Builder().
|
||||||
|
name("check-line-of-sight")
|
||||||
|
.description("Prevents Tillaura from reaching through blocks. Good for NoCheat+ servers, but unnecessary in vanilla.")
|
||||||
|
.defaultValue(true)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
private final List<Block> tillableBlocks = Arrays.asList(Blocks.GRASS_BLOCK,
|
||||||
|
Blocks.DIRT_PATH, Blocks.DIRT, Blocks.COARSE_DIRT);
|
||||||
|
|
||||||
|
public TillAura() {
|
||||||
|
super(MeteorRejectsAddon.CATEGORY, "till-aura", "Automatically turns dirt, grass, etc. into farmland.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onTick(TickEvent.Post event) {
|
||||||
|
// wait for right click timer
|
||||||
|
if (((MinecraftClientAccessor) mc).getItemUseCooldown() > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// check held item
|
||||||
|
ItemStack stack = mc.player.getInventory().getMainHandStack();
|
||||||
|
if (stack.isEmpty() || !(stack.getItem() instanceof HoeItem))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// get valid blocks
|
||||||
|
ArrayList<BlockPos> validBlocks =
|
||||||
|
getValidBlocks(range.get(), this::isCorrectBlock);
|
||||||
|
|
||||||
|
if (multiTill.get()) {
|
||||||
|
boolean shouldSwing = false;
|
||||||
|
|
||||||
|
// till all valid blocks
|
||||||
|
for (BlockPos pos : validBlocks)
|
||||||
|
if (rightClickBlockSimple(pos))
|
||||||
|
shouldSwing = true;
|
||||||
|
|
||||||
|
// swing arm
|
||||||
|
if (shouldSwing)
|
||||||
|
mc.player.swingHand(Hand.MAIN_HAND);
|
||||||
|
} else
|
||||||
|
// till next valid block
|
||||||
|
for (BlockPos pos : validBlocks)
|
||||||
|
if (rightClickBlockLegit(pos))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<BlockPos> getAllInBox(BlockPos from, BlockPos to) {
|
||||||
|
ArrayList<BlockPos> blocks = new ArrayList<>();
|
||||||
|
|
||||||
|
BlockPos min = new BlockPos(Math.min(from.getX(), to.getX()),
|
||||||
|
Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
|
||||||
|
BlockPos max = new BlockPos(Math.max(from.getX(), to.getX()),
|
||||||
|
Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
|
||||||
|
|
||||||
|
for (int x = min.getX(); x <= max.getX(); x++)
|
||||||
|
for (int y = min.getY(); y <= max.getY(); y++)
|
||||||
|
for (int z = min.getZ(); z <= max.getZ(); z++)
|
||||||
|
blocks.add(new BlockPos(x, y, z));
|
||||||
|
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3d getEyesPos() {
|
||||||
|
ClientPlayerEntity player = mc.player;
|
||||||
|
|
||||||
|
return new Vec3d(player.getX(),
|
||||||
|
player.getY() + player.getEyeHeight(player.getPose()),
|
||||||
|
player.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<BlockPos> getValidBlocks(double range,
|
||||||
|
Predicate<BlockPos> validator) {
|
||||||
|
Vec3d eyesVec = getEyesPos().subtract(0.5, 0.5, 0.5);
|
||||||
|
double rangeSq = Math.pow(range + 0.5, 2);
|
||||||
|
int rangeI = (int) Math.ceil(range);
|
||||||
|
|
||||||
|
BlockPos center = new BlockPos(getEyesPos());
|
||||||
|
BlockPos min = center.add(-rangeI, -rangeI, -rangeI);
|
||||||
|
BlockPos max = center.add(rangeI, rangeI, rangeI);
|
||||||
|
|
||||||
|
return getAllInBox(min, max).stream()
|
||||||
|
.filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq)
|
||||||
|
.filter(validator)
|
||||||
|
.sorted(Comparator.comparingDouble(
|
||||||
|
pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos))))
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCorrectBlock(BlockPos pos) {
|
||||||
|
if (!tillableBlocks.contains(mc.world.getBlockState(pos).getBlock()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return mc.world.getBlockState(pos.up()).isAir();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean rightClickBlockLegit(BlockPos pos) {
|
||||||
|
Vec3d eyesPos = getEyesPos();
|
||||||
|
Vec3d posVec = Vec3d.ofCenter(pos);
|
||||||
|
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
|
||||||
|
double rangeSq = Math.pow(range.get(), 2);
|
||||||
|
|
||||||
|
for (Direction side : Direction.values()) {
|
||||||
|
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
|
||||||
|
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
|
||||||
|
|
||||||
|
// check if hitVec is within range
|
||||||
|
if (distanceSqHitVec > rangeSq)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// check if side is facing towards player
|
||||||
|
if (distanceSqHitVec >= distanceSqPosVec)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (checkLOS.get() && !hasLineOfSight(eyesPos, hitVec))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// face block
|
||||||
|
Rotations.rotate(Rotations.getYaw(hitVec), Rotations.getPitch(hitVec));
|
||||||
|
|
||||||
|
// right click block
|
||||||
|
rightClickBlock(pos, side, hitVec);
|
||||||
|
mc.player.swingHand(Hand.MAIN_HAND);
|
||||||
|
((MinecraftClientAccessor) mc).setItemUseCooldown(4);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec) {
|
||||||
|
mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND,
|
||||||
|
new BlockHitResult(hitVec, side, pos, false));
|
||||||
|
mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean rightClickBlockSimple(BlockPos pos) {
|
||||||
|
Vec3d eyesPos = getEyesPos();
|
||||||
|
Vec3d posVec = Vec3d.ofCenter(pos);
|
||||||
|
double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);
|
||||||
|
double rangeSq = Math.pow(range.get(), 2);
|
||||||
|
|
||||||
|
for (Direction side : Direction.values()) {
|
||||||
|
Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5));
|
||||||
|
double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec);
|
||||||
|
|
||||||
|
// check if hitVec is within range
|
||||||
|
if (distanceSqHitVec > rangeSq)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// check if side is facing towards player
|
||||||
|
if (distanceSqHitVec >= distanceSqPosVec)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (checkLOS.get() && !hasLineOfSight(eyesPos, hitVec))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rightClickBlock(pos, side, hitVec);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasLineOfSight(Vec3d from, Vec3d to) {
|
||||||
|
ShapeType type = RaycastContext.ShapeType.COLLIDER;
|
||||||
|
FluidHandling fluid = RaycastContext.FluidHandling.NONE;
|
||||||
|
|
||||||
|
RaycastContext context =
|
||||||
|
new RaycastContext(from, to, type, fluid, mc.player);
|
||||||
|
|
||||||
|
return mc.world.raycast(context).getType() == HitResult.Type.MISS;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user