Jump to content

[1.7.10] [Not Resolved] Entity Rendering Not Working.


Recommended Posts

Posted

So I've made an entity, but the problem is when I spawn it with a spawn egg it doesn't render. Here is my code:

 

 

  Reveal hidden contents

 

Posted

Are you calling the method which holds

RenderingRegistry.registerEntityRenderingHandler(ArcanePowerMatrix.class, new RenderPowerMatrix(new ModelPowerMatrix(), 0F));

in your main class?

Posted
  On 12/4/2014 at 12:50 PM, Lewie said:

Are you calling the method which holds

RenderingRegistry.registerEntityRenderingHandler(ArcanePowerMatrix.class, new RenderPowerMatrix(new ModelPowerMatrix(), 0F));

in your main class?

 

  Quote

No, I'm calling it in my ClientProxy.

 

Oh sorry, I was tired when I read that, yes I'm calling that method in my main class (not ClientProxy, that wouldn't have worked, sorry for the miss-understanding).

Posted
  On 12/5/2014 at 4:47 AM, Awesome_Spider said:

Well... I guess some people are as stumped as me. :/

 

Does the game crash when you try (Post Error)? Or does it just not render at all?

Posted
  On 12/5/2014 at 6:08 AM, david476 said:

Add an println to the onUpdate method to make sure it is spawning right (make sure to call super!). Can we see spawning code?

 

What onUpdate method? I try to add that. Also I don't have spawning code, I just register the entity and it does that on it's own.

 

  Quote

  Quote

Well... I guess some people are as stumped as me. :/

 

Does the game crash when you try (Post Error)? Or does it just not render at all?

 

It just doesn't render at all, either that or it doesn't spawn.

Posted

Now that I look at it, it gives me this in the console when I use the spawn egg:

[17:26:14] [server thread/WARN]: Skipping Entity with id 7
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.reflect.InvocationTargetException
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:221)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:173)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:79)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:456)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:142)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:422)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: Caused by: java.lang.NullPointerException
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.DataWatcher.updateObject(DataWatcher.java:153)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityLivingBase.setHealth(EntityLivingBase.java:812)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:157)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.entity.EntityLiving.<init>(EntityLiving.java:78)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at com.awsp8.wizardry.Entities.ArcanePowerMatrix.<init>(ArcanePowerMatrix.java:13)
[17:26:19] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	... 20 more

 

Weird a NullPointerException at the end, easy to fix. But it says it can't find the health info, even EASIER to fix :) well i'll try to fix it then. If I don't i'll reply again.

Posted
  On 12/6/2014 at 12:40 AM, diesieben07 said:

You need to call super.entityInit in your overridden method.

 

Still not working. :/

Posted

The onUpdate method is called each tick (look at Entity class). The println was to check it was spawning correctly, you might want to make it print (this.worldObj.isRemote + ", " + this) to see the entity and which world it is in. Give us what that outputs and updated code when you implement it.

Posted
  On 12/6/2014 at 4:24 AM, david476 said:

The onUpdate method is called each tick (look at Entity class). The println was to check it was spawning correctly, you might want to make it print (this.worldObj.isRemote + ", " + this) to see the entity and which world it is in. Give us what that outputs and updated code when you implement it.

 

I place this code (this is how I debug):

Wizardry.log.debug(this.worldObj.isRemote + ", " + this);

 

where you advised me to put it and it printed absolutely nothing when I spawned the entity. Thoughts? :)

Posted

Well here is the updated code:

 

package com.awsp8.wizardry.Entities;

import com.awsp8.wizardry.Wizardry;

import sun.misc.SharedSecrets;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class ArcanePowerMatrix 
			extends EntityLiving{



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

@Override
public void entityInit(){
	super.entityInit();
}

@Override
public void onUpdate(){
	super.onUpdate();

	Wizardry.log.debug(this.worldObj.isRemote + ", " + this);
}

@Override
public void applyEntityAttributes(){
        super.applyEntityAttributes();
    }

@Override
public boolean canDespawn(){
	return false;
}

@Override
public boolean canBePushed(){
	return false;
}
}

 

And I have noticed that the exception is gone, but it still doesn't spawn. Now I'm actually not sure now whether it's a rendering problem or a spawning problem (considering it doesn't print anything).

Posted

I use this method to create a spawn egg for it:

public void registerEntity(Class<? extends Entity> entityClass, String entityName, int bkEggColor, int fgEggColor) {
    	int id = EntityRegistry.findGlobalUniqueEntityId();
    	EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
    	EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, bkEggColor, fgEggColor));
    }

 

But I don't understand why it's not working because all my other entities spawn ok, but this one doesn't spawn. I have no idea why, they are all registered the same way.

Posted
  On 12/6/2014 at 6:55 PM, diesieben07 said:

How many entities do you have?

 

Five, counting the one that isn't working.

Posted
  On 12/6/2014 at 7:26 PM, diesieben07 said:

Then I have no clue. Setup a proper git repo so that I can easily check out your code. No, a zip download does not work.

 

I have a git repos:

 

My entity code:

https://github.com/AwesomeSpider/Wizardry/blob/master/src/main/java/com/awsp8/wizardry/Entities/ArcanePowerMatrix.java

 

My entity model code:

 

https://github.com/AwesomeSpider/Wizardry/blob/master/src/main/java/com/awsp8/wizardry/entity/model/ModelPowerMatrix.java

 

My entity rendering code:

 

https://github.com/AwesomeSpider/Wizardry/blob/master/src/main/java/com/awsp8/wizardry/entity/render/RenderPowerMatrix.java

 

Hope you can help, if not it's fine I can always remove the entity. :)

Posted
  On 12/6/2014 at 7:55 PM, diesieben07 said:

First of all, fix that repo. All that crap should not be in there, only src, gradle, the gradlew files and build.gradle.

 

Allright, I will.

Posted
  On 12/6/2014 at 7:55 PM, diesieben07 said:

First of all, fix that repo. All that crap should not be in there, only src, gradle, the gradlew files and build.gradle.

 

Ok, I cleaned it up as best I could, it took a while to figure out how to use .gitignore files. :)

Posted
  On 12/6/2014 at 8:59 PM, diesieben07 said:

a) your .gitignore did not fix it.

b) Somehow your entity *is* spawned but immediately dies or something. Not sure why.

 

Oh I see, maybe it has no health, would that make it die immediately?

Posted
  On 12/6/2014 at 9:47 PM, diesieben07 said:

well, that would at least make

setDead

be called on the entity, but that is not the case either. it just seems as if the entity instance just vanishes.

 

Weird... I just remembered this has happened to me before with another entity. If I'm remembering correctly I couldn't fix it and ended up having to delete the entity. I had no idea what caused it, this is REALLY weird. I'll do more research, wish me luck. :)

Posted
  On 12/6/2014 at 9:32 PM, diesieben07 said:

Repo looks good, but I am still kinda stumped as to why that happens.

Oh and by the way, your code is a mess. Literally every class has loads and loads of warnings everywhere.

 

Wait I didn't see this reply sorry. Lol, what kind of warnings? My eclipse doesn't show any warnings.

Posted
  On 12/6/2014 at 10:30 PM, diesieben07 said:

Well, that is because in the default eclipse workspace that comes with forge most warnings are turned off.

 

Oh lol I didn't know that.

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.