use of com.qouteall.immersive_portals.ducks.IEPlayerListEntry in project ImmersivePortalsMod by qouteall.
the class MyGameRenderer method renderPlayerItself.
private void renderPlayerItself(Vec3d playerPos, Vec3d playerLastTickPos, float patialTicks) {
EntityRenderDispatcher entityRenderDispatcher = ((IEWorldRenderer) mc.worldRenderer).getEntityRenderDispatcher();
PlayerListEntry playerListEntry = CHelper.getClientPlayerListEntry();
GameMode originalGameMode = MyRenderHelper.originalGameMode;
Entity player = mc.cameraEntity;
assert player != null;
Vec3d oldPos = player.getPos();
Vec3d oldLastTickPos = McHelper.lastTickPosOf(player);
GameMode oldGameMode = playerListEntry.getGameMode();
Helper.setPosAndLastTickPos(player, playerPos, playerLastTickPos);
((IEPlayerListEntry) playerListEntry).setGameMode(originalGameMode);
entityRenderDispatcher.render(player, patialTicks, false);
Helper.setPosAndLastTickPos(player, oldPos, oldLastTickPos);
((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
}
use of com.qouteall.immersive_portals.ducks.IEPlayerListEntry in project ImmersivePortalsMod by qouteall.
the class MyGameRenderer method renderWorld.
public void renderWorld(float partialTicks, WorldRenderer newWorldRenderer, ClientWorld newWorld, Vec3d oldCameraPos) {
ChunkRenderDispatcher chunkRenderDispatcher = ((IEWorldRenderer) newWorldRenderer).getChunkRenderDispatcher();
chunkRenderDispatcher.updateCameraPosition(mc.player.x, mc.player.z);
IEGameRenderer ieGameRenderer = (IEGameRenderer) mc.gameRenderer;
DimensionRenderHelper helper = CGlobal.clientWorldLoader.getDimensionRenderHelper(newWorld.dimension.getType());
PlayerListEntry playerListEntry = CHelper.getClientPlayerListEntry();
Camera newCamera = new Camera();
// store old state
WorldRenderer oldWorldRenderer = mc.worldRenderer;
ClientWorld oldWorld = mc.world;
LightmapTextureManager oldLightmap = ieGameRenderer.getLightmapTextureManager();
BackgroundRenderer oldFogRenderer = ieGameRenderer.getBackgroundRenderer();
GameMode oldGameMode = playerListEntry.getGameMode();
boolean oldNoClip = mc.player.noClip;
boolean oldDoRenderHand = ieGameRenderer.getDoRenderHand();
List oldChunkInfos = ((IEWorldRenderer) mc.worldRenderer).getChunkInfos();
IEChunkRenderList oldChunkRenderList = (IEChunkRenderList) ((IEWorldRenderer) oldWorldRenderer).getChunkRenderList();
// List<ChunkRenderer> oldChunkRenderers = oldChunkRenderList.getChunkRenderers();
OFInterface.createNewRenderInfosNormal.accept(newWorldRenderer);
// switch
mc.worldRenderer = newWorldRenderer;
mc.world = newWorld;
ieGameRenderer.setBackgroundRenderer(helper.fogRenderer);
ieGameRenderer.setLightmapTextureManager(helper.lightmapTexture);
helper.lightmapTexture.update(0);
helper.lightmapTexture.enable();
BlockEntityRenderDispatcher.INSTANCE.world = newWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(GameMode.SPECTATOR);
mc.player.noClip = true;
ieGameRenderer.setDoRenderHand(false);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.pushMatrix();
CGlobal.renderInfoNumMap.put(newWorld.dimension.getType(), ((IEWorldRenderer) mc.worldRenderer).getChunkInfos().size());
updateCullingPlane();
// this is important
GlStateManager.disableBlend();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GuiLighting.disable();
((GameRenderer) ieGameRenderer).disableLightmap();
mc.getProfiler().push("render_portal_content");
CGlobal.switchedFogRenderer = ieGameRenderer.getBackgroundRenderer();
// invoke it!
OFInterface.beforeRenderCenter.accept(partialTicks);
ieGameRenderer.renderCenter_(partialTicks, getChunkUpdateFinishTime());
OFInterface.afterRenderCenter.run();
mc.getProfiler().pop();
// recover
mc.worldRenderer = oldWorldRenderer;
mc.world = oldWorld;
ieGameRenderer.setBackgroundRenderer(oldFogRenderer);
ieGameRenderer.setLightmapTextureManager(oldLightmap);
BlockEntityRenderDispatcher.INSTANCE.world = oldWorld;
((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
mc.player.noClip = oldNoClip;
ieGameRenderer.setDoRenderHand(oldDoRenderHand);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.popMatrix();
GlStateManager.enableBlend();
((IEWorldRenderer) mc.worldRenderer).setChunkInfos(oldChunkInfos);
oldChunkRenderList.setCameraPos(oldCameraPos.x, oldCameraPos.y, oldCameraPos.z);
}
Aggregations