jordan30001 Posted May 8, 2013 Posted May 8, 2013 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(); } } } Quote
mnn Posted May 8, 2013 Posted May 8, 2013 Common error is to forget set proper coordinates. Could you post EntityZeusLightningBolt (the code tag seems broken)? Quote mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
jordan30001 Posted May 11, 2013 Author Posted May 11, 2013 OP updated added fixed EntityZeusLightningbolt code tag Quote
Recommended Posts
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.