Начинающий
- Статус
- Оффлайн
- Регистрация
- 10 Дек 2022
- Сообщения
- 350
- Реакции
- 3
Кароче говно получилось, кто нибудь доработайте пж под FunTime и слейте в исходники ?:
Он создает писюн, вместо одного блока.
На фт он палится, и тебя начинают долбить в жопу
Он создает писюн, вместо одного блока.
PenisBuilder.java:
package im.expensive.functions.impl.misc;
import com.google.common.eventbus.Subscribe;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.events.EventInput;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper;
import java.util.LinkedList;
import java.util.Queue;
@FunctionRegister(
name = "PenisBuilder",
type = Category.Misc
)
public class PenisBuilder extends Function {
private static final float ROTATION_SPEED = 7.5f; // Скорость поворачивания
private static final long PLACE_DELAY = 35; // Задержка между поставкой следующего блока
private static final boolean AUTO_JUMP = true; // можете выключить если не хотите что бы он прыгал
private final Minecraft mc = Minecraft.getInstance();
private final Queue<BlockPos> blockQueue = new LinkedList<>();
private BlockPos currentTarget = null;
private BlockPos basePosition = null;
private long lastActionTime = 0;
private boolean isPlacing = false;
private float targetYaw = 0;
private float targetPitch = 0;
private boolean isRotating = false;
@Subscribe
public void onInput(EventInput event) {
if (mc.gameSettings.keyBindUseItem.isKeyDown()) {
scheduleActions();
}
}
private void scheduleActions() {
if (mc.player == null || mc.world == null) return;
BlockRayTraceResult hit = (BlockRayTraceResult) mc.objectMouseOver;
if (hit == null || hit.getType() != BlockRayTraceResult.Type.BLOCK) return;
basePosition = hit.getPos();
Direction facing = getHorizontalFacing();
blockQueue.clear();
blockQueue.add(basePosition);
blockQueue.add(basePosition.offset(facing.rotateYCCW()));
blockQueue.add(basePosition.offset(facing.rotateY()));
blockQueue.add(basePosition.up());
}
private void placeCurrentBlock() {
BlockPos target = blockQueue.poll();
if (tryPlaceBlock(target)) {
if (AUTO_JUMP && target.equals(basePosition.up())) {
mc.player.jump();
lastActionTime = System.currentTimeMillis() + 200;
}
}
currentTarget = null;
}
@Subscribe
public void onUpdate(EventUpdate event) {
if (mc.player == null || mc.world == null) return;
handleRotation();
handleBlockPlacement();
}
private void handleRotation() {
if (currentTarget == null && !blockQueue.isEmpty()) {
currentTarget = blockQueue.peek();
calculateRotation(currentTarget);
}
}
private void handleBlockPlacement() {
long now = System.currentTimeMillis();
if (now - lastActionTime < PLACE_DELAY || isRotating) return;
if (currentTarget != null && !blockQueue.isEmpty()) {
placeCurrentBlock();
lastActionTime = now;
}
}
private void calculateRotation(BlockPos pos) {
Vector3d eyes = mc.player.getEyePosition(1.0f);
Vector3d center = Vector3d.copyCentered(pos).add(0, 0.5, 0);
Vector3d diff = center.subtract(eyes);
double horizontalDist = Math.sqrt(diff.x * diff.x + diff.z * diff.z);
targetYaw = (float) Math.toDegrees(Math.atan2(diff.z, diff.x)) - 90.0F;
targetPitch = (float) -Math.toDegrees(Math.atan2(diff.y, horizontalDist));
isRotating = true;
}
@Subscribe
public void onMotion(EventMotion event) {
if (isRotating) {
float[] rotations = getNextRotation();
event.setYaw(rotations[0]);
event.setPitch(rotations[1]);
mc.player.rotationYaw = rotations[0];
mc.player.rotationPitch = rotations[1];
}
}
private float[] getNextRotation() {
float currentYaw = mc.player.rotationYaw;
float currentPitch = mc.player.rotationPitch;
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDelta = targetPitch - currentPitch;
yawDelta = MathHelper.clamp(yawDelta, -ROTATION_SPEED, ROTATION_SPEED);
pitchDelta = MathHelper.clamp(pitchDelta, -ROTATION_SPEED, ROTATION_SPEED);
float newYaw = MathHelper.wrapDegrees(currentYaw + yawDelta);
float newPitch = MathHelper.clamp(currentPitch + pitchDelta, -90.0F, 90.0F);
if (Math.abs(yawDelta) < 0.5F && Math.abs(pitchDelta) < 0.5F) {
isRotating = false;
}
return new float[]{newYaw, newPitch};
}
private boolean tryPlaceBlock(BlockPos pos) {
int slot = findBlockInHotbar();
if (slot == -1) return false;
mc.player.inventory.currentItem = slot;
BlockRayTraceResult hit = new BlockRayTraceResult(
Vector3d.copyCentered(pos), Direction.UP, pos, false
);
ActionResultType result = mc.playerController.processRightClickBlock(
mc.player, mc.world, Hand.MAIN_HAND, hit
);
if (result.isSuccessOrConsume()) {
mc.player.swingArm(Hand.MAIN_HAND);
}
return true;
}
private int findBlockInHotbar() {
for (int i = 0; i < 9; i++) {
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack.getItem() instanceof BlockItem) {
return i;
}
}
return -1;
}
private Direction getHorizontalFacing() {
float yaw = MathHelper.wrapDegrees(mc.player.rotationYaw);
if (yaw >= -45 && yaw < 45) return Direction.SOUTH;
if (yaw >= 45 && yaw < 135) return Direction.WEST;
if (yaw >= -135 && yaw < -45) return Direction.EAST;
return Direction.NORTH;
}
}