Jump to content

Problem replacing vanilla attack event - 1.15 [solved]


Turtledove

Recommended Posts

I want to detect whether an entity is in a NON-axis aligned plane boundary in front of the player, that rotates with the player's pitch and yaw. I've done the linear algebra and it works. The plane is directly in front of the player, with width 0.6, length 2, and it is 1.6 units above the player's world coordinates and this is my implementation of that.

Graphed, this is when I'm directly facing a testificate, in the plane's coordinates. A,B,C are the 3 corners of the plane, and E and D is the coordinates of the bottom and top of the villager, respectively.

 

image.thumb.png.18c247eb04e383d8c609374538ee1f2a.png

Another view, from the XY plane: 

image.thumb.png.d269846c2d6f3500da487e29316e7520.png

 

As you can see, it clearly intersects, and graphing where t=1.3 corresponds to in the parametric equation results in the correct intersection (it's F):

 

image.thumb.png.1bd54479f5da58dc0d7601614e6b2027.png

 

 

 

That said, when I then cancel the vanilla event, and cause damage to the entity in code, nothing happens. Is it possible that when I make that damage call, it calls the same attack event method again, which is then canceled?

 

Disregard, I figured it out the second after I posted it. There was a typecast to int that shouldn't have been there that was setting the flag to false. Also the event is only called for the client.

 

 

Edited by Turtledove
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.