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

HELP WITH THROWABLE RENDERING


nickpops98
 Share

Recommended Posts

Hi everyone,

 

I was working on two new throwable entities in forge and I am trying to use the snowball and fireball rendering but I cannot see the two entities while they are in the air. However it has nothing to do with my entities as they perform as they are supposed to on impact. (Expolosion, potion effects...) Any help on how I could fix this so the entities actually render would be great.

 

Main Class

 

 

package nickpops98.modName;
// Imports required
@Mod( modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class modName {
}
@EventHandler
public void Load(FMLInitializationEvent event) {                            
// [<] Entity Settings
EntityRegistry.registerGlobalEntityID(EntityLavaball.class, "Lavaball", 4);
EntityRegistry.registerGlobalEntityID(EntityBlindshot.class, "Blindshot", 5);
                                                            
RenderingRegistry.registerEntityRenderingHandler(EntityLavaball.class, new RenderFireball(1.0F));
RenderingRegistry.registerEntityRenderingHandler(EntityBlindshot.class, new RenderSnowball(Item.enderPearl));
// [>]
}

 

 

 

Entity Lavaball

 

 

package nickpops98.modName.entity.projectile;
// Imports required
public class EntityLavaball extends EntityThrowable
{
public EntityLavaball(World par1World)
{
     super(par1World);
     this.isImmuneToFire = true;
     this.setFire(1000);
}

public EntityLavaball(World par1World, EntityLivingBase par2EntityLivingBase)
{
     super(par1World, par2EntityLivingBase);
}
public EntityLavaball(World par1World, double par2, double par4, double par6)
{
     super(par1World, par2, par4, par6);
}
/**
     * Called when this EntityThrowable hits a block or entity.
     */
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
     this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, 0.8F, true, true);
     this.setDead();
}
}

 

 

 

Entity Blindshot

 

 

package nickpops98.modName.entity.projectile;
// Imports requiredpublic class EntityBlindshot extends EntityThrowable
{
public EntityBlindshot(World par1World)
{
     super(par1World);
     this.isImmuneToFire = true;
     this.setFire(1000);
}

public EntityBlindshot(World par1World, EntityLivingBase par2EntityLivingBase)
{
     super(par1World, par2EntityLivingBase);
}
public EntityBlindshot(World par1World, double par2, double par4, double par6)
{
     super(par1World, par2, par4, par6);
} /**
     * Called when this EntityThrowable hits a block or entity.
     */
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
     if(par1MovingObjectPosition.typeOfHit == EnumMovingObjectType.ENTITY)
     ((EntityLivingBase) par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 1));
}
}

 

 

 

Thanks in advance!

Link to comment
Share on other sites

Hi

 

I don't see an obvious problem but some thoughts...

 

I've been told it's better to use EntityRegistry.registerModEntity instead of registerGlobalEntityID.  (But I doubt this is causing your rendering problem)

 

I'd suggest that you put a breakpoint into RenderManager.renderEntityWithPosYaw

 

            render = this.getEntityRenderObject(par1Entity);  // breakpoint here

            if (render != null && this.renderEngine != null)
            {

or alternatively

 

  if (par1Entity instanceof EntityLavaball) {
     System.out.println("rendering EntityLavaball"); // breakpoint here
  }
            render = this.getEntityRenderObject(par1Entity);

            if (render != null && this.renderEngine != null)
            {

 

then trace into it to see why your desired renderer isn't being retrieved.  Or alternatively, if it's being retrieved, why the render code isn't working.

 

-TGG

Link to comment
Share on other sites

Hi

 

I did as you said and I can now see that for some reason my entities are not being passed through to RenderManager.

 

I'm not sure what you mean by that.

 

do you mean that when you got to the line

            render = this.getEntityRenderObject(par1Entity);

your par1Entity is the EntityLavaball, render was set to null?

 

or do you mean that renderEntityWithPosYaw was never called for your EntityLavaball at all?

 

-TGG

 

 

 

 

 

Link to comment
Share on other sites

Hi

 

Hmmm ok

 

In RenderGlobal.renderEntities, add the following line

 

            this.theWorld.theProfiler.endStartSection("entities");

            for (i = 0; i < list.size(); ++i)
            {
                entity = (Entity)list.get(i);
                if (entity instanceof EntityLavaball) {
     System.out.println("rendering EntityLavaball"); // breakpoint here
  }

when it breaks, see if you can trace through and see why it isn't getting to

                    RenderManager.instance.renderEntity(entity, par3);

 

-TGG

 

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