mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 01:27:27 +00:00
Implemented tint rendering
This commit is contained in:
1 parent
a86ab2b84d
commit
6dcbee69cd
4 files changed
+38
-10
No files matched your search
@@ -11,6 +11,7 @@ import noppes.npcs.client.model.part.legs.ModelMermaidLegs2;
|
||||
import noppes.npcs.client.model.part.legs.ModelNagaLegs;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -386,7 +387,9 @@ public class ModelLegs extends ModelScaleRenderer{
|
||||
y *= 2f;
|
||||
}
|
||||
}
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor;
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isEnableCustomTint() && customTintData.isEnableNpcTint());
|
||||
if(bo){
|
||||
float red = (entity.modelData.legParts.color >> 16 & 255) / 255f;
|
||||
float green = (entity.modelData.legParts.color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -10,6 +10,7 @@ import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.part.tails.*;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -150,7 +151,9 @@ public class ModelTail extends ModelScaleRenderer {
|
||||
base.currentlyPlayerTexture = true;
|
||||
}
|
||||
}
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0;
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isEnableCustomTint() && customTintData.isEnableNpcTint());
|
||||
if(bo){
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
@@ -59,7 +60,9 @@ public abstract class ModelPartInterface extends ModelRenderer {
|
||||
base.currentlyPlayerTexture = true;
|
||||
}
|
||||
}
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor;
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isEnableCustomTint() && customTintData.isEnableNpcTint());
|
||||
if(bo){
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -28,6 +28,7 @@ import noppes.npcs.client.ImageDownloadAlt;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -218,10 +219,10 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
|
||||
staticRenderManager = this.renderManager;
|
||||
|
||||
doRenderLiving(entityliving, d, d1, d2, f, f1);
|
||||
doRenderLiving(npc, d, d1, d2, f, f1);
|
||||
}
|
||||
|
||||
public void doRenderLiving(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
|
||||
public void doRenderLiving(EntityNPCInterface p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return;
|
||||
GL11.glPushMatrix();
|
||||
@@ -371,8 +372,8 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0)
|
||||
CustomTintData customTintData = p_76986_1_.display.customTintData;
|
||||
if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0 || (customTintData.isEnableCustomTint() && customTintData.isEnableNpcTint()))
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -380,16 +381,26 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
|
||||
if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0)
|
||||
if ((p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) && (!customTintData.isEnableCustomTint() || customTintData.isEnableHurtTint()))
|
||||
{
|
||||
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
|
||||
float r, g, b;
|
||||
if(customTintData.isEnableCustomTint()) {
|
||||
r = (float) (customTintData.getColorHurtTint() >> 16 & 255) / 255.0F * f14;
|
||||
g = (float) (customTintData.getColorHurtTint() >> 8 & 255) / 255.0F * f14;
|
||||
b = (float) (customTintData.getColorHurtTint() & 255) / 255.0F * f14;
|
||||
}else{
|
||||
r=f14;
|
||||
g=0;
|
||||
b=0;
|
||||
}
|
||||
GL11.glColor4f(r,g,b, 0.4F);
|
||||
this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
|
||||
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0)
|
||||
{
|
||||
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
|
||||
GL11.glColor4f(r,g,b, 0.4F);
|
||||
this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, f13, f5);
|
||||
}
|
||||
}
|
||||
@@ -454,6 +465,14 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
return p_77034_1_ + p_77034_3_ * f3;
|
||||
}
|
||||
|
||||
protected int getColorMultiplier(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_)
|
||||
{
|
||||
EntityNPCInterface npc = (EntityNPCInterface) p_77030_1_;
|
||||
CustomTintData tintData = npc.display.customTintData;
|
||||
int alpha = (int) (0xff*((double)tintData.getColorNpcTintAlpha()/100d)) << 24;
|
||||
return (tintData.isEnableCustomTint() && tintData.isEnableNpcTint())?tintData.getColorNpcTint()+alpha:0;
|
||||
}
|
||||
|
||||
protected void renderModel(EntityLivingBase entityliving, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entityliving;
|
||||
if(GeckoAddonClient.Instance.isGeckoModel(mainModel)){
|
||||
|
||||
Reference in new issue
Block a user