Nuker:
package dev.zovchik.modules.impl.player;
import com.google.common.eventbus.Subscribe;
import dev.zovchik.events.EventMotion;
import dev.zovchik.events.WorldEvent;
import dev.zovchik.modules.api.Category;
import dev.zovchik.modules.settings.impl.SliderSetting;
import dev.zovchik.modules.api.Module;
import dev.zovchik.modules.api.ModuleRegister;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.optifine.render.RenderUtils;
import dev.zovchik.utils.player.BlockUtils;
import java.util.HashSet;
import java.util.Set;
@ModuleRegister(name= "Nuker", category = Category.Misc, description = "тест")
public class Nuker extends Module {
final SliderSetting range1 = new SliderSetting("Диапозон", 2.0f, 1.0f, 5.0f, 0.1f);
long last = 0L;
final Set<Block> blocks = new HashSet<>();
BlockPos Render = null;
BlockPos block = null;
float interval = 50.0f;
private float targetYaw = 0;
private float targetPitch = 0;
private boolean shouldRotate = false;
public Nuker() {
this.addSettings(this.range1);
blocks.add(Blocks.COBBLESTONE);
blocks.add(Blocks.STONE);
blocks.add(Blocks.DIAMOND_ORE);
blocks.add(Blocks.GOLD_ORE);
blocks.add(Blocks.REDSTONE_ORE);
blocks.add(Blocks.LAPIS_ORE);
blocks.add(Blocks.IRON_ORE);
blocks.add(Blocks.COAL_ORE);
blocks.add(Blocks.DIORITE);
}
@Subscribe
private void onMotion(EventMotion e) {
if (shouldRotate && block != null) {
e.setYaw(targetYaw);
e.setPitch(targetPitch);
mc.player.rotationYawHead = targetYaw;
mc.player.rotationPitchHead = targetPitch;
}
}
@Subscribe
private void onWorld(WorldEvent worldEvent) {
int range = Math.round(range1.get());
long scan = Math.round(interval);
Vector3d positionVec = mc.player.getPositionVec();
if (block == null || mc.world.getBlockState(block).getBlock() == Blocks.AIR) {
for (int x = -range; x <= range; ++x) {
for (int z = -range; z <= range; ++z) {
for (int y = -3; y <= 3; ++y) {
BlockPos target = new BlockPos(positionVec.x + x, positionVec.y + y, positionVec.z + z);
if (target == null) {
continue;
}
Block pos = mc.world.getBlockState(target).getBlock();
if (blocks.contains(pos) && pos.getDefaultState().getBlockHardness(mc.world, target) > 0) {
double distance = positionVec.distanceTo(new Vector3d(target.getX(), target.getY(), target.getZ()));
if (distance <= range) {
if (System.currentTimeMillis() - last >= scan) {
float[] rotations = BlockUtils.getRotations(
target.getX() + 0.5,
target.getY() + 0.5,
target.getZ() + 0.5
);
targetYaw = rotations[0];
targetPitch = rotations[1];
shouldRotate = true;
// Теперь ломаем с правильной ротацией
mc.playerController.onPlayerDamageBlock(target, Direction.UP);
last = System.currentTimeMillis();
block = target;
Render = target;
return;
}
}
}
}
}
}
} else {
if (block != null) {
double distance = positionVec.distanceTo(new Vector3d(block.getX(), block.getY(), block.getZ()));
if (distance > range) {
block = null;
Render = null;
shouldRotate = false;
} else {
if (System.currentTimeMillis() - last >= scan) {
float[] rotations = BlockUtils.getRotations(
block.getX() + 0.5,
block.getY() + 0.5,
block.getZ() + 0.5
);
targetYaw = rotations[0];
targetPitch = rotations[1];
shouldRotate = true;
mc.playerController.onPlayerDamageBlock(block, Direction.UP);
last = System.currentTimeMillis();
}
}
} if (block != null && mc.world.getBlockState(block).getBlock() == Blocks.AIR) {
block = null;
Render = null;
shouldRotate = false;
}
}
}
@Subscribe
private void render(WorldEvent world) {
if (Render != null) {
RenderUtils.drawBlockBox(Render, 0xFFFF0000);
}
}
}