Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Визуальная часть Pig | 1.21.4

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
6 Окт 2024
Сообщения
360
Реакции
0
Выберите загрузчик игры
  1. Fabric
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
    
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
    
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
    
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
    
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
    
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
            

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
            

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
            

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
            

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
    
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
    
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
        

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
        
        tickCounter++;
        

        updateTargetPosition();
        updatePigPosition();
        

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
    
    private void updateTargetPosition() {
        if (mc.player == null) return;
        
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
    
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
        
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
        

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
        
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
            

            double groundY = findGroundLevel(newPos.x, newPos.z);
            

            pigEntity.setPos(newPos.x, groundY, newPos.z);
            

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
            

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
            

            pigEntity.setYaw(headYaw);
        }
        

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
    
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
        

        double startY = mc.player.getY() + 5;
        
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
        


        return mc.player.getY();
    }
}
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
добавь ему коллизию, сделай его более чоле живым и будет крута выглядеть, оч сыро мало кому над будет такое
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
она лаганая ну вроде пойдет, с днем рождения
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
С наступающим др , мяу
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
с днем рождения гий, а так функция не знаю кому будет полезная, лучше какую то штуку прикольную по типу призрака сделать
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
норм и кста с др!
 
добавь ему коллизию, сделай его более чоле живым и будет крута выглядеть, оч сыро мало кому над будет такое
с др на перед и зделай немного ровнее чтоб гравитация на его действовала ровнее
она лаганая потому что ты обновляешь ее в onTick если что
она лаганая ну вроде пойдет, с днем рождения
пойдет)) с днём рождения
с днём рождения, хряк и база прикольная
С наступающим др , мяу
коллизия плакала возьми уже ее с рокстара
с днем рождения гий, а так функция не знаю кому будет полезная, лучше какую то штуку прикольную по типу призрака сделать
норм и кста с др!
Всем спасибо за поздравления!!! возможно сделаю по лучше
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
  
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
  
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
  
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
  
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
  
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
          

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
          

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
          

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
          

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
  
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
  
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
      

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
      
        tickCounter++;
      

        updateTargetPosition();
        updatePigPosition();
      

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
  
    private void updateTargetPosition() {
        if (mc.player == null) return;
      
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
  
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
      
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
      

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
      
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
          

            double groundY = findGroundLevel(newPos.x, newPos.z);
          

            pigEntity.setPos(newPos.x, groundY, newPos.z);
          

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
          

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
          

            pigEntity.setYaw(headYaw);
        }
      

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
  
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
      

        double startY = mc.player.getY() + 5;
      
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
      


        return mc.player.getY();
    }
}
1772605086635.png

Бедная снинюха, за что её так
С др!
:pepehzo:
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
   
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
   
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
   
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
   
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
   
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
           

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
           

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
           

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
           

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
   
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
   
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
       

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
       
        tickCounter++;
       

        updateTargetPosition();
        updatePigPosition();
       

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
   
    private void updateTargetPosition() {
        if (mc.player == null) return;
       
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
   
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
       
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
       

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
       
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
           

            double groundY = findGroundLevel(newPos.x, newPos.z);
           

            pigEntity.setPos(newPos.x, groundY, newPos.z);
           

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
           

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
           

            pigEntity.setYaw(headYaw);
        }
       

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
   
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
       

        double startY = mc.player.getY() + 5;
       
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
       


        return mc.player.getY();
    }
}
с др
 
Пишу свои визуалы, решил написать хряка который следует за тобой, да криво, да не много нейронка но как по мне нормик
А кстати у меня завтра др :)
( если тему кнш одобрят 3 марта )
( хз зачем вам эта информация )

Пожалуйста, авторизуйтесь для просмотра ссылки.


code:
Expand Collapse Copy
package dev.simplevisuals.modules.impl.utility;

import dev.simplevisuals.client.events.impl.EventTick;
import dev.simplevisuals.modules.api.Category;
import dev.simplevisuals.modules.api.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.math.Vec3d;

public class Pig extends Module {
  
    private PigEntity pigEntity;
    private Vec3d targetPosition;
    private boolean addedToWorld = false;
    private int tickCounter = 0;
  
