Jump to content

[1.7.10] Cannot get this hanging entity to work for the life of me


PhantomTiger

Recommended Posts

Hi

I am creating a mod that is related to ancient Egypt, I have everything coded and well except for one thing, my custom hanging entity (painting format). I have been trying to solve this for nearly a year now, I have even devoted complete weekends to just working on this one thing to only get 0 steps closer each time, I am not someone to give up though, so I refuse to abandon the project. I have read the minecraft source code dozen times over, looked at each function, studied other mods with custom hanging entities, and I am still completely stumped. My problem is that I am trying to make custom paintings for my mod which uses the same png template as normal minecraft paintings, so I wouldn't have to change the enum coordinates. Whenever I test my item which spawns the hanging entity the texture is that of the normal minecraft paintings and not my own, yet they still drop my item. Either it is spawning something I don't want it to or the texture adding is wrong, I don't know. I would be really grateful if someone can see what I'm not.

 

Item Class:

 

public class PapPapHanging extends Item{

private final Class hangpap;
public PapPapHanging(Class clas1) {
	super();
	this.hangpap = clas1;
}

public boolean onItemUse(ItemStack stak, EntityPlayer entplay, World world1, int int1, int int2, int int3, int int4, float flt1, float flt2, float flt3){
	if (int4 == 0){
		return false;
	}
	else if (int4 == 1){
		return false;
	}
	else{
		int i1 = Direction.facingToDirection[int4];
		PapPapEntity entitypap = new PapPapEntity(world1, int1, int2, int3, i1);

			if (!entplay.canPlayerEdit(int1, int2, int3, int4, stak)){
				return false;
			}
			else{
				if (entitypap != null && entitypap.onValidSurface()){
					if (!world1.isRemote){
						world1.spawnEntityInWorld(entitypap);
					}

					--stak.stackSize;
				}

				return true;
			}
	}
}

private PapPapEntity createPapPapEntity(World world2, int int5, int int6, int int7, int int8){
		return (PapPapEntity) (this.hangpap == PapPapEntity.class ? new PapPapEntity(world2, int5, int6, int7, int8) : (this.hangpap == EntityItemFrame.class ? new EntityItemFrame(world2, int5, int6, int7, int8) : null));
}

}

 

 

Entity Class:

 

public class PapPapEntity extends EntityPainting{


public PapPapEntity(World world) {
	super(world);
}

public PapPapEntity(World world2, int int1, int int2, int int3, int int4) {
	super(world2, int1, int2, int3, int4);
}

public void onBroken(Entity entit){
        if (entit instanceof EntityPlayer){
            EntityPlayer entityplayer = (EntityPlayer)entit;

            if (entityplayer.capabilities.isCreativeMode){
                return;
            }
        }

        this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F);
    }

}

 

 

Render Class:

 

