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:

 

 

 

Entity:

public class ArcanePowerMatrix 
			extends EntityLiving{



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

@Override
protected void entityInit() {

}

@Override
public void readEntityFromNBT(NBTTagCompound tags) {

}

@Override
public void writeEntityToNBT(NBTTagCompound tags) {

}
}

Model:

public class ModelPowerMatrix extends ModelBase{
  //fields
    ModelRenderer Base;
    ModelRenderer MainCube;
    ModelRenderer littleCube;
    ModelRenderer littleCube2;
    ModelRenderer littleCube3;
    ModelRenderer littleCube4;
  
  public ModelPowerMatrix()
  {
    textureWidth = 128;
    textureHeight = 64;
    
      Base = new ModelRenderer(this, 0, 32);
      Base.addBox(-5F, 0F, -5F, 10, 1, 10);
      Base.setRotationPoint(0F, 23F, 0F);
      Base.setTextureSize(64, 32);
      Base.mirror = true;
      setRotation(Base, 0F, 0F, 0F);
      MainCube = new ModelRenderer(this, 0, 0);
      MainCube.addBox(-6F, -6F, -6F, 12, 12, 12);
      MainCube.setRotationPoint(0F, 11F, 0F);
      MainCube.setTextureSize(64, 32);
      MainCube.mirror = true;
      setRotation(MainCube, -0.7853982F, 0F, -0.7853982F);
      littleCube = new ModelRenderer(this, 50, 0);
      littleCube.addBox(-2F, -2F, -2F, 4, 4, 4);
      littleCube.setRotationPoint(5.5F, 5.5F, -11.5F);
      littleCube.setTextureSize(64, 32);
      littleCube.mirror = true;
      setRotation(littleCube, -0.7853982F, 0F, -0.7853982F);
      littleCube2 = new ModelRenderer(this, 50, 0);
      littleCube2.addBox(-2F, -2F, -2F, 4, 4, 4);
      littleCube2.setRotationPoint(5.5F, 5.5F, 11.5F);
      littleCube2.setTextureSize(64, 32);
      littleCube2.mirror = true;
      setRotation(littleCube2, -0.7853982F, 0F, -0.7853982F);
      littleCube3 = new ModelRenderer(this, 50, 0);
      littleCube3.addBox(-2F, -2F, -2F, 4, 4, 4);
      littleCube3.setRotationPoint(-2F, -3F, 0F);
      littleCube3.setTextureSize(64, 32);
      littleCube3.mirror = true;
      setRotation(littleCube3, -0.7853982F, 0F, -0.7853982F);
      littleCube4 = new ModelRenderer(this, 50, 0);
      littleCube4.addBox(-2F, -2F, -2F, 4, 4, 4);
      littleCube4.setRotationPoint(14F, 13F, 0F);
      littleCube4.setTextureSize(64, 32);
      littleCube4.mirror = true;
      setRotation(littleCube4, -0.7853982F, 0F, -0.7853982F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Base.render(f5);
    MainCube.render(f5);
    littleCube.render(f5);
    littleCube2.render(f5);
    littleCube3.render(f5);
    littleCube4.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}

Renderer:

@SideOnly(Side.CLIENT)
public class RenderPowerMatrix
			extends RenderLiving{

public RenderPowerMatrix(ModelBase modelBase, float shadowSize) {
	super(modelBase, shadowSize);
}

@Override
protected ResourceLocation getEntityTexture(Entity var1) {
	return new ResourceLocation("wizardry", "/textures/entities/PowerMatrix.png");
}
}

My entity is registered like this:

registerEntity(ArcanePowerMatrix.class, "powerMatrix", 000, 000);

 

registerEntity is like this:

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));
    }

 

In ClientProxy my renderer is registered like this:

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

 

 

Posted

Are you calling the method which holds

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

in your main class?

Posted

Are you calling the method which holds

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

in your main class?

 

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

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.

 

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

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

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

How many entities do you have?

 

Five, counting the one that isn't working.

Posted

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

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

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

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

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

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I've already tried it without mods and it works.
    • i never created a world on singleplayer and I don't see a level.dat file, there's a server.dat file though. but i play multiplayer on my minecraft server with my friends.
    • Add crash-reports with sites like https://mclo.gs/   Make a test without any mods - just Forge
    • Also add the level.dat from your worldsave via sites like mediafire
    • It's the little things that get you sometimes, isn't it? I was actually pretty hyped with my new Bluetooth speaker, ready to see just how well it would sound and pump up my playlist while finishing some work. So, like any other tech enthusiast, I connected it to my laptop, where, of course, my crypto wallet was open and logged in. Big mistake. It was a freakish twist of fate that, well, the Bluetooth speaker seemed to have other plans. It began glitching like a broken record, sending my laptop into a frenzy. I tried reconnecting it, and that's when the disaster struck. In some kind of crazy chain of events, I managed to get locked out of my $90,000 Bitcoin wallet. My wallet was still there, but access was completely blocked. As I sat staring at the screen in utter disbelief, my mind wandered to how something so silly could have caused such a huge mess. Cue the panic. Something this simple, such as a glitch with the speaker, and I don't have access to so much money. The whole thing was just utterly absurd, and I couldn't stop playing the scene over and over in my mind, wishing I'd just have waited until work was done to mess with my new gadget. But it was too late; I was locked out, and the financial chaos was real. Luckily, I knew where to go for help. The very first words in my mind were LEEULTIMATEHACKER @ AOL . COM   telegram: LEEULTIMATE   wh@tsapp +1  (715) 314  -  9248  https :// leeultimatehacker. com I had heard very positive feedback about them regarding their capabilities, and they did not even laugh after several minutes of hearing my story, which, let's face it, sounds utterly ridiculous. Instead, they reassured me that they have seen all kinds of scenarios and can be of assistance with mine. Immediately, I relaxed due to their professionalism. They were very calm, efficient, and started working on my case without wasting even a single second. In some days, they called me back to intimate me with the great news that my $90,000 was safely restored and my wallet was back in my hands. The feeling of relief which I felt was beyond description, knowing well that my ridiculous Bluetooth speaker disaster was finally over. I will make sure gadgets and crypto are in two completely different corners: Now I understand that crypto has absolutely nothing to do with gadgets. Thank the heavens, Lee Ultimate Hacker recovered my funds, at the same time teaching me how to be much more cautious in handling wallets this time around. Not getting caught a second time!
  • Topics

×
×
  • Create New...

Important Information

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