    public Pig() {
        super("Pig", Category.Utility, "Spawns your only friend");
    }
  
    @Override
    public void onEnable() {
        super.onEnable();
        createPig();
    }
  
    @Override
    public void onDisable() {
        super.onDisable();
        removePig();
    }
  
    private void createPig() {
        if (mc.world != null && mc.player != null) {

            pigEntity = new PigEntity(net.minecraft.entity.EntityType.PIG, mc.world);
          

            Vec3d playerPos = mc.player.getPos();
            Vec3d pigPosition = new Vec3d(playerPos.x, playerPos.y, playerPos.z - 3.0);
          

            pigEntity.setPos(pigPosition.x, pigPosition.y, pigPosition.z);
            pigEntity.setNoGravity(false);
            pigEntity.setSilent(true);
            pigEntity.setInvulnerable(true);
            pigEntity.setAiDisabled(false);
          

            pigEntity.setInvisible(false);
            pigEntity.setGlowing(true);
          

            try {
                mc.world.addEntity(pigEntity);
                addedToWorld = true;
            } catch (Exception e) {
                addedToWorld = false;
            }
        }
    }
  
    private void removePig() {
        if (pigEntity != null && mc.world != null) {
            try {
                if (addedToWorld) {
                    pigEntity.remove(net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                    mc.world.removeEntity(pigEntity.getId(), net.minecraft.entity.Entity.RemovalReason.DISCARDED);
                }
            } catch (Exception e) {

            }
            addedToWorld = false;
        }
        pigEntity = null;
        targetPosition = null;
        tickCounter = 0;
    }
  
    @EventHandler
    public void onTick(EventTick event) {
        if (mc.player == null || mc.world == null) return;
      

        if (pigEntity == null || pigEntity.isRemoved()) {
            createPig();
            return;
        }
      
        tickCounter++;
      

        updateTargetPosition();
        updatePigPosition();
      

        if (tickCounter % 10 == 0) {
            pigEntity.setGlowing(true);
            pigEntity.setInvisible(false);
        }
    }
  
    private void updateTargetPosition() {
        if (mc.player == null) return;
      
        Vec3d playerPos = mc.player.getPos();

        targetPosition = new Vec3d(playerPos.x + 2.0, playerPos.y, playerPos.z);
    }
  
    private void updatePigPosition() {
        if (targetPosition == null || pigEntity == null) return;
      
        Vec3d currentPos = pigEntity.getPos();
        Vec3d direction = targetPosition.subtract(currentPos);
        double distance = direction.length();
      

        Vec3d lookDir = mc.player.getPos().subtract(pigEntity.getPos());
        float headYaw = (float) Math.toDegrees(Math.atan2(-lookDir.x, lookDir.z));
        pigEntity.setHeadYaw(headYaw);
      
        if (distance > 1.0) {

            Vec3d movement = direction.normalize().multiply(0.15);
            Vec3d newPos = currentPos.add(movement);
          

            double groundY = findGroundLevel(newPos.x, newPos.z);
          

            pigEntity.setPos(newPos.x, groundY, newPos.z);
          

            float bodyYaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            pigEntity.setYaw(bodyYaw);
          

            pigEntity.limbAnimator.setSpeed(2.0f);
        } else {

            pigEntity.limbAnimator.setSpeed(0.0f);
          

            pigEntity.setYaw(headYaw);
        }
      

        pigEntity.updatePosition(pigEntity.getX(), pigEntity.getY(), pigEntity.getZ());
    }
  
    private double findGroundLevel(double x, double z) {
        if (mc.world == null) return mc.player.getY();
      

        double startY = mc.player.getY() + 5;
      
        for (int y = (int) startY; y > mc.world.getBottomY(); y--) {
            if (mc.world.getBlockState(new net.minecraft.util.math.BlockPos((int) x, y, (int) z)).isSolidBlock(mc.world, new net.minecraft.util.math.BlockPos((int) x, y, (int) z))) {
                return y + 1.0;
            }
        }
      


        return mc.player.getY();
    }
}
О десайдик, давно пишешь свои визуалки? Не пиздишь больше чужие аккаунты на рв?) с др тя
 
Назад
Сверху Снизу