Начинающий
- Статус
- Оффлайн
- Регистрация
- 5 Июн 2024
- Сообщения
- 370
- Реакции
- 2
- Выберите загрузчик игры
- Vanilla
RichiDog.java:
package ru.minced.client.modules.impl.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import lombok.experimental.NonFinal;
import net.minecraft.client.renderer.RenderType;
import ru.minced.api.model.RichiBrain;
import ru.minced.api.model.RichiModel;
import ru.minced.api.systems.Singleton;
import ru.minced.api.systems.event.EventHandler;
import ru.minced.api.systems.event.events.impl.player.EventUpdate;
import ru.minced.api.systems.event.events.impl.render.EventRenderWorldEntities;
import ru.minced.api.utilities.render.RenderUtility;
import ru.minced.client.modules.Module;
import ru.minced.client.modules.api.Category;
import ru.minced.client.modules.api.ModuleInfo;
@ModuleInfo(name = "Richi Dog", description = "Спастил с рокстара, ебать пес ахуенный, конетину спасибо", category = Category.RENDER)
public class RichiDog extends Module {
public static final Singleton<RichiDog> INSTANCE = Singleton.create(() -> Module.link(RichiDog.class));
@NonFinal
RichiModel richi = new RichiModel(RenderType::getEntityCutoutNoCull);
RichiBrain brain = new RichiBrain();
@EventHandler
public void onEvent(EventUpdate e) {
brain.onUpdate(e);
}
@EventHandler
public void onEventRenderWorldEntities(EventRenderWorldEntities e) {
brain.setEntity(mc.player);
MatrixStack ms = e.getMatrix();
ms.push();
ms.translate(brain.getPos().sub(RenderUtility.cameraPos()));
richi.setRotationAngles(mc.player.ticksExisted, brain);
richi.render(e.getMatrix(), e, brain);
ms.pop();
}
}
RichiBrain.java:
package ru.minced.api.model;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import ru.minced.Minced;
import ru.minced.api.interfaces.IMinecraft;
import ru.minced.api.systems.attackaura.RotateUtility;
import ru.minced.api.systems.event.EventHandler;
import ru.minced.api.systems.event.events.impl.player.EventUpdate;
import ru.minced.api.utilities.math.MathUtility;
import ru.minced.api.utilities.player.PlayerUtility;
import ru.minced.api.utilities.targetesp.animation.infinity.InfinityAnimation;
import ru.minced.api.utilities.timer.TimerUtility;
import ru.minced.client.modules.impl.combat.AttackAura;
/**
* @author ConeTin
* @since 23 февр. 2025 г.
*/
@FieldDefaults(level = AccessLevel.PRIVATE)
public class RichiBrain implements IMinecraft {
Vector3d pos;
Vector3d motion = Vector3d.ZERO;
float direction = MathUtility.random(0, 360);
float yaw, body;
int speed = 50;
final InfinityAnimation x = new InfinityAnimation();
final InfinityAnimation y = new InfinityAnimation();
final InfinityAnimation z = new InfinityAnimation();
final InfinityAnimation bodyAnim = new InfinityAnimation();
final InfinityAnimation yawAnim = new InfinityAnimation();
final InfinityAnimation pitchAnim = new InfinityAnimation();
@Getter
boolean lay;
final TimerUtility staying = new TimerUtility();
public float prevLimbSwingAmount;
public float limbSwingAmount;
public float limbSwing;
@Setter
private PlayerEntity entity;
@EventHandler
public void onUpdate(EventUpdate e) {
if (entity == null) return;
Vector3d playerPos = entity.getPositionVec();
if (pos == null || pos.distanceTo(playerPos) > 10) {
pos = playerPos;
x.animate((float) pos.x, 1);
y.animate((float) pos.y, 1);
z.animate((float) pos.z, 1);
}
// Типо гравитация
motion = motion.add(0, -0.2f, 0);
Vector3d newPos = pos.add(motion);
// Коллизия
if (PlayerUtility.isBlockSolid(newPos.x, newPos.y, newPos.z)) {
int blockY = (int) newPos.y;
double correctedY = blockY + 1 + 0.1;
newPos = new Vector3d(newPos.x, correctedY, newPos.z);
motion = new Vector3d(motion.x, 0, motion.z);
}
// Мув к игроку
motion = new Vector3d(motion.x, 0, motion.z);
LivingEntity target = Minced.getInstance().getModuleManager().get(AttackAura.class).getTarget();
if (target != null && entity instanceof ClientPlayerEntity) {
if (PlayerUtility.isBlockSolid(newPos.x, newPos.y - 0.1f, newPos.z)) {
motion.y = 0.62f;
}
AxisAlignedBB box = new AxisAlignedBB(getPos().sub(new Vector3d(0.4, 0, 0.4)), getPos().add(0.4, 0.4, 0.4));
AxisAlignedBB targetbox = target.getBoundingBox().expand(-0.1f, 0, -0.1f);
motion = motion.add(target.getPositionVec().subtract(newPos).normalize());
if (box.maxX > targetbox.minX
&& box.maxY > targetbox.minY
&& box.maxZ > targetbox.minZ
&& box.minX < targetbox.maxX
&& box.minY < targetbox.maxY
&& box.minZ < targetbox.maxZ) {
motion = motion.mul(-1, 1, -1);
}
} else {
if (newPos.distanceTo(playerPos) > 2) {
motion = motion.add(playerPos.subtract(newPos).normalize());
}
}
// Ротация
handleRotation();
// Обновление позиции
pos = newPos;
if (pos.distanceTo(playerPos) < 0.1f) {
direction = MathUtility.random(0, 360);
double xMot = -Math.sin(Math.toRadians(direction)) * 0.1;
double zMot = Math.cos(Math.toRadians(direction)) * 0.1;
motion = motion.add(xMot, 0, zMot);
}
motion = motion.scale(0.5);
speed = 150;
x.animate((float) pos.x, speed);
y.animate((float) pos.y, speed);
z.animate((float) pos.z, speed);
limbTick();
if (Math.abs(pos.x - x.get()) > 0.1f || Math.abs(pos.z - z.get()) > 0.1f) {
staying.reset();
}
lay = staying.finished(1000);
}
private void handleRotation() {
if (motion.x != 0 || motion.z != 0) {
double angle = Math.atan2(motion.z, motion.x);
yaw = (float) Math.toDegrees(angle) - 90;
yaw %= 360;
if (yaw < 0) yaw += 360;
}
Vector2f rotation = RotateUtility.get(pos, entity.getEyePosition(0));
LivingEntity target = Minced.getInstance().getModuleManager().get(AttackAura.class).getTarget();
if (target != null && entity instanceof ClientPlayerEntity) {
rotation = RotateUtility.get(pos, target.getPositionVec());
}
float gradus = lay ? 200 : 150;
float gradus1 = lay ? 100 : 50;
if (rotation.x-yaw < -gradus || rotation.x-yaw > gradus) {
yaw = rotation.x;
}
float shortestYawPath = (float) (((((yaw - body) % 360) + 540) % 360) - 180);
if (!lay)
bodyAnim.animate(body+shortestYawPath, 150);
yawAnim.animate(MathHelper.clamp(rotation.x-yaw, -gradus1, gradus1), 150);
pitchAnim.animate(rotation.y, 150);
body = body + shortestYawPath;
}
public void limbTick() {
prevLimbSwingAmount = limbSwingAmount;
double d0 = x.get() - pos.x;
double d1 = /*p_233629_2_ ? p_233629_1_.getPosY() - p_233629_1_.prevPosY :*/ 0.0D;
double d2 = z.get() - pos.z;
float f = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 4.0F;
if (f > 1.0F)
{
f = 1.0F;
}
limbSwingAmount += (f - limbSwingAmount) * 0.4F;
limbSwing += limbSwingAmount;
}
public float getBody() {
return bodyAnim.get();
}
public float getYaw() {
return yawAnim.get();
}
public float getPitch() {
return pitchAnim.get();
}
public Vector3d getPos() {
return new Vector3d(x.get(), y.get(), z.get());
}
}
RichiModel.java:
package ru.minced.api.model;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.model.IHasArm;
import net.minecraft.client.renderer.entity.model.IHasHead;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.util.HandSide;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3f;
import net.optifine.DynamicLights;
import ru.minced.api.interfaces.IMinecraft;
import ru.minced.api.systems.event.events.impl.render.EventRenderWorldEntities;
import java.util.function.Function;
public class RichiModel extends Model implements IHasArm, IHasHead, IMinecraft
{
public ModelRenderer head;
public ModelRenderer body;
public ModelRenderer neck;
public ModelRenderer chest;
public ModelRenderer back;
public ModelRenderer frontLeftLeg;
public ModelRenderer frontRightLeg;
public ModelRenderer leftBackLeg;
public ModelRenderer rightBackLeg;
public ModelRenderer tail;
public ModelRenderer leftEar;
public ModelRenderer rightEar;
public RichiModel(Function<ResourceLocation, RenderType> renderTypeIn)
{
super(renderTypeIn);
this.textureWidth = 60;
this.textureHeight = 36;
// Голова
this.head = new ModelRenderer(this);
this.head.setRotationPoint(0.0F, 10.5F, -6.8F);
this.head.setTextureOffset(0, 0).addBox(-3.0F, -3.0F, -4.0F, 6.0F, 6.0F, 4.0F, 0.0F);
this.head.setTextureOffset(21, 0).addBox(-1.5F, 0.0F, -7.0F, 3.0F, 3.0F, 3.0F, 0.0F);
// Левое ухо (дочерний элемент головы)
this.leftEar = new ModelRenderer(this);
this.leftEar.setRotationPoint(3.0F, 3.0F, -2.0F);
this.leftEar.setTextureOffset(32, 4).addBox(0.0F, -5.0F, -1.5F, 1.0F, 3.0F, 3.0F, 0.0F);
this.leftEar.setTextureOffset(34, 1).addBox(0.0F, -5.5F, -0.75F, 1.0F, 1.0F, 1.5F, 0.0F);
this.head.addChild(this.leftEar);
// Правое ухо (дочерний элемент головы)
this.rightEar = new ModelRenderer(this);
this.rightEar.setRotationPoint(-3.0F, 3.0F, -2.0F);
this.rightEar.setTextureOffset(32, 4).addBox(-1.0F, -5.0F, -1.5F, 1.0F, 3.0F, 3.0F, 0.0F);
this.rightEar.setTextureOffset(34, 1).addBox(-1.0F, -5.5F, -0.75F, 1.0F, 1.0F, 1.5F, 0.0F);
this.head.addChild(this.rightEar);
// Шея
this.neck = new ModelRenderer(this);
this.neck.setRotationPoint(0.0F, 10.5F, -5.0F);
this.neck.rotateAngleX = -25.0F * (float)(Math.PI / 180.0); // -25 градусов в радианы
this.neck.setTextureOffset(15, 7).addBox(-2.95F, -1.0F, -4.0F, 5.9F, 5.0F, 6.0F, 0.0F);
// Тело (без собственных кубов, только как родитель)
this.body = new ModelRenderer(this);
this.body.setRotationPoint(0.0F, 13.5F, -5.0F);
// Грудь (дочерний элемент тела)
this.chest = new ModelRenderer(this);
this.chest.setRotationPoint(0.0F, 0.0F, 3.0F);
this.chest.setTextureOffset(32, 13).addBox(-4.0F, -3.5F, -3.0F, 8.0F, 7.0F, 6.0F, 0.0F);
this.body.addChild(this.chest);
// Спина (дочерний элемент тела)
this.back = new ModelRenderer(this);
this.back.setRotationPoint(0.0F, -0.5F, 5.5F);
this.back.setTextureOffset(3, 19).addBox(-3.0F, -3.0F, -0.5F, 6.0F, 6.0F, 11.0F, 0.0F);
this.body.addChild(this.back);
// Передняя левая нога
this.frontLeftLeg = new ModelRenderer(this);
this.frontLeftLeg.setRotationPoint(1.5F, 16.0F, -3.0F);
this.frontLeftLeg.setTextureOffset(42, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 5.0F, 2.0F, 0.0F);
// Передняя правая нога (с зеркалированием текстуры)
this.frontRightLeg = new ModelRenderer(this);
this.frontRightLeg.setRotationPoint(-1.5F, 16.0F, -3.0F);
this.frontRightLeg.setTextureOffset(42, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 5.0F, 2.0F, 0.0F);
this.frontRightLeg.mirror = true;
// Задняя левая нога
this.leftBackLeg = new ModelRenderer(this);
this.leftBackLeg.setRotationPoint(1.5F, 16.0F, 9.0F);
this.leftBackLeg.setTextureOffset(52, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 5.0F, 2.0F, 0.0F);
// Задняя правая нога (с зеркалированием текстуры)
this.rightBackLeg = new ModelRenderer(this);
this.rightBackLeg.setRotationPoint(-1.5F, 16.0F, 9.0F);
this.rightBackLeg.setTextureOffset(52, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 5.0F, 2.0F, 0.0F);
this.rightBackLeg.mirror = true;
// Хвост
this.tail = new ModelRenderer(this);
this.tail.setRotationPoint(0.0F, 9.0F, 10.0F);
this.tail.rotateAngleX = 22.5F * (float)(Math.PI / 180.0); // 22.5 градусов в радианы
this.tail.setTextureOffset(2, 12).addBox(-1.0F, 2.0F, -1.0F, 2.0F, 8.0F, 2.0F, 0.0F);
}
/**
* Sets this entity's model rotation angles
*/
public void setRotationAngles(float ageInTicks, RichiBrain brain)
{
// Поворот головы в зависимости от направления взгляда
head.rotateAngleY = brain.getYaw() * ((float)Math.PI / 180F);
head.rotateAngleX = brain.getPitch() * ((float)Math.PI / 180F);
// Анимация ног (как у волка)
frontLeftLeg.rotateAngleX = (float)Math.cos(brain.limbSwing * 0.6662F) * 1.4F * brain.limbSwingAmount;
frontRightLeg.rotateAngleX = (float)Math.cos(brain.limbSwing * 0.6662F + (float)Math.PI) * 1.4F * brain.limbSwingAmount;
leftBackLeg.rotateAngleX = (float)Math.cos(brain.limbSwing * 0.6662F + (float)Math.PI) * 1.4F * brain.limbSwingAmount;
rightBackLeg.rotateAngleX = (float)Math.cos(brain.limbSwing * 0.6662F) * 1.4F * brain.limbSwingAmount;
if (brain.isLay()) {
frontLeftLeg.rotateAngleX = (float) Math.toRadians(-90);
frontRightLeg.rotateAngleX = (float) Math.toRadians(-90);
leftBackLeg.rotateAngleX = (float) Math.toRadians(90);
rightBackLeg.rotateAngleX = (float) Math.toRadians(90);
frontLeftLeg.rotateAngleY = (float) Math.toRadians(-22);
frontRightLeg.rotateAngleY = (float) Math.toRadians(22);
leftBackLeg.rotateAngleY = (float) Math.toRadians(22);
rightBackLeg.rotateAngleY = (float) Math.toRadians(-22);
} else {
frontLeftLeg.rotateAngleY = (float) Math.toRadians(0);
frontRightLeg.rotateAngleY = (float) Math.toRadians(0);
leftBackLeg.rotateAngleY = (float) Math.toRadians(0);
rightBackLeg.rotateAngleY = (float) Math.toRadians(0);
}
tail.rotateAngleX = (float) Math.toRadians(brain.isLay() ? 45 : 22);
// Анимация хвоста (постоянное покачивание, как у волка)
tail.rotateAngleZ = (float) (Math.toRadians(-22.5F) + 22.5F * (float)(Math.PI / 180.0) + (float)Math.cos(ageInTicks * 0.15F) * 0.3F);
}
@Override
public ModelRenderer getModelHead() {
return head;
}
@Override
public void translateHand(HandSide sideIn, MatrixStack matrixStackIn) {
}
public void render(MatrixStack matrixStackIn, EventRenderWorldEntities e, RichiBrain brain) {
IVertexBuilder bufferIn = e.getVertex().getBuffer(RenderType.getEntityTranslucent(new ResourceLocation("minecraft", "minced/models/djekrussel.png")));
int packedLightIn = DynamicLights.getCombinedLight(new BlockPos(brain.getPos()), 999);
int packedOverlayIn = OverlayTexture.NO_OVERLAY;
matrixStackIn.push();
matrixStackIn.translate(0.0, 1.2f - (brain.isLay() ? 0.3f : 0), 0.0);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180.0F));
matrixStackIn.rotate(Vector3f.YP.rotationDegrees(brain.getBody()));
this.head.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.neck.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.body.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.frontLeftLeg.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.frontRightLeg.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.leftBackLeg.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.rightBackLeg.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
this.tail.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
matrixStackIn.pop();
}
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
}
}
Richi texture:
Пожалуйста, авторизуйтесь для просмотра ссылки.
(Тут 2 текстуры 1 это такса,а 2 это джек рассел террьер)SS:
Наверное спастить на экспу возможно,пишите если над утилы(Это единственная вещь с минцеда которая у меня есть)