Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello Everyone!

 

I am developing a mod and I making a mob that is semi-transparent. I used photoshop to make the skins semi-transparent. In the game, if the mob is in the nether, it is sometimes transparent. And is not transparent at all in the over world. Should I put some code in my rendering class? I was looking at GL11.glColor4f() and making the red, green and blue 1 with the alpha 0.5 but I think I put that code in the wrong method. Here is my render code:

 

package assets.bm.romejanic.client.render;

import assets.bm.romejanic.common.entity.EntityGhost;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelSkeleton;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;

import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class RenderGhost extends RenderBiped
{
private static final ResourceLocation[] textures = new ResourceLocation[] {

	new ResourceLocation(EntityGhost.getGhostTexture(0)),
	new ResourceLocation(EntityGhost.getGhostTexture(1))

};

public RenderGhost(ModelBiped model)
{
	super(model, 0.5F);
}

protected void func_82422_c()
{
	GL11.glTranslatef(0.09375F, 0.1875F, 0.0F);
}

protected ResourceLocation func_110860_a(EntityGhost ghost)
{
	return ghost.isAngry ? textures[1] : textures[0];
}

protected ResourceLocation func_110856_a(EntityLiving par1EntityLiving)
{
	return this.func_110860_a((EntityGhost)par1EntityLiving);
}

/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
	return this.func_110860_a((EntityGhost)par1Entity);
}

}

 

An I tried to put the GL11.glColor4f(1.0, 1.0, 1.0, 0.5); in the func_82422_c() method, but am I wrong?

 

Thanks!

Romejanic

Romejanic

 

Creator of Witch Hats, Explosive Chickens and Battlefield!

Hi

 

I am just guessing because I have never tried this, but it might give you a couple of clues to try:

- I suspect that alpha blending might sometimes be turned off for rendering entities. 

 

You might need to write a custom renderer for your entity and turn the alpha blending back on

 

            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            GL11.glEnable(GL11.GL_BLEND);

 

- see EntityRenderer.renderWorld() about halfway through.

 

-TGG

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.