Jump to content

How would I select an area to deal damge in


LittleLDude

Recommended Posts

Im making a sword that swings down if you right click and I need to select what entities take damage how would I make it so all entities take damage in a arcgoing from above your head to the ground in front of you with 1 block width and around 5 block height at its peak and 5 block length at its longest. I can get down the animation and stuff but I still need help figuring out how to select which entities take damage

Link to comment
Share on other sites

I think this should work:

ServerPlayer player = ...;

double radius = 8;

List<LivingEntity> list = player.level().getEntitiesOfClass(LivingEntity.class, player.getBoundingBox().inflate(radius,radius,radius), e->(/*filter entities and return true if accetted*/true));

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.



×
×
  • Create New...

Important Information

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