Jump to content

Entity Target "flickers" between null and the player 1.18


shadowducky

Recommended Posts

I am attempting to create an entity (in 1.18.2) that changes its texture based on distance from its target (usually the player). I've tested the texture changing with other booleans such as above or below a certain height, but when trying with distance from the player it does not switch to visible. Right now the if statement checks (this.getTarget() != null) and then .distanceTo but the texture doesn't switch. I used the tick() function to output the current target and even when the entity is moving towards the player, the target flickers between null and the player. I included the entity class and log below (the log was shortened because it's repetitive)

Entity Class: https://pastebin.com/2XxeKh8n

Output Log: https://pastebin.com/0R55tu0A

Link to comment
Share on other sites

31 minutes ago, Luis_ST said:

the client does not have a target so it's null

So is there a way for the client to call the distance to the entity and then send that to the renderer? I tried looking through the ghast for a way to do it but it uses entity data and time remaining for charging

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.