@SideOnly(Side.CLIENT)
public class PapPapRender extends Render{

protected static final ResourceLocation textur = new ResourceLocation(RefStrings.MODID + ":textures/painting/egypt.png");


public void renderThePainting(PapPapEntity ent, double douba, double doubb, double doubc, float flota, float flotb){
    	GL11.glPushMatrix();
        GL11.glTranslated(douba, doubb, doubc);
        GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        this.bindEntityTexture(ent);
        PapPapEntity.EnumArt enumart = ent.art;
        float f2 = 0.0625F;
        GL11.glScalef(f2, f2, f2);
        funca(ent, enumart.sizeX, enumart.sizeY);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
    
    protected ResourceLocation getEntityTexture(PapPapEntity entity){
	return textur;
}



    private void funca(PapPapEntity entity1, int inta, int intb){
    	float f = (float)(-inta) / 2.0F;
        float f1 = (float)(-intb) / 2.0F;
        float f2 = 0.5F;
        float f3 = 0.75F;
        float f4 = 0.8125F;
        float f5 = 0.0F;
        float f6 = 0.0625F;
        float f7 = 0.75F;
        float f8 = 0.8125F;
        float f9 = 0.001953125F;
        float f10 = 0.001953125F;
        float f11 = 0.7519531F;
        float f12 = 0.7519531F;
        float f13 = 0.0F;
        float f14 = 0.0625F;

        for (int i1 = 0; i1 < inta / 16; ++i1) {
            for (int j1 = 0; j1 < intb / 16; ++j1){
                float f15 = f + (float)((i1 + 1) * 16);
                float f16 = f + (float)(i1 * 16);
                float f17 = f1 + (float)((j1 + 1) * 16);
                float f18 = f1 + (float)(j1 * 16);
                this.funcb(entity1, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
                float f19 = (float)(0 + inta - i1 * 16) / 256.0F;
                float f20 = (float)(0 + inta - (i1 + 1) * 16) / 256.0F;
                float f21 = (float)(0 + intb - j1 * 16) / 256.0F;
                float f22 = (float)(0 + intb - (j1 + 1) * 16) / 256.0F;
                Tessellator t = Tessellator.instance;
                
                t.startDrawingQuads();
                t.setNormal(0.0F, 0.0F, 1.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
                t.setNormal(0.0F, 1.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
                t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
                t.setNormal(0.0F, -1.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
                t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
                t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
                t.setNormal(-1.0F, 0.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
                t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
                t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
                t.setNormal(1.0F, 0.0F, 0.0F);
                t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
                t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
                t.draw();
          }
        }
     }
    private void funcb(PapPapEntity entity1, float flot1, float flot2){
        int i = MathHelper.floor_double(entity1.posX);
        int j = MathHelper.floor_double(entity1.posY + (double)(flot2 / 16.0F));
        int k = MathHelper.floor_double(entity1.posZ);

        if (entity1.hangingDirection == 2)
        {
            i = MathHelper.floor_double(entity1.posX + (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 1)
        {
            k = MathHelper.floor_double(entity1.posZ - (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 0)
        {
            i = MathHelper.floor_double(entity1.posX - (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 3)
        {
            k = MathHelper.floor_double(entity1.posZ + (double)(flot1 / 16.0F));
        }

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
        int i1 = l % 65536;
        int j1 = l / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }
    @Override
    protected ResourceLocation getEntityTexture(Entity entity)
    {
        return this.getEntityTexture((PapPapEntity)entity);
    }

public void doRender(Entity entity2, double douba, double doubb, double doubc, float flota, float flotb){
	renderThePainting((PapPapEntity)entity2, douba, doubb, doubc, flota, flotb);
}

    

}

 

 

Item Registration:

 

public static void initializeItem(){
PapPap = new PapPapHanging(PapPapEntity.class).setCreativeTab(TigerCreativeTabs.tabItems).setUnlocalizedName("PapPap").setTextureName(RefStrings.MODID + ":ppap")
}
public static void registerItem(){
GameRegistry.registerItem(PapPap, PapPap.getUnlocalizedName());
};

 

 

Entity Registration:

 

public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){
EntityRegistry.registerModEntity(PapPapEntity.class, "PapPapEntity", 216, MainRegistry.modInstance, 128, 1, true);
}

 

 

There is an anomaly when I test the code, I am not sure if it relates to why this is happening, but it will tell me that "Using missing texture, unable to load minecraft:textures/blocks/tigermodobelisk1_1.png", which I never told it to look for the texture in the minecraft directory, nor does it seem to actually affect the texture of the block, since none of them have a missing texture and are all correct, could there be something that I set up wrong in the main that would cause the mod to look in minecraft: first before my mod and that causes the painting to take on their png instead of mine? I'm not sure why it would since the png I told it to look for is not named like their painting png.

 

Thanks!

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

I don't see a client proxy with a (client side-only) renderer registration. You probably need something like this to bind your renderer to your entityPainting extended class:

 

    RenderingRegistry.registerEntityRenderingHandler (classAltEntityPainting.class, new classRenderAltPainting ());

 

Otherwise, MC will probably detect that it is an instance of EntityPainting and use the vanilla renderer.

 

Have you set a break point and stepped through rendering in the debugger? Do you know if your renderer was ever called?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Oops, my bad, I thought I forgot to add one of my classes

 

Client Proxy Registration:

 

public void registerRenderInformation(){
RenderingRegistry.registerEntityRenderingHandler(PapPapEntity.class, new PapPapRender());
}

 

 

You're right, when I debug using breakpoints absolutely no function is called in my rendering class when I spawn using my item. So I looked at my item class and noticed that "private PapPapEntity createPapPapEntity" at the bottom is also never called, but "public boolean onItemUse" is. So there must be some mis-coding with my item class, probably with the on item use function, although I am not too sure what :/

Although I am happy that I found a probable source of the problem! I am not sure where it is in the function, maybe someone can see what I am not? Thanks for your help!

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Hm, well I figured out why "private PapPapEntity createPapPapEntity" wasn't being called and changed the instance in itemuse to now call on "private PapPapEntity createPapPapEntity", however my render functions have yet to be called on and it seems to still be using original minecraft's render

 

Tweaked Item Class:

 

public class PapPapHanging extends Item{

private final Class hangpap;
public PapPapHanging(Class clas1) {
	super();
	this.hangpap = clas1;
}

public boolean onItemUse(ItemStack stak, EntityPlayer entplay, World world1, int int1, int int2, int int3, int int4, float flt1, float flt2, float flt3){
	if (int4 == 0){
		return false;
	}
	else if (int4 == 1){
		return false;
	}
	else{
		int i1 = Direction.facingToDirection[int4];
		PapPapEntity entitypap = this.createPapPapEntity(world1, int1, int2, int3, i1);

			if (!entplay.canPlayerEdit(int1, int2, int3, int4, stak)){
				return false;
			}
			else{
				if (entitypap != null && entitypap.onValidSurface()){
					if (!world1.isRemote){
						world1.spawnEntityInWorld(entitypap);
					}

					--stak.stackSize;
				}

				return true;
			}
	}
}

private PapPapEntity createPapPapEntity(World world2, int int5, int int6, int int7, int int8){
		return (PapPapEntity) (this.hangpap == PapPapEntity.class ? new PapPapEntity(world2, int5, int6, int7, int8) : (this.hangpap == EntityItemFrame.class ? new EntityItemFrame(world2, int5, int6, int7, int8) : null));
}

}

 

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

I don't think your proxy is being called from anywhere. Also, you don't appear to have a main mod class with the @Mod annotation, and I don't see a sided-proxy annotation anywhere either.

 

Finally, when a server spawns a hanging entity in the world, it sends a message to the client, which then uses a different constructor to make its hanging entity client-side. You should walk that process in the debugger to see if there's a gotcha in vanilla's handling of the message. It might assume that it knows all possible types of hanging entities, so it might construct a vanilla painting client-side.

 

It may turn out that you need a spawn callback to call the right constructor on the right class (implements Function<EntitySpawnMessage, Entity> ). In that case, add "implements IEntityAdditionalSpawnData" to your entity class.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

  • 3 weeks later...

Here is my main mod class:

 

@Mod(modid = RefStrings.MODID , name = RefStrings.NAME , version = RefStrings.VERSION)
public class MainRegistry {

@SidedProxy(clientSide = RefStrings.CLIENTSIDE , serverSide = RefStrings.SERVERSIDE)
public static ServerProxy proxy;

@Instance
public static MainRegistry modInstance;

@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
	TigerCreativeTabs.initialiseTabs();
	TigerBlocks.mainRegistry();
	TigerEntity.mainRegistry(); 
	TigerItems.mainRegistry();
	TigerWorld.mainRegistry();
	CraftingManager.mainRegistry();
	proxy.registerRenderInfo();
}
@EventHandler
public static void load(FMLInitializationEvent event){

}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){

}
}

 

 

And the Server Proxy is:

 

public class ServerProxy {
public void registerRenderInfo(){

}

public int addArmor(String armor){
	return 0;
}
}

 

 

Which the Client Proxy is:

 

public class ClientProxy extends ServerProxy{
public void registerRenderInfo(){
	RenderingRegistry.registerEntityRenderingHandler(EntityWrathRa.class, new RenderSnowball(TigerItems.WrathRa));
	RenderingRegistry.registerEntityRenderingHandler(PapPapEntity.class, new PapPapRender());
}
public int addArmor(String armor){
	return RenderingRegistry.addNewArmourRendererPrefix(armor);
}

}

 

 

Which I believe everything should be in order in those classes but perhaps a small error has waited until my hanging entity to display itself. I have been trying to use the call hierarchy on vanilla's render painting class to try to see what function in my classes is calling that instead of my own, my searching has turned up empty except it seems to be the rendermanager class that is initiating the vanilla render class when I use my item, however from there I cannot seem to find any trails to my classes :/

I tried implements IEntityAdditionalSpawnData however it had no effect on the issue.

Although this experience has helped me learn how to use the debugger more in detail so thank you for suggesting for me to use it in this issue. I'll keep searching the rendermanager's hierarchy and I will post if I find something, and thank you for any more suggestions you can give!

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Can you explain more about how you're using the enums? I think what you're saying is that you have a texture that is just like the vanilla and you want to pick up the same coordinates. However, I don't understand where you set the enum for your entity. And out of curiosity, which vanilla texture is it displaying?

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

Link to comment
Share on other sites

If I understand his mod, he has made a new painting texture (one big collage that contains a whole set of paintings), and he has patterned it so that his paintings occupy the same tiles within the new painting file as vanilla paintings occupy within the vanilla painting file. He hopes that all of the vanilla machinery will then pick up his paintings when he manages to get his image file used in place of the vanilla file.

 

In vanilla's entity painting code, the enum is chosen randomly (in a constructor) from among those that can fit where placed. When reloading from a save, an NBT tag gives a painting name which is then used to look up the corresponding enum (different constructor).

 

NOTE: In late 1.7.10 and early 1.8 versions, vanilla has a bug that muffs the centering during that placement.

 

I think the problem is coaxing the render manager to use the custom renderer. If the renderer is registered, then maybe vanilla has an annoying assumption built in somewhere that must be defeated. Find where vanilla decides what renderer to call.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I would suggest that if you can't figure it out you should try a different approach. Instead of extending EntityPainting you should copy it instead (ie as a class that extends EntityHanging). Then if their is any vanilla choose that is somehow doing something weird based on an instance of EntityPainting it won't trigger for your entity.

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

Link to comment
Share on other sites

I would suggest that if you can't figure it out you should try a different approach. Instead of extending EntityPainting you should copy it instead (ie as a class that extends EntityHanging). Then if their is any vanilla choose that is somehow doing something weird based on an instance of EntityPainting it won't trigger for your entity.

 

IIRC this won't work because there is a ton of code that uses instance-of checks necessary to the proper operation of paintings.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

jeffryfisher is right, I copied the vanilla painting png, replacing their paintings with my own, and used their set pixel enum template, since I rather not mess with adding more enum values before I can actually get the texture to display on my item's spawned hanging entity (currently my item's hanging entity uses the vanilla painting png). Draco18s is also right, through my many trials of trying to get this to work, one of them was to do that and just completely write out my entitypainting class and extend it to entityhanging, it opened up a whole new world of issues, mostly a java error: "don't know how to add [my entitypainting class]", but I don't think that is the solution (hopefully), so I just am going with the simplified entitypainting right now.

 

I'll keep combing through my classes and vanilla's, so far all I have found is it seems to be called by entityitemframe->renderitemframe->rendermanager, however I do not know yet if these frame classes are being called when I use my item yet, I do know from scanning the vanilla classes it seems that the frame classes are situated in the painting item class. It's frustrating to say in the least to back track in the rendermanager and use break points in there due to minecraft constantly uses all of the rendermanager functions for camera positions so they are called every frame.

 

EDIT: EntityItemFrame and RenderItemFrame seem to be constantly called, I don't think they are what I originally thought they were

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Okay, I think I might know what is going wrong. You're registering the renderers in the preinit phase, but I always do it in the init phase. I suspect that it is not getting registered, and an interesting thing is that if you look at the getEntityClassRenderObject() method in the RenderManager, if it doesn't find an entry it will use the entry for the super-class. Since your class extends EntityPainting, its renderer would be called.

 

If you want to know whether to use pre-init or init or post-init for something you can look through the startGame() method in the Minecraft class. If you check it out, you'll see that the entityRenderer isn't created at the time of pre-init, and is created just a bit before the init event.

 

Anyway, try moving the registration to the init and see if you have the same problem.

 

Also, another thing to look at -- I don't see you actually registering the mod entity. I see you registering the renderer for the entity, but where do you register the entity itself? Maybe entities like this type don't need to be registered, but I'd double check.

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

Link to comment
Share on other sites

Like this?

 

@Mod(modid = RefStrings.MODID , name = RefStrings.NAME , version = RefStrings.VERSION)
public class MainRegistry {

@SidedProxy(clientSide = RefStrings.CLIENTSIDE , serverSide = RefStrings.SERVERSIDE)
public static ServerProxy proxy;

@Instance
public static MainRegistry modInstance;

@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
	TigerCreativeTabs.initialiseTabs();
	TigerBlocks.mainRegistry();
	TigerEntity.mainRegistry(); 
	TigerItems.mainRegistry();
	TigerWorld.mainRegistry();
	CraftingManager.mainRegistry();
}
@EventHandler
public static void load(FMLInitializationEvent event){
	proxy.registerRenderInfo();
}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){

}
}

 

 

Unfortunately it didn't seem to work, but maybe I misunderstood which one to put in the init :/

I thought i registered the entity in my TigerEntity class, which you can look at in my first post, I don't think I am missing any entity registrations, just need that one line i think, I tried putting the entity registrations in the init too, but that also had no affect

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Yeah, that is what I meant. I'm quite sure that you need the rendering registering to happen in the init phase, so I think it is good you moved it.

 

Entity registering should happen in the pre-init phase. You're now talking about TigerEntity but in your previous posts it was something called PapPapEntity. In your first post you show some code for a createEntity() method that does the registering, but it is not clear to me where you're calling that from.

 

Anyway, there is another thing I'm a bit concerned with. You have a @Instance annotation without giving the mod id. I usually use @Instance(MODID) where MODID is constant containing my mod id string. I'm not sure what happens if you leave it blank. The default is is "" so perhaps your instance field is not being set properly which might be screwing up your registration?  Just a wild idea really...but worth a try.

 

 

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

Link to comment
Share on other sites

I thought about what you said, and I concluded that just how I setup TigerEntity is probably causing the entity to not be called on or registered, so I abandoned my OCD style of clean calling and decided to register it right in my main class, at least for now, and something interesting happened. So now when I use my item the game crashes, BUT, it is an error dealing with MY render class, so now it is being called! Now I just need to find why there is a null pointer in my class.

 

Here is the modified main:

 

@Mod(modid = RefStrings.MODID , name = RefStrings.NAME , version = RefStrings.VERSION)
public class MainRegistry {

@SidedProxy(clientSide = RefStrings.CLIENTSIDE , serverSide = RefStrings.SERVERSIDE)
public static ServerProxy proxy;

@Instance(RefStrings.MODID)
public static MainRegistry modInstance;

@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
	TigerCreativeTabs.initialiseTabs();
	TigerBlocks.mainRegistry();
	TigerEntity.mainRegistry();
	registerEntities();
	TigerItems.mainRegistry();
	TigerWorld.mainRegistry();
	CraftingManager.mainRegistry();

}
private static void registerEntities(){
    EntityRegistry.registerGlobalEntityID(PapPapEntity.class, "PapPapEntity", EntityRegistry.findGlobalUniqueEntityId());
    EntityRegistry.registerModEntity(PapPapEntity.class, "PapPapEntity", 113, MainRegistry.modInstance, 128, 1, true);
    
}
@EventHandler
public static void load(FMLInitializationEvent event){
            proxy.registerRenderInfo();
}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){

}
}

 

 

Here is my render class again for easier access:

 

@SideOnly(Side.CLIENT)
public class PapPapRender extends Render{

protected static final ResourceLocation textur = new ResourceLocation(RefStrings.MODID + ":textures/painting/egypt.png");


public void renderThePainting(PapPapEntity ent, double douba, double doubb, double doubc, float flota, float flotb){
    	GL11.glPushMatrix();
        GL11.glTranslated(douba, doubb, doubc);
        GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        this.bindEntityTexture(ent);
        PapPapEntity.EnumArt enumart = ent.art;
        float f2 = 0.0625F;
        GL11.glScalef(f2, f2, f2);
        this.funca(ent, enumart.sizeX, enumart.sizeY);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
    
    protected ResourceLocation getEntityTexture(PapPapEntity entity){
	return textur;
}



    private void funca(PapPapEntity entity1, int inta, int intb){
    	float f = (float)(-inta) / 2.0F;
        float f1 = (float)(-intb) / 2.0F;
        float f2 = 0.5F;
        float f3 = 0.75F;
        float f4 = 0.8125F;
        float f5 = 0.0F;
        float f6 = 0.0625F;
        float f7 = 0.75F;
        float f8 = 0.8125F;
        float f9 = 0.001953125F;
        float f10 = 0.001953125F;
        float f11 = 0.7519531F;
        float f12 = 0.7519531F;
        float f13 = 0.0F;
        float f14 = 0.0625F;

        for (int i1 = 0; i1 < inta / 16; ++i1) {
            for (int j1 = 0; j1 < intb / 16; ++j1){
                float f15 = f + (float)((i1 + 1) * 16);
                float f16 = f + (float)(i1 * 16);
                float f17 = f1 + (float)((j1 + 1) * 16);
                float f18 = f1 + (float)(j1 * 16);
                this.funcb(entity1, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
                float f19 = (float)(0 + inta - i1 * 16) / 256.0F;
                float f20 = (float)(0 + inta - (i1 + 1) * 16) / 256.0F;
                float f21 = (float)(0 + intb - j1 * 16) / 256.0F;
                float f22 = (float)(0 + intb - (j1 + 1) * 16) / 256.0F;
                Tessellator t = Tessellator.instance;
                
                t.startDrawingQuads();
                t.setNormal(0.0F, 0.0F, 1.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
                t.setNormal(0.0F, 1.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
                t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
                t.setNormal(0.0F, -1.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
                t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
                t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
                t.setNormal(-1.0F, 0.0F, 0.0F);
                t.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
                t.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
                t.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
                t.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
                t.setNormal(1.0F, 0.0F, 0.0F);
                t.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
                t.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
                t.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
                t.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
                t.draw();
          }
        }
     }
    private void funcb(PapPapEntity entity1, float flot1, float flot2){
        int i = MathHelper.floor_double(entity1.posX);
        int j = MathHelper.floor_double(entity1.posY + (double)(flot2 / 16.0F));
        int k = MathHelper.floor_double(entity1.posZ);

        if (entity1.hangingDirection == 2)
        {
            i = MathHelper.floor_double(entity1.posX + (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 1)
        {
            k = MathHelper.floor_double(entity1.posZ - (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 0)
        {
            i = MathHelper.floor_double(entity1.posX - (double)(flot1 / 16.0F));
        }

        if (entity1.hangingDirection == 3)
        {
            k = MathHelper.floor_double(entity1.posZ + (double)(flot1 / 16.0F));
        }

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
        int i1 = l % 65536;
        int j1 = l / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }
    @Override
    protected ResourceLocation getEntityTexture(Entity entity)
    {
        return this.getEntityTexture((PapPapEntity)entity);
    }

public void doRender(Entity ent, double douba, double doubb, double doubc, float flota, float flotb){
	renderThePainting((PapPapEntity)ent, douba, doubb, doubc, flota, flotb);
}
}

 

 

And my lovely little error (and a little bit of log to have more reference):

 

[15:57:50] [server thread/INFO] [FML]: Applying holder lookups
[15:57:50] [server thread/INFO] [FML]: Holder lookups applied
[15:57:50] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Rendering entity in world
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:346) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:278) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:251) ~[RenderManager.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:527) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at com.tiger.entitiy.PapPapRender.renderThePainting(PapPapRender.java:34) ~[PapPapRender.class:?]
at com.tiger.entitiy.PapPapRender.doRender(PapPapRender.java:143) ~[PapPapRender.class:?]
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300) ~[RenderManager.class:?]
... 16 more
[15:57:50] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// On the bright side, I bought you a teddy bear!

Time: 12/8/15 3:57 PM
Description: Rendering entity in world

java.lang.NullPointerException: Rendering entity in world
at com.tiger.entitiy.PapPapRender.renderThePainting(PapPapRender.java:34)
at com.tiger.entitiy.PapPapRender.doRender(PapPapRender.java:143)
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:278)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:251)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:527)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at com.tiger.entitiy.PapPapRender.renderThePainting(PapPapRender.java:34)
at com.tiger.entitiy.PapPapRender.doRender(PapPapRender.java:143)

-- Entity being rendered --
Details:
Entity Type: PapPapEntity (com.tiger.entitiy.PapPapEntity)
Entity ID: 3456
Entity Name: entity.PapPapEntity.name
Entity's Exact location: 231.50, 77.00, 227.06
Entity's Block location: World: (231,77,227), Chunk: (at 7,4,3 in 14,14; contains blocks 224,0,224 to 239,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Entity's Momentum: 0.00, 0.00, 0.00

-- Renderer details --
Details:
Assigned renderer: com.tiger.entitiy.PapPapRender@7e822c11
Location: -0.59,1.38,-1.55 - World: (-1,1,-2), Chunk: (at 15,0,14 in -1,-1; contains blocks -16,0,-16 to -1,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Rotation: -180.0
Delta: 0.0064231157
Stacktrace:
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:278)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:251)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:527)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player305'/2278, l='MpServer', x=232.09, y=75.62, z=228.62]]
Chunk stats: MultiplayerChunkCache: 555, 555
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (228,64,252), Chunk: (at 4,4,12 in 14,15; contains blocks 224,0,240 to 239,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 1191 game time, 1191 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 91 total; [EntityZombie['Zombie'/3077, l='MpServer', x=273.50, y=19.00, z=239.50], EntitySkeleton['Skeleton'/2823, l='MpServer', x=157.50, y=18.00, z=294.50], EntitySkeleton['Skeleton'/2831, l='MpServer', x=199.50, y=36.00, z=269.50], EntitySpider['Spider'/3088, l='MpServer', x=277.50, y=51.00, z=310.50], EntitySkeleton['Skeleton'/2835, l='MpServer', x=289.50, y=38.00, z=300.50], EntitySkeleton['Skeleton'/2836, l='MpServer', x=289.50, y=38.00, z=299.50], EntitySkeleton['Skeleton'/2837, l='MpServer', x=288.50, y=38.00, z=299.50], EntityBat['Bat'/2327, l='MpServer', x=253.75, y=23.05, z=245.70], EntityWitch['Witch'/3095, l='MpServer', x=287.50, y=38.00, z=289.50], EntityBat['Bat'/2329, l='MpServer', x=224.52, y=20.00, z=244.75], EntitySpider['Spider'/3098, l='MpServer', x=297.44, y=38.00, z=295.44], EntityBat['Bat'/2333, l='MpServer', x=225.25, y=21.10, z=237.25], EntityBat['Bat'/2334, l='MpServer', x=225.39, y=20.29, z=237.25], EntityBat['Bat'/2335, l='MpServer', x=225.11, y=20.00, z=246.46], EntityBat['Bat'/2337, l='MpServer', x=220.67, y=21.00, z=260.63], EntitySkeleton['Skeleton'/3362, l='MpServer', x=259.69, y=37.00, z=279.03], EntitySpider['Spider'/3107, l='MpServer', x=234.50, y=16.00, z=191.50], EntityZombie['Zombie'/3116, l='MpServer', x=164.50, y=25.00, z=220.50], EntityZombie['Zombie'/3384, l='MpServer', x=210.50, y=15.00, z=299.50], EntityZombie['Zombie'/3398, l='MpServer', x=270.50, y=50.00, z=279.50], EntityZombie['Zombie'/3399, l='MpServer', x=244.50, y=14.00, z=228.50], EntitySkeleton['Skeleton'/3156, l='MpServer', x=245.50, y=12.00, z=241.50], EntitySkeleton['Skeleton'/3157, l='MpServer', x=245.50, y=12.00, z=240.50], EntityCreeper['Creeper'/3414, l='MpServer', x=156.71, y=18.02, z=305.43], EntitySkeleton['Skeleton'/2651, l='MpServer', x=159.50, y=25.00, z=232.50], EntityPig['Pig'/2153, l='MpServer', x=157.06, y=67.00, z=242.97], EntityPig['Pig'/2154, l='MpServer', x=163.09, y=68.00, z=237.75], EntityPig['Pig'/2155, l='MpServer', x=162.50, y=68.00, z=239.50], EntityPig['Pig'/2156, l='MpServer', x=164.78, y=68.00, z=241.16], EntityPig['Pig'/2157, l='MpServer', x=160.78, y=67.00, z=243.81], EntityZombie['Zombie'/2925, l='MpServer', x=186.34, y=42.00, z=266.34], EntityZombie['Zombie'/2926, l='MpServer', x=185.88, y=41.00, z=268.41], EntityPig['Pig'/2162, l='MpServer', x=176.50, y=70.00, z=238.22], EntityPig['Pig'/2163, l='MpServer', x=179.81, y=70.00, z=239.59], EntityPig['Pig'/2164, l='MpServer', x=176.50, y=70.00, z=240.97], EntityPig['Pig'/2169, l='MpServer', x=196.06, y=75.00, z=222.50], EntityPig['Pig'/2170, l='MpServer', x=198.53, y=75.00, z=222.50], EntityPig['Pig'/2171, l='MpServer', x=197.41, y=75.00, z=222.50], EntityPig['Pig'/2172, l='MpServer', x=189.03, y=72.00, z=230.59], EntityCreeper['Creeper'/2431, l='MpServer', x=275.50, y=27.00, z=246.50], EntityZombie['Zombie'/2432, l='MpServer', x=273.31, y=20.00, z=246.22], PapPapEntity['entity.PapPapEntity.name'/3456, l='MpServer', x=231.50, y=77.00, z=227.06], EntityCreeper['Creeper'/2434, l='MpServer', x=293.50, y=20.00, z=303.50], EntityZombie['Zombie'/3205, l='MpServer', x=300.50, y=42.00, z=309.50], EntitySkeleton['Skeleton'/3206, l='MpServer', x=214.50, y=28.00, z=188.50], EntityPig['Pig'/2197, l='MpServer', x=269.53, y=71.00, z=153.09], EntityPig['Pig'/2199, l='MpServer', x=259.09, y=75.00, z=161.13], EntityChicken['Chicken'/2200, l='MpServer', x=279.44, y=72.00, z=244.47], EntityWitch['Witch'/3224, l='MpServer', x=155.50, y=12.00, z=245.50], EntityChicken['Chicken'/2201, l='MpServer', x=260.27, y=71.00, z=244.21], EntityPig['Pig'/2202, l='MpServer', x=265.50, y=71.00, z=258.50], EntityWitch['Witch'/3226, l='MpServer', x=156.50, y=12.00, z=245.50], EntityPig['Pig'/2203, l='MpServer', x=269.50, y=71.00, z=261.50], EntityPig['Pig'/2204, l='MpServer', x=268.44, y=71.00, z=155.78], EntityChicken['Chicken'/2205, l='MpServer', x=274.69, y=72.00, z=248.09], EntitySheep['Sheep'/2206, l='MpServer', x=279.50, y=72.00, z=247.50], EntitySheep['Sheep'/2207, l='MpServer', x=276.09, y=72.00, z=247.50], EntitySheep['Sheep'/2208, l='MpServer', x=273.63, y=72.00, z=247.84], EntitySheep['Sheep'/2209, l='MpServer', x=274.13, y=72.00, z=243.66], EntityChicken['Chicken'/2210, l='MpServer', x=268.66, y=72.00, z=247.47], EntityPig['Pig'/2211, l='MpServer', x=273.50, y=69.00, z=260.50], EntityPig['Pig'/2212, l='MpServer', x=274.81, y=68.00, z=265.19], EntityPig['Pig'/2213, l='MpServer', x=284.13, y=67.00, z=270.09], EntityPig['Pig'/2214, l='MpServer', x=283.50, y=66.00, z=268.50], EntityPig['Pig'/2215, l='MpServer', x=292.09, y=70.00, z=266.06], EntitySkeleton['Skeleton'/2983, l='MpServer', x=196.69, y=37.00, z=271.25], EntityPig['Pig'/2216, l='MpServer', x=274.47, y=67.00, z=269.66], EntityPig['Pig'/2217, l='MpServer', x=290.09, y=67.00, z=214.09], EntityPig['Pig'/2218, l='MpServer', x=293.81, y=67.00, z=211.44], EntityPig['Pig'/2219, l='MpServer', x=294.72, y=67.00, z=209.13], EntityPig['Pig'/2220, l='MpServer', x=291.03, y=68.00, z=216.16], EntityPig['Pig'/2221, l='MpServer', x=296.97, y=68.00, z=233.06], EntityCreeper['Creeper'/2478, l='MpServer', x=230.50, y=31.00, z=255.50], EntityPig['Pig'/2225, l='MpServer', x=308.19, y=66.00, z=234.88], EntityPig['Pig'/2226, l='MpServer', x=306.50, y=66.00, z=225.50], EntityPig['Pig'/2227, l='MpServer', x=306.50, y=66.00, z=225.50], EntityZombie['Zombie'/2996, l='MpServer', x=240.50, y=29.00, z=232.50], EntityZombie['Zombie'/2997, l='MpServer', x=240.50, y=29.00, z=230.50], EntityZombie['Zombie'/2998, l='MpServer', x=244.50, y=29.00, z=232.94], EntityBat['Bat'/2491, l='MpServer', x=181.75, y=20.80, z=213.75], EntityCreeper['Creeper'/2747, l='MpServer', x=265.50, y=19.00, z=163.50], EntityBat['Bat'/2496, l='MpServer', x=172.57, y=33.48, z=174.46], EntityEnderman['Enderman'/3008, l='MpServer', x=269.50, y=35.00, z=238.50], EntitySkeleton['Skeleton'/2757, l='MpServer', x=308.04, y=37.00, z=303.56], EntityZombie['Zombie'/2507, l='MpServer', x=231.50, y=38.00, z=279.50], EntityZombie['Zombie'/2508, l='MpServer', x=228.47, y=36.00, z=280.97], EntityZombie['Zombie'/3293, l='MpServer', x=167.50, y=55.00, z=155.50], EntityZombie['Zombie'/2785, l='MpServer', x=272.50, y=37.00, z=268.50], EntityCreeper['Creeper'/2787, l='MpServer', x=268.50, y=37.00, z=261.50], EntityZombie['Zombie'/2789, l='MpServer', x=235.50, y=18.00, z=296.50], EntityClientPlayerMP['Player305'/2278, l='MpServer', x=232.09, y=75.62, z=228.62]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)
at net.minecraft.client.Minecraft.run(Minecraft.java:973)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

 

The first line it is talking about is this.funca(ent, enumart.sizeX, enumart.sizeY);

and the second is the renderThePainting((PapPapEntity)ent, douba, doubb, doubc, flota, flotb); at the bottom

 

I'm getting close! I can feel it! Thank you so much for your help so far!

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Hm, I looked at my classes the last two days to see what is making my entity null, however I am not sure what the culprit is here, nulls have always been my bane in programming. Can someone explain what is nulling the entity to me?

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

Hm, I looked at my classes the last two days to see what is making my entity null, however I am not sure what the culprit is here, nulls have always been my bane in programming. Can someone explain what is nulling the entity to me?

 

You need to learn to use the debugging mode in Eclipse. You can create breakpoints to stop the execution, or step slowly through the code and give you time to examine the value of the fields. You can then work backwards to understand why a certain value happened. In this case you want to know why it is null. You must expect the value to be set somewhere, so you should set a breakpoint just after the code you think is supposed to set the value and set another breakpoint just before the null pointer exception. If your first breakpoint doesn't happen before the second breakpoint, then it confirms that the value isn't getting set. You can then step through and figure out why.

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

Link to comment
Share on other sites

I knew about breakpoints, but I didn't know you can use them to see what variables are each step! That's really useful, thank you for telling me about that. So I did that and found out that in "this.funca(ent, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);" That ent is just the globaluniqueID, while the sizeX, sizeY, offsetX, and offsetY are given randomly one of the fittable enum painting coordinates. However enumart is null, so I looked back to "PapPapEntity.EnumArt enumart = ent.art;" ent is still just the ID, however art seems to be null, then I looked in the vanilla EntityPainting class because that is where it designates these values and observed that at first few steps, art =  the ID of the random painting selected, but then randomly becomes null before put into my renderer. I tested using just manual coordinates in place of the enumart.sizeX and so on and the coordinated painting I put in actually rendered! However it moved up .5 blocks randomly but I am not really concerned about that considering it might just be a glitch by manually putting numbers in place of the variables. I find this strange because it is using solely the vanilla classes in creating the enum values, yet I recieve a null. I am now focusing on my PapPapEntity class, since that is where it is directing the render to get the enum values from EntityPainting. Plus trying to pinpoint why art suddenly nulls, unless it's supposed to do that, but I doubt it. I'll update if I find anything else.

 

I updated the code in my render class if any of you care to see it:

 

@SideOnly(Side.CLIENT)
public class PapPapRender extends Render{

@Override
protected ResourceLocation getEntityTexture(Entity textur) {
	return new ResourceLocation(RefStrings.MODID + ":textures/painting/egypt.png");
}

public void doRender(EntityPainting ent, double doub1, double doub2, double doub3, float flo1, float flo2){
	GL11.glPushMatrix();
	GL11.glTranslated(doub1, doub2, doub3);
	GL11.glRotatef(flo1, 0.0F, 1.0F, 0.0F);
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	this.bindEntityTexture(ent);
	PapPapEntity.EnumArt enumart = ent.art;
	float f2 = 0.0625F;
	GL11.glScalef(f2, f2, f2);
	this.funca(ent, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);
	GL11.glDisable(GL12.GL_RESCALE_NORMAL);
	GL11.glPopMatrix();
}

private void funca(EntityPainting entit, int sizeX, int sizeY, int offX, int offY){
	float f = (float)(-sizeX) / 2.0F;
	float f1 = (float)(-sizeY) / 2.0F;
	float f2 = 0.5F;
	float f3 = 0.75F;
	float f4 = 0.8125F;
	float f5 = 0.0F;
	float f6 = 0.0625F;
	float f7 = 0.75F;
	float f8 = 0.8125F;
	float f9 = 0.001953125F;
	float f10 = 0.001953125F;
	float f11 = 0.7519531F;
	float f12 = 0.7519531F;
	float f13 = 0.0F;
	float f14 = 0.0625F;

	for (int i1 = 0; i1 < sizeX / 16; ++i1){
		for (int j1 = 0; j1 < sizeY / 16; ++j1){
			float f15 = f + (float)((i1 + 1) * 16);
			float f16 = f + (float)(i1 * 16);
			float f17 = f1 + (float)((j1 + 1) * 16);
			float f18 = f1 + (float)(j1 * 16);
			this.funb(entit, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
			float f19 = (float)(offX + sizeX - i1 * 16) / 256.0F;
			float f20 = (float)(offX + sizeX - (i1 + 1) * 16) / 256.0F;
			float f21 = (float)(offY + sizeY - j1 * 16) / 256.0F;
			float f22 = (float)(offY + sizeY - (j1 + 1) * 16) / 256.0F;
			Tessellator tessellator = Tessellator.instance;
			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, 0.0F, -1.0F);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);
			tessellator.setNormal(0.0F, 0.0F, 1.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
			tessellator.setNormal(0.0F, 1.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
			tessellator.setNormal(0.0F, -1.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
			tessellator.setNormal(-1.0F, 0.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
			tessellator.setNormal(1.0F, 0.0F, 0.0F);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
			tessellator.draw();
		}
	}
}

private void funb(EntityPainting entit2, float floa, float flob){
	int i = MathHelper.floor_double(entit2.posX);
	int j = MathHelper.floor_double(entit2.posY + (double)(flob / 16.0F));
	int k = MathHelper.floor_double(entit2.posZ);

	if (entit2.hangingDirection == 2){
		i = MathHelper.floor_double(entit2.posX + (double)(floa / 16.0F));
	}

	if (entit2.hangingDirection == 1){
		k = MathHelper.floor_double(entit2.posZ - (double)(floa / 16.0F));
	}

	if (entit2.hangingDirection == 0){
		i = MathHelper.floor_double(entit2.posX - (double)(floa / 16.0F));
	}

	if (entit2.hangingDirection == 3){
		k = MathHelper.floor_double(entit2.posZ + (double)(floa / 16.0F));
	}

	int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
	int i1 = l % 65536;
	int j1 = l / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
	GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
public void doRender(Entity ent, double doub1, double doub2, double doub3, float flo1, float flo2){
	this.doRender((PapPapEntity)ent, doub1, doub2, doub3, flo1, flo2);
}
}

 

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Link to comment
Share on other sites

art =  the ID of the random painting selected, but then randomly becomes null before put into my renderer.

It's doubtful that it is happening randomly. Keep tracing the execution in the debugger.

 

Watch out for (virtual) client - server communication issues. You may well see a correct enum on the server but get a null (or even vanilla painting) on client-side. That would point to an issue with message-handling or the constructor called on the client side in response to it (not the same constructor that chooses the random enum).

 

Home in on EntityPainting's client-side constructor and see what's happening in it and down-stream to the renderer.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I see what you mean! It took me a few days but when I realized that I can do a compare contrast by spawning a vanilla painting and see what it does in entitypainting then spawn my own and see what the difference is, the vanilla painting uses the entitypainting client-side constructor:

 

@SideOnly(Side.CLIENT)
    public EntityPainting(World p_i1601_1_, int p_i1601_2_, int p_i1601_3_, int p_i1601_4_, int p_i1601_5_, String p_i1601_6_)
    {
        this(p_i1601_1_, p_i1601_2_, p_i1601_3_, p_i1601_4_, p_i1601_5_);
        EntityPainting.EnumArt[] aenumart = EntityPainting.EnumArt.values();
        int i1 = aenumart.length;

        for (int j1 = 0; j1 < i1; ++j1)
        {
            EntityPainting.EnumArt enumart = aenumart[j1];

            if (enumart.title.equals(p_i1601_6_))
            {
                this.art = enumart;
                break;
            }
        }

        this.setDirection(p_i1601_5_);
    }

 

however my painting does not, there's the reason art is null, so now I am scanning what is causing vanilla painting to call into that and not mine, I'll keep you all updated if I find anything.

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.   Kesimpulan OLXTOTO adalah situs slot gacor terbaik yang memberikan pengalaman bermain judi slot online yang tak terlupakan. Dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering, OLXTOTO menjadi pilihan terbaik bagi para pemain yang mencari kesenangan dan kemenangan besar dalam perjudian online. Di samping itu, OLXTOTO juga menawarkan layanan pelanggan yang ramah dan responsif, siap membantu setiap pemain dalam mengatasi masalah teknis atau pertanyaan seputar perjudian online. Kami menjaga integritas game dan memberikan lingkungan bermain yang adil serta menjalankan kebijakan perlindungan pelanggan yang cermat. Bergabunglah dengan OLXTOTO sekarang dan nikmati pengalaman bermain slot online yang luar biasa. Jadilah bagian dari komunitas perjudian yang mengagumkan ini dan raih kesempatan untuk meraih kemenangan besar. Dapatkan akses mudah dan praktis ke situs OLXTOTO dan rasakan sensasi bermain judi slot yang tak terlupakan.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa Di dunia perjudian online yang begitu kompetitif, mencari platform yang dapat memberikan kemenangan maksimal (Maxwin) dan hasil terbaik (Gacor) adalah prioritas bagi para penjudi yang cerdas. Dalam upaya ini, OLXTOTO telah muncul sebagai pemain kunci yang mengubah lanskap perjudian online dengan menawarkan pengalaman tanpa tandingan.     Sejak diluncurkan, OLXTOTO telah menjadi sorotan industri perjudian online. Dikenal sebagai "Platform Maxwin dan Gacor Terbesar Sepanjang Masa", OLXTOTO telah menarik perhatian pemain dari seluruh dunia dengan reputasinya yang solid dan kinerja yang luar biasa. Salah satu fitur utama yang membedakan OLXTOTO dari pesaingnya adalah komitmen mereka untuk memberikan pengalaman berjudi yang unik dan memuaskan. Dengan koleksi game yang luas dan beragam, termasuk togel, slot online, live casino, dan banyak lagi, OLXTOTO menawarkan sesuatu untuk semua orang. Dibangun dengan teknologi terkini dan didukung oleh tim ahli yang berdedikasi, platform ini memastikan bahwa setiap pengalaman berjudi di OLXTOTO tidak hanya menghibur, tetapi juga menguntungkan. Namun, keunggulan OLXTOTO tidak hanya terletak pada permainan yang mereka tawarkan. Mereka juga terkenal karena keamanan dan keadilan yang mereka berikan kepada para pemain mereka. Dengan sistem keamanan tingkat tinggi dan audit rutin yang dilakukan oleh otoritas regulasi independen, para pemain dapat yakin bahwa setiap putaran permainan di OLXTOTO adalah adil dan transparan. Tidak hanya itu, OLXTOTO juga dikenal karena layanan pelanggan yang luar biasa. Dengan tim dukungan yang ramah dan responsif, para pemain dapat yakin bahwa setiap pertanyaan atau masalah mereka akan ditangani dengan cepat dan efisien. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi platform pilihan bagi para penjudi online yang mencari kemenangan maksimal dan hasil terbaik. Jadi, jika Anda ingin bergabung dengan jutaan pemain yang telah merasakan keajaiban OLXTOTO, jangan ragu untuk mendaftar dan mulai bermain hari ini!  
    • OLXTOTO adalah bandar slot yang terkenal dan terpercaya di Indonesia. Mereka menawarkan berbagai jenis permainan slot yang menarik dan menghibur. Dengan tampilan yang menarik dan grafis yang berkualitas tinggi, pemain akan merasa seperti berada di kasino sungguhan. OLXTOTO juga menyediakan layanan pelanggan yang ramah dan responsif, siap membantu pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Daftar =  https://surkale.me/Olxtotodotcom1
    • DAFTAR & LOGIN BIGO4D   Bigo4D adalah situs slot online yang populer dan menarik perhatian banyak pemain slot di Indonesia. Dengan berbagai game slot yang unik dan menarik, Bigo4D menjadi tempat yang ideal untuk pemula dan pahlawan slot yang berpengalaman. Dalam artikel ini, kami akan membahas tentang Bigo4D sebagai situs slot terbesar dan menarik yang saat ini banyak dijajaki oleh pemain slot online.
  • Topics

×
×
  • Create New...

Important Information

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