Jump to content

Sword Ranged Attacks


Monstrous_Apple

Recommended Posts

I have that already I'm just not sure what part of the wither skull attack to put into the code, I tried this:

 

	@Override
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) 
	if(itemStackIn.getItem() == MAItems.NetherBlade)
	return super.onItemRightClick(itemStackIn, worldIn, playerIn);
}

private void launchWitherSkullToEntity(int p_82216_1_, EntityLivingBase p_82216_2_)
{
    this.launchWitherSkullToCoords(p_82216_1_, p_82216_2_.posX, p_82216_2_.posY + (double)p_82216_2_.getEyeHeight() * 0.5D, p_82216_2_.posZ, p_82216_1_ == 0 && this.rand.nextFloat() < 0.001F);
}

/**
* Launches a Wither skull toward (par2, par4, par6)
*/
private void launchWitherSkullToCoords(int p_82209_1_, double x, double y, double z, boolean invulnerable)
{
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1014, new BlockPos(this), 0);
    double d0 = this.func_82214_u(p_82209_1_);
    double d1 = this.func_82208_v(p_82209_1_);
    double d2 = this.func_82213_w(p_82209_1_);
    double d3 = x - d0;
    double d4 = y - d1;
    double d5 = z - d2;
    EntityWitherSkull entitywitherskull = new EntityWitherSkull(this.worldObj, this, d3, d4, d5);

    if (invulnerable)
    {
        entitywitherskull.setInvulnerable(true);
    }

    entitywitherskull.posY = d1;
    entitywitherskull.posX = d0;
    entitywitherskull.posZ = d2;
    this.worldObj.spawnEntityInWorld(entitywitherskull);
}
}

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