Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Визуальная часть HitColor | 3.1 :3

Начинающий
Начинающий
Статус
Онлайн
Регистрация
7 Фев 2024
Сообщения
153
Реакции
0
Выберите загрузчик игры
  1. Vanilla
немного кривой, но сойдет (необходим колорпикер для работы режима "свой")
1756814340739.png
1756814468574.png

Код:
Expand Collapse Copy
package Fever.Visual.functions.impl.render;

import Fever.Visual.functions.api.Category;
import Fever.Visual.functions.api.Function;
import Fever.Visual.functions.api.FunctionRegister;
import Fever.Visual.functions.settings.impl.ColorSetting;
import Fever.Visual.functions.settings.impl.ModeSetting;
import Fever.Visual.utils.render.ColorUtils;

@FunctionRegister(
        name = "HitColor",
        type = Category.Graphics
)
public class HitColor extends Function {
    public static final ModeSetting mode = new ModeSetting("Мод","Клиент","Клиент","Свой");
    public static final ColorSetting colorSetting = new ColorSetting("Color", 0x000000).setVisible(() -> mode.is("Свой"));
    public HitColor() {
    addSettings(mode,colorSetting);}}
LivingRenderer:
Expand Collapse Copy
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
        if (!Reflector.RenderLivingEvent_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Pre_Constructor, entityIn, this, partialTicks, matrixStackIn, bufferIn, packedLightIn)) {
            if (animateModelLiving) {
                entityIn.limbSwingAmount = 1.0F;
            }

            matrixStackIn.push();
            this.entityModel.swingProgress = this.getSwingProgress(entityIn, partialTicks);
            this.entityModel.isSitting = entityIn.isPassenger();

            if (Reflector.IForgeEntity_shouldRiderSit.exists()) {
                this.entityModel.isSitting = entityIn.isPassenger() && entityIn.getRidingEntity() != null &&
                        Reflector.callBoolean(entityIn.getRidingEntity(), Reflector.IForgeEntity_shouldRiderSit);
            }
            if (BabyBoy.isEnabled()) {
                if (entityIn instanceof PlayerEntity) {
                    ClientPlayerEntity player = Minecraft.getInstance().player;
                    if (player != null) {
                        String playerName = player.getGameProfile().getName();
                        String entityName = ((PlayerEntity) entityIn).getGameProfile().getName();
                        if (entityIn.getScoreboardName().equals(player.getScoreboardName())) {
                            this.entityModel.isChild = true;
                        }
                        else if (BabyBoy.FriendStorage.isFriend(entityName) ||
                                (BabyBoy.FriendStorage.isFriend(playerName) &&
                                        entityIn.getScoreboardName().equals(player.getScoreboardName()))) {
                            this.entityModel.isChild = true;
                        }
                        else {
                            this.entityModel.isChild = entityIn.isChild();
                        }
                    }
                } else {
                    this.entityModel.isChild = entityIn.isChild();
                }
            } else {
                this.entityModel.isChild = entityIn.isChild();
            }
            float f = MathHelper.interpolateAngle(partialTicks, entityIn.prevRenderYawOffset, entityIn.renderYawOffset);
            float f1 = MathHelper.interpolateAngle(partialTicks, entityIn.prevRotationYawHead, entityIn.rotationYawHead);
            float f2 = f1 - f;

            if (this.entityModel.isSitting && entityIn.getRidingEntity() instanceof LivingEntity) {
                LivingEntity livingentity = (LivingEntity) entityIn.getRidingEntity();
                f = MathHelper.interpolateAngle(partialTicks, livingentity.prevRenderYawOffset, livingentity.renderYawOffset);
                f2 = f1 - f;
                float f3 = MathHelper.wrapDegrees(f2);

                if (f3 < -85.0F) {
                    f3 = -85.0F;
                }

                if (f3 >= 85.0F) {
                    f3 = 85.0F;
                }

                f = f1 - f3;

                if (f3 * f3 > 2500.0F) {
                    f += f3 * 0.2F;
                }

                f2 = f1 - f;
            }

            float f7;
            if (entityIn == Minecraft.getInstance().getRenderViewEntity()) {
                f7 = MathHelper.lerp(partialTicks, entityIn.prevRotationPitchHead, entityIn.rotationPitchHead);
            } else {
                f7 = MathHelper.lerp(partialTicks, entityIn.prevRotationPitch, entityIn.rotationPitch);
            }

            if (entityIn.getPose() == Pose.SLEEPING) {
                Direction direction = entityIn.getBedDirection();

                if (direction != null) {
                    float f4 = entityIn.getEyeHeight(Pose.STANDING) - 0.1F;
                    matrixStackIn.translate((double) ((float) (-direction.getXOffset()) * f4), 0.0D, (double) ((float) (-direction.getZOffset()) * f4));
                }
            }

            float f8 = this.handleRotationFloat(entityIn, partialTicks);
            this.applyRotations(entityIn, matrixStackIn, f8, f, partialTicks);
            matrixStackIn.scale(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(entityIn, matrixStackIn, partialTicks);
            matrixStackIn.translate(0.0D, (double) -1.501F, 0.0D);
            float f9 = 0.0F;
            float f5 = 0.0F;

            if (!entityIn.isPassenger() && entityIn.isAlive()) {
                f9 = MathHelper.lerp(partialTicks, entityIn.prevLimbSwingAmount, entityIn.limbSwingAmount);
                f5 = entityIn.limbSwing - entityIn.limbSwingAmount * (1.0F - partialTicks);

                if (entityIn.isChild()) {
                    f5 *= 3.0F;
                }

                if (f9 > 1.0F) {
                    f9 = 1.0F;
                }
            }

            this.entityModel.setLivingAnimations(entityIn, f5, f9, partialTicks);
            this.entityModel.setRotationAngles(entityIn, f5, f9, f8, f2, f7);

            if (CustomEntityModels.isActive()) {
                this.renderEntity = entityIn;
                this.renderLimbSwing = f5;
                this.renderLimbSwingAmount = f9;
                this.renderAgeInTicks = f8;
                this.renderHeadYaw = f2;
                this.renderHeadPitch = f7;
                this.renderPartialTicks = partialTicks;
            }

            boolean flag = Config.isShaders();
            Minecraft minecraft = Minecraft.getInstance();
            boolean flag1 = this.isVisible(entityIn);
            boolean flag2 = !flag1 && !entityIn.isInvisibleToPlayer(minecraft.player);
            boolean flag3 = minecraft.isEntityGlowing(entityIn);
            RenderType rendertype = this.func_230496_a_(entityIn, flag1, flag2, flag3);

            if (rendertype != null) {
                IVertexBuilder ivertexbuilder = bufferIn.getBuffer(rendertype);
                float f6 = this.getOverlayProgress(entityIn, partialTicks);
                float red = 1.0F;
                float green = 1.0F;
                float blue = 1.0F;
                float alpha = flag2 ? 0.15F : 1.0F;

                if (entityIn.hurtTime > 0 && FeverVisual.getInstance().getFunctionRegistry().getHitColor().isState()) {
                    try {
                        if ("Клиент".equals(HitColor.mode.get())) {
                            int themeColor = ColorUtils.setAlpha(HUD.getColor(0, 10), 255);
                            float[] colors = DisplayUtils.IntColor.rgb(themeColor);
                            red = colors[0];
                            green = colors[1];
                            blue = colors[2];
                        } else if ("Свой".equals(HitColor.mode.get())) {
                            int customColor = HitColor.colorSetting.get();
                            float[] colors = DisplayUtils.IntColor.rgb(customColor);
                            red = colors[0];
                            green = colors[1];
                            blue = colors[2];
                        }
                    } catch (Exception e) {
                        red = 0.0F;
                        green = 1.0F;
                        blue = 1.0F;
                    }
                }

                if (f6 > 0.0F) {
                    Shaders.setEntityColor(f6, f6, f6, 0.5F);
                }

                int i = getPackedOverlay(entityIn, f6);
                this.entityModel.render(matrixStackIn, ivertexbuilder, packedLightIn, i, red, green, blue, alpha);
            }
            if (!entityIn.isSpectator()) {
                for (LayerRenderer<T, M> layerrenderer : this.layerRenderers) {
                    layerrenderer.render(matrixStackIn, bufferIn, packedLightIn, entityIn, f5, f9, partialTicks, f8, f2, f7);
                }
            }

            if (Config.isShaders()) {
                Shaders.setEntityColor(0.0F, 0.0F, 0.0F, 0.0F);
            }

            if (CustomEntityModels.isActive()) {
                this.renderEntity = null;
            }

            matrixStackIn.pop();
            super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);

            if (Reflector.RenderLivingEvent_Post_Constructor.exists()) {
                Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, entityIn, this, partialTicks, matrixStackIn, bufferIn, packedLightIn);
            }}}
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
сюда тоже шейдер ебануть надо и классно выйдет
 
