Hi, I've been trying to make a third person camera mod similar to the camera in the Dark Souls games, that is the camera can rotate around the player and movement is relative to the current view. At first I used the EntityViewRenderEvent.CameraSetup event to set the pitch and yaw of the camera but chunks behind the player's view were not rendered until the player moved. I fixed this by changing the location of the player by a very small amount each tick. However I wanted more control over the camera (e.g. zoom) so I adapted the MineShot camera coremod to suit my needs and transformed the camera using GlStateManager in the EntityViewRenderEvent.RenderFog event. This works ok but has reintroduced the missing chunks issue and moving the player no longer forces these missing chunks to render.
I believe that using setRenderViewEntity with a dummy entity set to my third person camera's position should fix this problem in theory as the renderWorldPass method in EntityRenderer uses the current render view entity for its calculations. Below is the code I have used to attempt this.
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "FakePlayer");
camEntity = new FakePlayer(DimensionManager.getWorld(0), gameProfile);
camEntity.noClip = true;
camEntity.setPositionAndRotation(adjustedSpherePos.x, adjustedSpherePos.y, adjustedSpherePos.z, MathHelper.wrapDegrees(yRot), MathHelper.wrapDegrees(xRot));
MC.setRenderViewEntity(camEntity);
System.out.println(MC.getRenderViewEntity().toString()); //outputs name: FakePlayer, level: world, coords same as adjustedSpherePos (camera)
System.out.println(MC.getRenderViewEntity().getPositionVector().toString()); //outputs (0, 0, 0) for some reason
The result of adding this code was that the majority of the world disappeared, with a few parts flashing occasionally, and the position of the new game view appeared to shake between 2 points in an area of around 10 blocks despite the fact its position is not modified by my code after being declared. I also think the getPositionVector() output of (0, 0, 0) is a bit strange.
Now I know you guys don't support coremods, but seeing as the rendering goes back to normal as soon as I set the render view entity back to the player I don't think that it being a coremod is necessarily to blame.
It would be greatly appreciated if anybody could help by either:
1. identifying any flaws with my implementation using a FakePlayer (e.g. wrong entity, need to set some extra properties) or
2. suggesting how I might implement the hackier solution of forcing all chunks to be rendered all the time (maybe ChunkRenderContainer.addRenderChunk?)
Thanks!