[SOLVED, sorta] How do I detect if player is looking at my custom entity's head?

Started by akisephila on

Topic category: Help with modding (Java Edition)

Last seen on 07:56, 15. Nov 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED, sorta] How do I detect if player is looking at my custom entity's head?
Wed, 06/30/2021 - 01:15 (edited)

I understand that this can be done with the raytracing blocks but not only do the raytracing blocks seem nigh impossible to use (I can't even grab the XYZ of where the player is looking, because the "Look [X/Y/Z] position of [Event/Target Entity]" is a number block and can't be used with logic "AND" blocks), there are also zero tutorials that help me in the slightest, and all other forum topics I have checked on this matter have been useless.
Please help.

Edited by akisephila on Wed, 06/30/2021 - 01:15
Last seen on 07:56, 15. Nov 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Sajevius
Mon, 06/28/2021 - 09:45

@Sajevius

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
try breaking out of loop …
Mon, 06/28/2021 - 14:01

try breaking out of loop (repeat [n] times) by putting "break out of loop" after procedure setting "entity_found" = true or after the last procedure you put after it

Last seen on 03:06, 7. Nov 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
By the way, im pretty sure…
Mon, 06/28/2021 - 14:32

By the way, im pretty sure klemen is a bot, i think? I dont know but what he mostly says is, here are the tutorials! With the same link each time

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
then you obviously only know…
Mon, 06/28/2021 - 22:48

then you obviously only know him from within the website and only from those kinds of replies from him, Nannerbz :P

just coz he puts the same link almost everytime when someone asks for help doesn't always mean it's automated by a bot tho. have you heard of comment templates (a more likely possibility)? or clipboard? (i think)

look, i ain't gonna be biased towards/defending Klemen or anything. i know, the tutorials aren't helpful sometimes that it annoys me a bit seeing other members who were asking for how to actually do something (usually more complex) not being satisfied with the answer coz that's not what they were looking for, and no offense... but saying that a person who mostly sticks to sharing 1 tutorial playlist (which is helpful for people not looking for a solution to do complicated stuff) is a bot seems like a shallow thought inconsiderate of other valid possibilities and that you only know him within this website/just don't know him well, and it could be dangerous or unnecessary when shared publicly like this (y'know? like, tell me how it'll help anything). if you think of something suspicious about a member like being a bot or something, just a friendly suggestion to not say anything about it publicly as it might bring up unnecessary attention or controversy; keep it to yourself, or contact someone who can help with resolving that kinda issue or clearing things up to destroy your potentially false doubts. oh, and if he's a bot, were the moments that he was able to legit comment on the website perhaps fake?(https://mcreator.net/comment/133286#comment-133286https://mcreator.net/comment/173769#comment-173769https://mcreator.net/comment/182165#comment-182165, https://mcreator.net/comment/182354... the list goes on)

let's not take this far tho. I don't want this to be a heated debate, haha

Last seen on 07:56, 15. Nov 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Sajevius I made it so that…
Tue, 06/29/2021 - 09:24

@Sajevius I made it so that it breaks out of the loop after spawning the hostile variant, and it works!!
Unfortunately, it still activates whenever I look at any part of the entity, instead of just the head. I thought making the Y coordinate for the rd +2 would change that but apparently not.
Almost there, though! Any advice?

Last seen on 08:14, 28. Nov 2023
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sadly i don't think there's…
Tue, 06/29/2021 - 10:18

sadly i don't think there's a way to detect for a mob's head within a specified coordinate, as the "head" part of any mob is most likely not defined in code such that it could be accessed. there's technically a "head" for a mob but it's for the model and idk if it can be gotten somehow. that's why i did "get nearest entity in square cube" as a workaround, otherwise it'd be impossible any other way. searching online, i also didn't find any solution to that, code or otherwise. but anyways, at least the basic idea works and hopefully it's okay for you! i mean, that could make for slightly more difficulty on your mod :D

Last seen on 07:56, 15. Nov 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ah. I guess I may have to…
Wed, 06/30/2021 - 01:14

Ah. I guess I may have to forgo doing the raytracing entirely, then, since the mob I'm creating can be traded with (and with the current method of angering it upon looking at it, it makes it impossible to trade with..)

Thanks, though. 

Last seen on 12:53, 15. Sep 2023
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Sajevius so im trying to…
Sun, 03/27/2022 - 12:08

@Sajevius so im trying to make it so when you right click with a item it swaps your position with the entity you are looking at can you help me with that

Last seen on 14:43, 25. Mar 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you send me the…
Thu, 03/30/2023 - 17:01

Can you send me the procedure you did? or an image? I'm not getting!
I'm doing it so that when I look at the entity it turns into another.
Thanks

Last seen on 20:01, 24. Mar 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's not working for me :(
Fri, 08/11/2023 - 01:46

It's not working for me :(

Last seen on 03:04, 18. Dec 2023
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am making a mod with a…
Thu, 10/12/2023 - 23:35

I am making a mod with a same type of mob that does this when you look at it, and its still confusing to me lol