Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

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

  • Author

I did as you said and I can now see that for some reason my entities are not being passed through to RenderManager. Any thoughts on why this is happening.

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

 

 

 

 

 

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

 

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.