даже без полива говна напишу, перестаньте мучать экспенсив, никому ваши всякие хитпениса 3.1 реди не всрались, делайте чет годное, сливайте к примеру новичкам новый рендер под 1.21.8, гайды делайте познавательные, доконали уже серьёзно :facepalm:
 
даже без полива говна напишу, перестаньте мучать экспенсив, никому ваши всякие хитпениса 3.1 реди не всрались, делайте чет годное, сливайте к примеру новичкам новый рендер под 1.21.8, гайды делайте познавательные, доконали уже серьёзно :facepalm:
кто-то отрезвел от экспенсива
 
немного кривой, но сойдет (необходим колорпикер для работы режима "свой")
Посмотреть вложение 314853Посмотреть вложение 314856
Код:
Expand Collapse Copy
package Fever.Visual.functions.impl.render;

import Fever.Visual.functions.api.Category;
import Fever.Visual.functions.api.Function;
import Fever.Visual.functions.api.FunctionRegister;
import Fever.Visual.functions.settings.impl.ColorSetting;
import Fever.Visual.functions.settings.impl.ModeSetting;
import Fever.Visual.utils.render.ColorUtils;

@FunctionRegister(
        name = "HitColor",
        type = Category.Graphics
)
public class HitColor extends Function {
    public static final ModeSetting mode = new ModeSetting("Мод","Клиент","Клиент","Свой");
    public static final ColorSetting colorSetting = new ColorSetting("Color", 0x000000).setVisible(() -> mode.is("Свой"));
    public HitColor() {
    addSettings(mode,colorSetting);}}
LivingRenderer:
Expand Collapse Copy
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
        if (!Reflector.RenderLivingEvent_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Pre_Constructor, entityIn, this, partialTicks, matrixStackIn, bufferIn, packedLightIn)) {
            if (animateModelLiving) {
                entityIn.limbSwingAmount = 1.0F;
            }

            matrixStackIn.push();
            this.entityModel.swingProgress = this.getSwingProgress(entityIn, partialTicks);
            this.entityModel.isSitting = entityIn.isPassenger();

            if (Reflector.IForgeEntity_shouldRiderSit.exists()) {
                this.entityModel.isSitting = entityIn.isPassenger() && entityIn.getRidingEntity() != null &&
                        Reflector.callBoolean(entityIn.getRidingEntity(), Reflector.IForgeEntity_shouldRiderSit);
            }
            if (BabyBoy.isEnabled()) {
                if (entityIn instanceof PlayerEntity) {
                    ClientPlayerEntity player = Minecraft.getInstance().player;
                    if (player != null) {
                        String playerName = player.getGameProfile().getName();
                        String entityName = ((PlayerEntity) entityIn).getGameProfile().getName();
                        if (entityIn.getScoreboardName().equals(player.getScoreboardName())) {
                            this.entityModel.isChild = true;
                        }
                        else if (BabyBoy.FriendStorage.isFriend(entityName) ||
                                (BabyBoy.FriendStorage.isFriend(playerName) &&
                                        entityIn.getScoreboardName().equals(player.getScoreboardName()))) {
                            this.entityModel.isChild = true;
                        }
                        else {
                            this.entityModel.isChild = entityIn.isChild();
                        }
                    }
                } else {
                    this.entityModel.isChild = entityIn.isChild();
                }
            } else {
                this.entityModel.isChild = entityIn.isChild();
            }
            float f = MathHelper.interpolateAngle(partialTicks, entityIn.prevRenderYawOffset, entityIn.renderYawOffset);
            float f1 = MathHelper.interpolateAngle(partialTicks, entityIn.prevRotationYawHead, entityIn.rotationYawHead);
            float f2 = f1 - f;

            if (this.entityModel.isSitting && entityIn.getRidingEntity() instanceof LivingEntity) {
                LivingEntity livingentity = (LivingEntity) entityIn.getRidingEntity();
                f = MathHelper.interpolateAngle(partialTicks, livingentity.prevRenderYawOffset, livingentity.renderYawOffset);
                f2 = f1 - f;
                float f3 = MathHelper.wrapDegrees(f2);

                if (f3 < -85.0F) {
                    f3 = -85.0F;
                }

                if (f3 >= 85.0F) {
                    f3 = 85.0F;
                }

                f = f1 - f3;

                if (f3 * f3 > 2500.0F) {
                    f += f3 * 0.2F;
                }

                f2 = f1 - f;
            }

            float f7;
            if (entityIn == Minecraft.getInstance().getRenderViewEntity()) {
                f7 = MathHelper.lerp(partialTicks, entityIn.prevRotationPitchHead, entityIn.rotationPitchHead);
            } else {
                f7 = MathHelper.lerp(partialTicks, entityIn.prevRotationPitch, entityIn.rotationPitch);
            }

            if (entityIn.getPose() == Pose.SLEEPING) {
                Direction direction = entityIn.getBedDirection();

                if (direction != null) {
                    float f4 = entityIn.getEyeHeight(Pose.STANDING) - 0.1F;
                    matrixStackIn.translate((double) ((float) (-direction.getXOffset()) * f4), 0.0D, (double) ((float) (-direction.getZOffset()) * f4));
                }
            }

            float f8 = this.handleRotationFloat(entityIn, partialTicks);
            this.applyRotations(entityIn, matrixStackIn, f8, f, partialTicks);
            matrixStackIn.scale(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(entityIn, matrixStackIn, partialTicks);
            matrixStackIn.translate(0.0D, (double) -1.501F, 0.0D);
            float f9 = 0.0F;
            float f5 = 0.0F;

            if (!entityIn.isPassenger() && entityIn.isAlive()) {
                f9 = MathHelper.lerp(partialTicks, entityIn.prevLimbSwingAmount, entityIn.limbSwingAmount);
                f5 = entityIn.limbSwing - entityIn.limbSwingAmount * (1.0F - partialTicks);

                if (entityIn.isChild()) {
                    f5 *= 3.0F;
                }

                if (f9 > 1.0F) {
                    f9 = 1.0F;
                }
            }

            this.entityModel.setLivingAnimations(entityIn, f5, f9, partialTicks);
            this.entityModel.setRotationAngles(entityIn, f5, f9, f8, f2, f7);

            if (CustomEntityModels.isActive()) {
                this.renderEntity = entityIn;
                this.renderLimbSwing = f5;
                this.renderLimbSwingAmount = f9;
                this.renderAgeInTicks = f8;
                this.renderHeadYaw = f2;
                this.renderHeadPitch = f7;
                this.renderPartialTicks = partialTicks;
            }

            boolean flag = Config.isShaders();
            Minecraft minecraft = Minecraft.getInstance();
            boolean flag1 = this.isVisible(entityIn);
            boolean flag2 = !flag1 && !entityIn.isInvisibleToPlayer(minecraft.player);
            boolean flag3 = minecraft.isEntityGlowing(entityIn);
            RenderType rendertype = this.func_230496_a_(entityIn, flag1, flag2, flag3);

            if (rendertype != null) {
                IVertexBuilder ivertexbuilder = bufferIn.getBuffer(rendertype);
                float f6 = this.getOverlayProgress(entityIn, partialTicks);
                float red = 1.0F;
                float green = 1.0F;
                float blue = 1.0F;
                float alpha = flag2 ? 0.15F : 1.0F;

                if (entityIn.hurtTime > 0 && FeverVisual.getInstance().getFunctionRegistry().getHitColor().isState()) {
                    try {
                        if ("Клиент".equals(HitColor.mode.get())) {
                            int themeColor = ColorUtils.setAlpha(HUD.getColor(0, 10), 255);
                            float[] colors = DisplayUtils.IntColor.rgb(themeColor);
                            red = colors[0];
                            green = colors[1];
                            blue = colors[2];
                        } else if ("Свой".equals(HitColor.mode.get())) {
                            int customColor = HitColor.colorSetting.get();
                            float[] colors = DisplayUtils.IntColor.rgb(customColor);
                            red = colors[0];
                            green = colors[1];
                            blue = colors[2];
                        }
                    } catch (Exception e) {
                        red = 0.0F;
                        green = 1.0F;
                        blue = 1.0F;
                    }
                }

                if (f6 > 0.0F) {
                    Shaders.setEntityColor(f6, f6, f6, 0.5F);
                }

                int i = getPackedOverlay(entityIn, f6);
                this.entityModel.render(matrixStackIn, ivertexbuilder, packedLightIn, i, red, green, blue, alpha);
            }
            if (!entityIn.isSpectator()) {
                for (LayerRenderer<T, M> layerrenderer : this.layerRenderers) {
                    layerrenderer.render(matrixStackIn, bufferIn, packedLightIn, entityIn, f5, f9, partialTicks, f8, f2, f7);
                }
            }

            if (Config.isShaders()) {
                Shaders.setEntityColor(0.0F, 0.0F, 0.0F, 0.0F);
            }

            if (CustomEntityModels.isActive()) {
                this.renderEntity = null;
            }

            matrixStackIn.pop();
            super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);

            if (Reflector.RenderLivingEvent_Post_Constructor.exists()) {
                Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, entityIn, this, partialTicks, matrixStackIn, bufferIn, packedLightIn);
            }}}
добавь шейдер
 
даже окрашивание брони при ударе не сделал, так ещё не вырезал дефолтный цвет майнкрафта от удара, тут одним классом не отделаешься
 
даже окрашивание брони при ударе не сделал, так ещё не вырезал дефолтный цвет майнкрафта от удара, тут одним классом не отделаешься
уже сделал. и не нужно создавать отдельные классы для этого :)
 

Похожие темы

Назад
Сверху Снизу