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

I have a Throwable item but for some reason its not rendering the item when thrown.

 

Main @Init method

	EntityRegistry.registerModEntity(EntityZeusLightningBolt.class, "Zeus Lightning Bolt", 2, this, 250, 5, false);
	RenderingRegistry.registerEntityRenderingHandler(EntityZeusLightningBolt.class, new RenderZeusLightningBolt(Main.ZeusSword));
[code]

EntityZeusLightningBolt
[code]

public class ItemZuesLightningBolt extends ItemSword
{
@Override
@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegistry)
{
	this.iconIndex = iconRegistry.registerIcon("TestMod:EntityLightningBolt");
}

public ItemZuesLightningBolt(int ID, EnumToolMaterial m, String name)
{
	super(ID, m, name);
}

public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer p)
{
	if (!p.capabilities.isCreativeMode)
	{
		item.damageItem(1, p);
	}

	if (!w.isRemote)
	{
		w.spawnEntityInWorld(new EntityZeusLightningBolt(w, p));
	}

	return item;
}
}

 

and finally my render class

public class RenderZeusLightningBolt extends RenderSnowball
{

public RenderZeusLightningBolt(Item item)
{
	super(item);
}
}

 

public class EntityZeusLightningBolt extends EntityThrowable
{
public EntityZeusLightningBolt(World w)
{
	super(w);
}

public EntityZeusLightningBolt(World w, EntityLiving par2EntityLiving)
{
	super(w, par2EntityLiving);
}

public EntityZeusLightningBolt(World w, double par2, double par4, double par6)
{
	super(w, par2, par4, par6);
}

protected void onImpact(MovingObjectPosition MOP)
{
	if (MOP.entityHit != null)
	{
		EntityLiving e = (EntityLiving) MOP.entityHit;
		e.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
		WorldUtils.strikeThunderAtEntity(e, 0);
	}
	if(MOP.typeOfHit == EnumMovingObjectType.TILE)
	{
		World w = this.worldObj;
		WorldUtils.strikeThunderAtBlock(w, MOP.blockX, MOP.blockY, MOP.blockZ, 0);
	}

	if (!this.worldObj.isRemote)
	{
		this.setDead();
	}
}
}

Common error is to forget set proper coordinates. Could you post EntityZeusLightningBolt (the code tag seems broken)?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

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.