Fixed custom entity model partially visible render

This commit is contained in:
Goodbird committed 2024-03-09 22:52:19 +03:00
1 parent f434585aec
commit 44ed3b3991
3 files changed
+24 -12

No files matched your search

@@ -87,6 +87,9 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
if(animatable.hurtTime>0 || animatable.deathTime > 0){
return Color.ofRGBA(255, 30, 30, 255);
}else{
if(animatable.isSemiVisible){
return Color.ofRGBA(255, 255, 255, 100);
}
return Color.ofRGBA(255, 255, 255, 255);
}
}
@@ -32,6 +32,7 @@ public class EntityCustomModel extends EntityCreature implements IAnimatable, IA
public AnimationBuilder attackAnim = null;
public AnimationBuilder hurtAnim = null;
public ItemStack leftHeldItem;
public boolean isSemiVisible = false;
private <E extends IAnimatable> PlayState predicateMovement(AnimationEvent<E> event) {
if (manualAnim != null) {
@@ -123,21 +123,29 @@ public class MixinGeckoAddonClient {
(mainModel).entity.renderYawOffset = (mainModel).entity.prevRenderYawOffset = 0;
if (!npc.isInvisible())
{
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
if(mainModel.entity instanceof EntityCustomModel){
((EntityCustomModel)mainModel.entity).isSemiVisible = false;
}
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0,0,0,rot,partial);
}
else if (!npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
{
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glPopMatrix();
GL11.glDepthMask(true);
if(mainModel.entity instanceof EntityCustomModel){
((EntityCustomModel)mainModel.entity).isSemiVisible = true;
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0,0,0,rot,partial);
}else {
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0, 0, 0, rot, partial);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glPopMatrix();
GL11.glDepthMask(true);
}
}
}
}