Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Problems rendering non-living entities.


Jadar
 Share

Recommended Posts

Hey guys, I'm trying to render one of my entities that I know is in the world. When the entity class extends EntityLiving it renders properly, but when it extends my EntityBase class it doesn't render properly, though the doUpdate method is being called. Is there something I'm missing?

Link to comment
Share on other sites

Its easier for people to tell where your mistake is when we can look at your code ourselves i understand if you dont want people to steal your ideas so maybe replace the names? but more people will offer to help or at atleast take a look if there is some example code, :)

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

Well its open source so that's not a problem. I'm making vehicles for this mod, and I made the model in Techne, and I made the entity. Right now it extends EntityLyoko which is mainly used for mobs. EntityLyoko extends EntityLiving. I want to make a new class for the vehicles to extend called EntityVehicle that has all the code for mounting and steering, etc. I made it extend Entity, and get all the methods and whatnot in it. The render class i use for the entity extends RenderLiving. The only thing it changes is the texture. It renders fine when the entity extends EntityLiving but when it extends my class it won't render at all. Although the doUpdate method triggers, so I know its there.

 

EntityVehicle:

 

 

public class EntityVehicle extends Entity {

protected String texture = "/matt/lyoko/mob/overboard.png";

public EntityVehicle(World par1World) {
	super(par1World);
	this.preventEntitySpawning = true;
}

@Override
protected void entityInit()
{
	this.dataWatcher.addObject(17, new Integer(0));
	this.dataWatcher.addObject(18, new Integer(1));
	this.dataWatcher.addObject(19, new Integer(0));
}

public AxisAlignedBB getCollisionBox(Entity par1Entity)
{
	return par1Entity.boundingBox;
}

public AxisAlignedBB getBoundingBox()
    {
        return this.boundingBox;
    }

public boolean canBeCollidedWith() {
	return true;
}

public boolean canBePushed() {
	return true;
}

public EntityVehicle(World par1World, double x, double y, double z) {
	this(par1World);
	this.setPosition(x, y + (double)this.yOffset, z);
	this.motionX = 0.0D;
	this.motionY = 0.0D;
	this.motionZ = 0.0D;
	this.prevPosX = x;
	this.prevPosY = y;
	this.prevPosZ = z;
}

@SideOnly(Side.CLIENT)

/**
 * Returns the texture's file path as a String.
 */
public String getTexture()
{
	return this.texture;
}


@Override
protected void readEntityFromNBT(NBTTagCompound par1) {

}

@Override
protected void writeEntityToNBT(NBTTagCompound par1) {

}

public boolean interact(EntityPlayer par1EntityPlayer)
    {
        if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer)
        {
            return true;
        }
        else
        {
            if (!this.worldObj.isRemote)
            {
                par1EntityPlayer.mountEntity(this);
            }

            return true;
        }
    }

 

 

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
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.

 Share



×
×
  • Create New...

Important Information

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