Jump to content

Recommended Posts

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!

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

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