[FIGURED OUT] "Entity on tick update" procedure doesn't work unless entity is in the FOV of a player

Started by Puglord123 on

Topic category: Help with modding (Java Edition)

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[FIGURED OUT] "Entity on tick update" procedure doesn't work unless entity is in the FOV of a player
Thu, 01/04/2024 - 15:54 (edited)

Hello, I recently made and released a FNaF mod that has animatronics which switch between a Night Time mode and a Day Time mode. I realised that this switch between the modes happens only if the entity is in the FOV of a player. Would there be any way to fix this and make it so that it happens regardles of if the player is looking at the entity, or is this hard-coded?

Edited by Puglord123 on Thu, 01/04/2024 - 15:54
Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure why FOV would…
Tue, 01/02/2024 - 20:00

I'm not sure why FOV would be affecting entities- I've been able to run code before as long as entities are nearby, if not directly in the player's field of view. Is it possible your entities have too low of a rendering distance? I usually set it to at least 32 meters for anything with ranged or special abilities. They could also be set to despawn when idle, though they'd have to be much further away for this to be the issue.

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mindthemoods, I also don’t…
Tue, 01/02/2024 - 20:19

Mindthemoods, I also don’t understand why this works like it does, but somehow it does, and how do you check your entity rendering distance and how do you change it?

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, they are not set to…
Tue, 01/02/2024 - 20:25

Also, they are not set to respawn when idle, that is for sure, so that can’t be causing it

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the 'behavior' tab of an…
Tue, 01/02/2024 - 22:38

In the 'behavior' tab of an entity, there should be a box for follow range, and tracking range. You can increase tracking range to allow essentially increase or decrease an entity's simulation distance. However, if the entities are still moving and otherwise behaving normally when outside the player's view, there might be something else that's preventing your procedure from working. Could you send a picture of the procedure you're using to switch the entities?

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is the procedure i'm…
Wed, 01/03/2024 - 14:31

Here is the procedure i'm using
https://imgur.com/a/GuWjqjb
What's weird is that the night time modes do move if they are out of a players FOV, but they don't switch modes. And the follow range of every animatronic is 512.
Maybe it's also because of the fact that I made a FNaF 1 map recreation that i test everything on and i just sit in the office, and that's when they don't want to switch.

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, I recently got a…
Wed, 01/03/2024 - 14:32

Also, I recently got a tester for this mod and he says that they switch if you are not looking at them, so maybe it's just the thing with the office

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Huh. That is weird, I would…
Wed, 01/03/2024 - 17:38

Huh. That is weird, I would expect something like that to work. It might have something to do with mob spawning behavior: if the animatronics are classified as mobs, minecraft has some weird rules about not spawning them within certain ranges of the player, but I wouldn't expect that to effect things spawned in manually. I would guess it's still not necessarily the spawning procedure, but something else about the mobs- maybe since the new mobs won't have their attack target set to the player, you need to manually reset it to get them moving? I would recommend testing it on your version of minecraft, not just the test client, there are some rare issues that seem to resolve themselves when tested externally. But yes, I assume it probably has something to do with the mob's AI, not the switching procedure, which looks fine. 

Last seen on 13:54, 27. Jul 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tested on my version of…
Thu, 01/04/2024 - 15:47

I tested on my version of minecraft, and it seems to work! Thank you so much for your help!