Jump to content

Recommended Posts

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

Posted

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

×   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



×
×
  • Create New...

Important Information

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