After trying forever to get (partially) transparent mobs I finally found a way to do it, I know this works in 1.8 although I am not sure about higher or lower versions.
For this you just need your entity with access to it's render class
@SideOnly(Side.CLIENT)
public class RenderGhost extends RenderLiving
{
private static final ResourceLocation NORMAL = new ResourceLocation(ModInfo.MOD_ID + ":textures/entity/ghost/ghost.png");
After trying forever to get (partially) transparent mobs I finally found a way to do it, I know this works in 1.8 although I am not sure about higher or lower versions.
For this you just need your entity with access to it's render class
=====================================================
If your render class doesn't already have a doRender method you need to add it
It should look like the following
@Override
public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks) {
super.doRender(entity, x, y, z, f, partialTicks);
}
Now that you have a spot to place the transparency code we can start, within the doRender method place the following
//New code credit to senpaisubaraki
GlStateManager.pushMatrix();GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
super.doRender(entity, x, y, z, f, partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
We are first setting the R, G, B to 1.0F then we set the alpha to 0.5F you can adjust the number to fit your needs
That's it, if you need help leave a comment, below is my full render class for my entity if anyone happens to need it
(don't forget to like the post if it helped)
My full render class
package net.soggymustache.tutorial.entity.ghost;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.soggymustache.tutorial.ModInfo;
@SideOnly(Side.CLIENT)
public class RenderGhost extends RenderLiving
{
private static final ResourceLocation NORMAL = new ResourceLocation(ModInfo.MOD_ID + ":textures/entity/ghost/ghost.png");
public RenderGhost(RenderManager rm, ModelBase mb, float f)
{
super(rm, mb, f);
}
protected ResourceLocation resourceLoc(EntityGhost p_177125_1_)
{
return NORMAL;
}
@Override
public void doRender(Entity entity, double x, double y, double z, float f, float partialTicks) {
GlStateManager.pushMatrix();
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
super.doRender(entity, x, y, z, f, partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
protected ResourceLocation getEntityTexture(Entity entity)
{
return this.resourceLoc((EntityGhost)entity);
}
}
FINAL RESULT
Thanks my first time messing with GL so I was wondering what I was doing wrong when I became transparent.