Jump to content

Recommended Posts

Posted

Okay guys. All of you smart people have helped me get this far.

 

Why is my entity invisible?

 

I'm not getting a texture not found error, and at first it was using some sort of block map texture file.

 

But now I get a shadow, and nothing else. It moves and everything.

 

What am I doing wrong?

 

 

 

 

package com.dragonessatheart.firstmod;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.GlStateManager;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.client.renderer.entity.RendererLivingEntity;

import net.minecraft.client.renderer.entity.layers.LayerWolfCollar;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.EntityLivingBase;

import com.dragonessatheart.firstmod.EntityGiantLizard;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

 

//@SideOnly(Side.CLIENT)

public class RenderGiantLizard extends Render<EntityGiantLizard> { //rLivingEntity {

 

private static final ResourceLocation giantLizardTextures =

new ResourceLocation(Reference.MODID + ":textures/entity/giantlizard.png");

 

 

public RenderGiantLizard(RenderManager renderManager)//, ModelBase model, float shadowSize) //, float scale, String texturePath)

    {

       

super(renderManager);//, model, shadowSize);

        shadowSize = 1F;

    }

   

protected static ModelBase modelGiantLizard = new ModelGiantLizard();

 

 

public void renderGiantLizard(EntityGiantLizard entitygiantlizard, double x, double y, double z, float rotationYaw, float partialTicks)

{

GlStateManager.pushMatrix();

 

GlStateManager.translate((float) x, (float) y, (float) z);

//parameters = angle, x(horiz), y(vert), z(back forth)?

GlStateManager.rotate(180.0F - rotationYaw, 0.0F, 1.0F, 0.0F);

 

//last one is the scale

bindEntityTexture(entitygiantlizard);

modelGiantLizard.render(entitygiantlizard, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F);

 

GlStateManager.popMatrix();

 

super.doRender(entitygiantlizard, x, y, z, rotationYaw, partialTicks);

}

 

public boolean bindEntityTexture(EntityGiantLizard entity) {

 

if (giantLizardTextures == null) {

System.err.println("Texture problem :<");

}

return super.bindEntityTexture(entity);

}

 

    /**

    * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.

    */

    protected ResourceLocation getEntityTexture(EntityGiantLizard entity)

    {

    if (giantLizardTextures == null) {

System.err.println("Texture problem :<");

}

    //return this.getEntityTexture((EntityGiantLizard)entity);

    return giantLizardTextures;

    }

 

//---------------------------------------------------------------------------------------------------------------------------------------------------    

 

 

    //this one takes EntityGiantLizard and does super with the EntityLiving

    public void doRender(EntityGiantLizard entity, double x, double y, double z, float entityYaw, float partialTicks)

    {

    renderGiantLizard(entity, x, y, z, partialTicks, partialTicks);

    super.doRender((EntityGiantLizard)entity, x, y, z, entityYaw, partialTicks);

    } 

 

    /**

    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then

    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic

    * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,

    * double d2, float f, float f1). But JAD is pre 1.5 so doe

    */

    //this one takes EntityLiving and then does this with EntityGiantLizard

    public void doRender(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks)

    {

        this.doRender((EntityGiantLizard)entity, x, y, z, entityYaw, partialTicks);

    }

   

    /**

    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then

    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic

    * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,

    * double d2, float f, float f1). But JAD is pre 1.5 so doe

    */

    public void doRender(EntityLivingBase entity, double x, double y, double z, float entityYaw, float partialTicks)

    {

        this.doRender((EntityGiantLizard)entity, x, y, z, entityYaw, partialTicks);

    }

 

    /**

    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then

    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic

    * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,

    * double d2, float f, float f1). But JAD is pre 1.5 so doe

   

    public void doRender(EntityGiantLizard entity, double x, double y, double z, float entityYaw, float partialTicks)

    {

 

    doRender((EntityGiantLizard)entity, x, y, z, entityYaw, partialTicks);

    }

   

    */

 

   

//end RenderGiantLizard    

}

 

 

 

 

 

 

Posted

Okay, I don't see anything else that Eclipse is yelling at me about so? How is this?

 

The entity is still invisible. No crash, no missing texture file, I'm just confused.

 

 

 

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.GlStateManager;

import net.minecraft.client.renderer.entity.Render;

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;

 

@SideOnly(Side.CLIENT)

public class NewRenderGiantLizard extends Render<EntityGiantLizard> {

 

 

public ResourceLocation giantLizardTexture = new

ResourceLocation(Reference.MODID+":textures/entity/giantlizard.png");

 

protected NewRenderGiantLizard(RenderManager renderManager)

    {

      super(renderManager);

shadowSize = 0.5F;

}

 

 

public void doRender(EntityGiantLizard entity, double x, double y, double z, float entityYaw, float partialTicks)

    {

        super.doRender(entity, x, y, z, entityYaw, partialTicks);

    }

 

 

 

 

 

@Override

protected ResourceLocation getEntityTexture(EntityGiantLizard entity)

{

return giantLizardTexture;

}

 

 

 

}

 

 

 

 

Thanks very much in advance. I'd really like to learn how to do this.

Posted

I have done that and am still messing something up. I really wish I could say I understood completely what my code is doing, but I really don't.

 

I hope you don't kick me off of the forums but this is why I am here. Because I don't know what the code is doing and I'm having a lot of trouble figuring it out. The examples in vanilla forge 1.8.9 that I have seem to use different methods than the ones you are telling me here. At least registering seems to be different.

 

I don't want to give up. When I get home I'm going to take the cow and trace through every call that seems to have to do with rendering to see if I can't figure things out more.

 

Thanks for all of your help. Let me know if you think of other reasons why the rendering just is very broken.

Posted

I have done that and am still messing something up. I really wish I could say I understood completely what my code is doing, but I really don't.

 

I hope you don't kick me off of the forums but this is why I am here. Because I don't know what the code is doing and I'm having a lot of trouble figuring it out. The examples in vanilla forge 1.8.9 that I have seem to use different methods than the ones you are telling me here. At least registering seems to be different.

 

I don't want to give up. When I get home I'm going to take the cow and trace through every call that seems to have to do with rendering to see if I can't figure things out more.

 

Thanks for all of your help. Let me know if you think of other reasons why the rendering just is very broken.

To really understand what your code is doing, you should look at all the functions called. Then look at the source code for those functions, go back till you understand what all the functions that are called inside that function. Then do the same for all the other ones.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

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.

×
×
  • Create New...

Important Information

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