Jump to content

Recommended Posts

Posted (edited)

Hi, im looking for a way to check the % of charge on a bow/crossbow, but cant find it on any way to do it.
Is there something similar to player.getAttackStrengthScale() but for ranged weapons?

(Sorry if there is already a similar post, I kept searching for such but couldnt find it)

Edited by SentriKun
Posted
2 hours ago, SentriKun said:

Hi, im looking for a way to check the % of charge on a bow/crossbow, but cant find it on any way to do it.
Is there something similar to player.getAttackStrengthScale() but for ranged weapons?

(Sorry if there is already a similar post, I kept searching for such but couldnt find it)

You can get the current power of a bow with:

BowItem.getPowerForTime(player.getUseItem().getUseDuration() - player.getUseItemRemainingTicks())

 

  • Like 1
Posted

naa
a) you have to make your custom arrow entity and pass the value to the constructor way it gets internally stored in the arrow entity 

b) in your custome bow at moment of shooting you store the power value as nbt in the bow itemstack or capability

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.