Minecraft crashes when RageMode is enabled by pressing the U key

I will say right away, in the logs error does not appear, I use forge version 2859 for minecraft 1.12.2, I wrote a couple of classes one of which is responsible for RageMode, the essence is that the player when turning on RageMode should fly to the nearest entity and inflict it 200 damage, and so once again within 10 seconds, if the player meets obstacles, he must destroy them hitbox. The next class KeyInputHandler, it is responsible for checking the pressing of the key U and then activates RageMode. what is the problem – when entering the game everything is normal, but when you press U the game completely freezes and the only way to turn it off – it is forced to close, looking at the logs there is no record of any errors, just an inscription exit the game with code 0.

Here are the codes:
main file

package daun.aut.utils;

import daun.aut.utils.Handlers.KeyInputHandler;
import daun.aut.recipes.SmeltingRecipes;
import daun.aut.tabs.autTab;
import daun.aut.utils.Handlers.RegistryHandler;
import daun.aut.utils.proxy.CommonProxy;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;



    @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
    public class Main
    {
        public static final CreativeTabs autTab = new autTab("autismotab");

        @Instance
        public static Main instance;

        @SidedProxy(modId = Reference.MODID, clientSide= Reference.CLIENT, serverSide = Reference.COMMON)
        public static CommonProxy proxy;

        @EventHandler
        public static void preInit(FMLPreInitializationEvent event)
        {
            RegistryHandler.otherRegistries();
            KeyInputHandler.registerKeyBindings();

        }

        @EventHandler
        public static void Init(FMLInitializationEvent event) {
            SmeltingRecipes.init();
            MinecraftForge.EVENT_BUS.register(new CustomFog());
            MinecraftForge.EVENT_BUS.register(new KeyInputHandler());
        }

        @EventHandler
        public static void postInit(FMLPostInitializationEvent event) {
        }

    }

RageMode

package daun.aut.utils;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;

public class RageMode {

    private EntityPlayer player;
    private World world;
    private long startTime;
    private final long duration = 10 * 20; // 10 seconds (20 ticks per second)
    private final double speed = 1.5; // Speed of movement

    public RageMode(EntityPlayer player) {
        this.player = player;
        this.world = player.world;
        this.startTime = world.getTotalWorldTime();
        activateRage();
    }

    private void activateRage() {
        while (world.getTotalWorldTime() < startTime + duration) {
            EntityLivingBase target = findNearestTarget();
            if (target != null) {
                moveTowards(target);
                attack(target);
                breakObstacles();
            }
        }
    }

    private EntityLivingBase findNearestTarget() {
        // Logic to find the nearest living entity
        return player.world.getNearestAttackablePlayer(player, 50.0, 50.0);
    }

    private void moveTowards(EntityLivingBase target) {
        // Logic to move towards the target entity linearly
        Vec3d playerPos = player.getPositionVector();
        Vec3d targetPos = target.getPositionVector();
        Vec3d direction = targetPos.subtract(playerPos).normalize();
        Vec3d newPos = playerPos.add(direction.scale(speed / 20.0)); // Move by speed per tick

        player.setPositionAndUpdate(newPos.x, newPos.y, newPos.z);
    }

    private void attack(EntityLivingBase target) {
        // Logic to attack the target entity
        target.attackEntityFrom(DamageSource.causePlayerDamage(player), 200.0f);
    }

    private void breakObstacles() {
        // Logic to break obstacles (blocks)
        BlockPos playerPos = player.getPosition();
        Vec3d lookVec = player.getLookVec();
        BlockPos blockPos = playerPos.add(lookVec.x, lookVec.y, lookVec.z); // Convert Vec3d to BlockPos

        if (!world.isAirBlock(blockPos)) {
            world.destroyBlock(blockPos, true);
        }
    }
}

Handler

package daun.aut.utils.Handlers;

import daun.aut.utils.RageMode;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;

public class KeyInputHandler {

    private static final KeyBinding rageKey = new KeyBinding("key.ragemode", Keyboard.KEY_U, "key.categories.gameplay");

    public static void registerKeyBindings() {
        ClientRegistry.registerKeyBinding(rageKey);
    }

    @SubscribeEvent
    public void onKeyInput(InputEvent.KeyInputEvent event) {
        if (rageKey.isPressed()) {
            EntityPlayer player = Minecraft.getMinecraft().player;
            if (player != null) {
                new RageMode(player);
            }
        }
    }
}

I need everything to work properly and not crash.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật