mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Fixed horns and horn glows
This commit is contained in:
parent
8a90df8c5a
commit
867f14dd0c
4 changed files with 47 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.model.MsonPart;
|
||||
|
@ -94,9 +95,19 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
|||
if (hasHorn()) {
|
||||
head.rotate(stack);
|
||||
horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes.interpolatorId);
|
||||
if (canCast() && isCasting()) {
|
||||
horn.renderMagic(stack, getMagicColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||
super.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
|
||||
if (hasHorn() && canCast() && isCasting()) {
|
||||
stack.push();
|
||||
head.rotate(stack);
|
||||
transform(BodyPart.HEAD, stack);
|
||||
horn.renderMagic(stack, vertices, getMagicColor());
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,15 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.RenderPhase;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.render.VertexConsumerProvider.Immediate;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.client.render.MagicGlow;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
@ -36,11 +42,12 @@ public class UnicornHorn implements IPart, MsonModel {
|
|||
}
|
||||
}
|
||||
|
||||
public void renderMagic(MatrixStack stack, int tint) {
|
||||
public void renderMagic(MatrixStack stack, VertexConsumer verts, int tint) {
|
||||
if (visible) {
|
||||
horn.rotate(stack);
|
||||
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
||||
|
||||
VertexConsumer vertices = immediate.getBuffer(MagicGlow.getRenderLayer());
|
||||
|
||||
VertexConsumer vertices = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().getBuffer(RenderLayer.getTranslucentNoCrumbling());
|
||||
glow.render(stack, vertices, OverlayTexture.DEFAULT_UV, 0x0F00F0, Color.r(tint), Color.g(tint), Color.b(tint), 0.4F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ import net.minecraft.util.Arm;
|
|||
import net.minecraft.util.UseAction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import static com.mojang.blaze3d.systems.RenderSystem.*;
|
||||
|
||||
public class LevitatingItemRenderer {
|
||||
|
||||
private static boolean usingTransparency;
|
||||
|
@ -61,11 +59,11 @@ public class LevitatingItemRenderer {
|
|||
}
|
||||
|
||||
private void setColor(int glowColor) {
|
||||
GL14.glBlendColor(Color.r(glowColor), Color.g(glowColor), Color.b(glowColor), 0.2F);
|
||||
//GL14.glBlendColor(Color.r(glowColor), Color.g(glowColor), Color.b(glowColor), 0.2F);
|
||||
}
|
||||
|
||||
private void unsetColor() {
|
||||
GL14.glBlendColor(255, 255, 255, 1);
|
||||
//GL14.glBlendColor(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +85,6 @@ public class LevitatingItemRenderer {
|
|||
itemRenderer.method_23177(entity, stack, transform, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV);
|
||||
|
||||
if (doMagic) {
|
||||
disableLighting();
|
||||
|
||||
usingTransparency = true;
|
||||
|
||||
setColor(pony.getMetadata().getGlowColor());
|
||||
|
@ -103,7 +99,6 @@ public class LevitatingItemRenderer {
|
|||
usingTransparency = false;
|
||||
|
||||
unsetColor();
|
||||
enableLighting();
|
||||
}
|
||||
|
||||
matrix.pop();
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.RenderPhase;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
|
||||
public class MagicGlow extends RenderPhase {
|
||||
|
||||
public MagicGlow(String name, Runnable beginAction, Runnable endAction) {
|
||||
super(name, beginAction, endAction);
|
||||
}
|
||||
|
||||
public static RenderLayer getRenderLayer() {
|
||||
return RenderLayer.method_24048("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, 7, 256, RenderLayer.MultiPhaseData.builder()
|
||||
.texture(NO_TEXTURE)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.lightmap(DISABLE_LIGHTMAP)
|
||||
.cull(DISABLE_CULLING)
|
||||
.build(false));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue