Jump to content

custom entity not rendering [SOLVED]


Stephen_789

Recommended Posts

I am attempting to create my first mod, but after creating a custom entity I ran into a problem: when I spawn the entity in it refuses to render

 

after a bit of experimentation, my friend and I figured out that the problem is between the registerEntityRenderingHandler in my client proxy and doRender. I know that the entity is being spawned in (the entity count goes up) and the proxy works because I've used it for tileEntities in the past. Its just not calling the doRender for some reason.

 

the client proxy is as follows:

 

import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;

public class clientProxy extends commonProxy {

public void registerProxies() {

	RenderingRegistry.registerEntityRenderingHandler(entityNew.class, new renderNew());

}

}

 

 

and the render class itself includes the following:

 

import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderEntity;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class renderNew extends Render {

public void doRender(Entity entity, double x, double y, double z, float f1, float f2) {

	//Rendering Code

}

@Override
protected ResourceLocation getEntityTexture(Entity entity) {
	return null;
}

}

 

 

I know its not a problem with my rendering code (I have rendering code, I just cut it off to shorten the code to look through) since my friend tried replacing it with a normal render class and it still didn't work.

 

I'd appreciate any help you could give me

 

EDIT: My friend recommended that I include the following pieces of information:

-in addition to doRender not being run, the function (func_147939_a) that calls the doRender is not getting run for the entity

-the entity is registered with EntityRegistry.registerModEntity in the main mod class

 

Link to comment
Share on other sites

You shouldn't remove code from your post of your render class. There may still be some issue there (although I understand why you think there is not).

 

Anyway, when people think that an entity is not rendering, it can actually be other problems:

1) maybe the entity is not spawning at all. Confirm that the constructor for your entity is being called (by using a System.out.println statement or similar)

2) maybe the entity is spawning but is spawning in position 0, 0, 0 or in some other position not near the player. In your entity's onUpdate() use System.out.println to output the entity position to the console.

3) Your texture mapping is off and so you're seeing through your entity due to transparent part of texture being mapped. I find it is a good idea to delete your texture asset while debugging entity rendering, then you'll get that pink and block checkered default pattern so you'll be sure to see it if it is there.

 

Also not that when testing entity rendering it is a good idea to make the entity bounding box visible. You can do this by pressing F3+B.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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