Ender IO Zoo

Ender IO Zoo

961k Downloads

the ender sword teleports you to an anchor you did not even look at

tincotema opened this issue ยท 6 comments

commented

Issue Description:

the ender sword teleports you to an anchor you did not even look at

What happens:

the ender sword teleports you to an anchor you did not even look at even if you are not near of an other travel anchor. I also change in the config the behaviour of the anchors to not respond on shift, but this doesn't matter, it happens anyway.

Steps to reproduce:

  1. have some travel anchors you can use
  2. use the travel upgrade on 'the ender'
  3. try to teleport without looking to an anchor
    ...

Affected Versions (Do not use "latest"):

  • EnderIO:5.0.26
  • EnderCore:1.12.2-0.5.31
  • Minecraft: 1.7.12
  • Forge:14.23.4.2705
commented

TLDR: Manually cull points behind the screen, as frustum calling is an optimization and not guaranteed (e.g. OptiFine disables this for certain tile entities).

I think the root cause of this problem is that currently EnderIO relies on the internal frustum culling to not call renderTileEntity() on travel anchors outside of the screen.
While tile entities are somewhat guaranteed to be rendered if all base conditions are met (isGlobalRenderer + bounding box + in frustum), the inverse is not always false. They might be rendered
even if it is outside of the frustum. OptiFine for example causes certain TileEntities to render always. I believe that the OP used OptiFine and @HenryLoenwind was not able to reproduce it, as he probably did not (just guessing).

So to solve this even for people using OptiFine (or other graphics mods), we should cull all canidates behind the screen plane.
IMHO this problem would be best solved by modifying Camera.getScreenPoint() in EnderCore to also return the transformed z coordinate
of the original point, which will indicate this property for no additional cost. Then adjust the usage of this function in EnderIO,
which is anyway only used by the travelling system.
I have attached a pull request doing exactly this for both repositories:
EnderIO PR #5125, EnderCore PR #109

commented

nice it is done :D

commented

we have an idea what the problem might could be: it seems so that you get also teleport if you your line of sight in the opposite direction hits an anchor. in f5 mode you can see how the anchor get activated

commented

Drawing behind the player is intended, it fixes issues in other areas such as anchors obscured by large structures. See:

https://github.com/SleepyTrousers/EnderIO/blob/master/enderio-machines/src/main/java/crazypants/enderio/machines/machine/teleport/anchor/TravelEntitySpecialRenderer.java#L186

The raycast algorithm should be improved.

commented

Looks like the game renders the Travel Anchors behind the player for some reason. In com.enderio.core.common.vecmath.Camera.getScreenPoint(Vector3d) it makes no difference if a point is behind or in front of the screen.

commented

isGlobalRenderer does NOT render a TE when it's outside the frustum (i.e. not on the screen). It only allows it to render when it's behind other blocks.

(getRenderBoundingBox() {return INFINITE_EXTENT_AABB} would render behind the player.)