Вопрос Краш после попытки создать клик по блоку.

Начинающий
Статус
Оффлайн
Регистрация
7 Апр 2023
Сообщения
5
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

код:
package wtf.expensive.modules.impl.util;

import lombok.Setter;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import wtf.expensive.events.Event;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.util.CameraUtil;
import wtf.expensive.util.misc.TimerUtil;

import static wtf.expensive.util.CameraUtil.smoothCameraRotation;

@FunctionAnnotation(name = "AutoFarm", type = Type.Util)
public class AutoFarm extends Function {

    private final Minecraft mc = Minecraft.getInstance();

    private final TimerUtil collectionTimer = new TimerUtil();

    private BlockPos lastClickedPos = null;

    @Override
    public void onEvent(Event event) {
        if (lastClickedPos != null && mc.world != null && mc.world.getBlockState(lastClickedPos).getBlock() == Blocks.SWEET_BERRY_BUSH) {

            return;
        }

        if (mc.player != null && mc.world != null) {
            BlockPos nearestBerryPos = CameraUtil.findNearestBerry(mc, 3);
            if (nearestBerryPos != null) {
                BlockState blockState = mc.world.getBlockState(nearestBerryPos);
                if (blockState.getBlock() == Blocks.SWEET_BERRY_BUSH && blockState.get(BlockStateProperties.AGE_0_3) == 3) {
                    double targetX = nearestBerryPos.getX() + 0.5;
                    double targetY = nearestBerryPos.getY();
                    double targetZ = nearestBerryPos.getZ() + 0.5;
                    double deltaYaw = Math.atan2(targetZ - mc.player.getPosZ(), targetX - mc.player.getPosX()) * 180 / Math.PI - 90;
                    double deltaPitch = -Math.toDegrees(Math.atan2(targetY - (mc.player.getPosY() + mc.player.getEyeHeight()), Math.sqrt((targetX - mc.player.getPosX()) * (targetX - mc.player.getPosX()) + (targetZ - mc.player.getPosZ()) * (targetZ - mc.player.getPosZ()))));

                    CameraUtil.targetYaw = deltaYaw;
                    CameraUtil.targetPitch = deltaPitch;
                    smoothCameraRotation(mc);
                }
            }
        }
    }

}
При любой попытке вызвать клик будет краш


1:
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)
    at net.minecraft.client.multiplayer.PlayerController.processRightClickBlock(PlayerController.java:319)
    at net.optifine.override.PlayerControllerOF.processRightClickBlock(PlayerControllerOF.java:62)
    at wtf.expensive.util.CameraUtil.findNearestBerry(CameraUtil.java:77)
    at wtf.expensive.modules.impl.util.AutoFarm.onEvent(AutoFarm.java:38)
    at wtf.expensive.events.EventManager.callEvent(EventManager.java:40)
    at wtf.expensive.events.EventManager.call(EventManager.java:26)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:241)
    at net.minecraft.network.NetworkManager.sendPacket(NetworkManager.java:220)
    at net.minecraft.client.network.play.ClientPlayNetHandler.sendPacket(ClientPlayNetHandler.java:992)

-- Entity being ticked --
Details:
    Entity Type: minecraft:player (net.minecraft.client.entity.player.ClientPlayerEntity)
    Entity ID: 32
    Entity Name: HalalClient
    Entity's Exact location: 124.66, 4.00, -83.74
    Entity's Block location: World: (124,4,-84), Chunk: (at 12,0,12 in 7,-6; contains blocks 112,0,-96 to 127,255,-81), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
    Entity's Momentum: 0.00, 0.00, 0.00
    Entity's Passengers: []
    Entity's Vehicle: ~~ERROR~~ NullPointerException: Cannot invoke "net.minecraft.entity.Entity.toString()" because the return value of "net.minecraft.entity.Entity.getRidingEntity()" is null
Stacktrace:
    at net.minecraft.world.World.guardEntityTick(World.java:677)
    at net.minecraft.client.world.ClientWorld.tickEntities(ClientWorld.java:187)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1613)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1018)
    at net.minecraft.client.Minecraft.run(Minecraft.java:643)
    at net.minecraft.client.main.Main.main(Main.java:207)
    at mcp.client.Start.main(Start.java:17)

И как такое фиксить? нужно чтобы оно кликало пкм по блоку ягоды на который поворачивает, но как сделать хз, в любом случае краш.
 
Сверху Снизу