Search in sources :

Example 1 with WorldRenderer

use of net.minecraft.client.render.WorldRenderer in project ImmersivePortalsMod by qouteall.

the class ClientWorldLoader method createFakedClientWorld.

// fool minecraft using the faked world
private ClientWorld createFakedClientWorld(DimensionType dimension) {
    assert mc.world.dimension.getType() == mc.player.dimension;
    assert (mc.player.dimension != dimension);
    isLoadingFakedWorld = true;
    // TODO get load distance
    int chunkLoadDistance = 3;
    WorldRenderer worldRenderer = new WorldRenderer(mc);
    ClientWorld newWorld;
    try {
        ClientPlayNetworkHandler newNetworkHandler = new ClientPlayNetworkHandler(mc, new ChatScreen("You should not be seeing me. I'm just a faked screen."), new ClientConnection(NetworkSide.CLIENTBOUND), new GameProfile(null, "faked_profiler_id"));
        // multiple net handlers share the same playerListEntries object
        ((IEClientPlayNetworkHandler) newNetworkHandler).setPlayerListEntries(((IEClientPlayNetworkHandler) mc.player.networkHandler).getPlayerListEntries());
        newWorld = new ClientWorld(newNetworkHandler, new LevelInfo(0L, GameMode.CREATIVE, true, isHardCore, LevelGeneratorType.FLAT), dimension, chunkLoadDistance, mc.getProfiler(), worldRenderer);
    } catch (Exception e) {
        throw new IllegalStateException("Creating Faked World " + dimension + " " + clientWorldMap.keySet(), e);
    }
    worldRenderer.setWorld(newWorld);
    worldRenderer.apply(mc.getResourceManager());
    ((IEClientPlayNetworkHandler) ((IEClientWorld) newWorld).getNetHandler()).setWorld(newWorld);
    clientWorldMap.put(dimension, newWorld);
    worldRendererMap.put(dimension, worldRenderer);
    Helper.log("Faked World Created " + dimension);
    isLoadingFakedWorld = false;
    return newWorld;
}
Also used : ChatScreen(net.minecraft.client.gui.screen.ChatScreen) IEClientPlayNetworkHandler(com.qouteall.immersive_portals.ducks.IEClientPlayNetworkHandler) GameProfile(com.mojang.authlib.GameProfile) LevelInfo(net.minecraft.world.level.LevelInfo) ClientConnection(net.minecraft.network.ClientConnection) IEClientWorld(com.qouteall.immersive_portals.ducks.IEClientWorld) ClientWorld(net.minecraft.client.world.ClientWorld) WorldRenderer(net.minecraft.client.render.WorldRenderer) IEClientPlayNetworkHandler(com.qouteall.immersive_portals.ducks.IEClientPlayNetworkHandler) ClientPlayNetworkHandler(net.minecraft.client.network.ClientPlayNetworkHandler)

Example 2 with WorldRenderer

use of net.minecraft.client.render.WorldRenderer in project ImmersivePortalsMod by qouteall.

the class PortalRenderer method renderPortalContentWithContextSwitched.

protected void renderPortalContentWithContextSwitched(Portal portal, Vec3d oldCameraPos) {
    GlStateManager.enableAlphaTest();
    GlStateManager.enableCull();
    WorldRenderer worldRenderer = CGlobal.clientWorldLoader.getWorldRenderer(portal.dimensionTo);
    ClientWorld destClientWorld = CGlobal.clientWorldLoader.getOrCreateFakedWorld(portal.dimensionTo);
    Helper.checkGlError();
    CGlobal.myGameRenderer.renderWorld(MyRenderHelper.partialTicks, worldRenderer, destClientWorld, oldCameraPos);
    Helper.checkGlError();
}
Also used : ClientWorld(net.minecraft.client.world.ClientWorld) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Example 3 with WorldRenderer

use of net.minecraft.client.render.WorldRenderer in project Client by MatHax.

the class EntityShaders method renderOutlines.

public static void renderOutlines(Runnable draw, boolean entities, int width, float fillOpacity, ShapeMode shapeMode) {
    WorldRenderer worldRenderer = mc.worldRenderer;
    WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer;
    Framebuffer fbo = worldRenderer.getEntityOutlinesFramebuffer();
    if (entities)
        wra.setEntityOutlinesFramebuffer(outlinesFramebuffer);
    else {
        outlinesFramebuffer.clear(false);
        outlinesFramebuffer.beginWrite(false);
    }
    draw.run();
    if (entities)
        wra.setEntityOutlinesFramebuffer(fbo);
    mc.getFramebuffer().beginWrite(false);
    GL.bindTexture(outlinesFramebuffer.getColorAttachment());
    outlinesShader.bind();
    outlinesShader.set("u_Size", mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
    outlinesShader.set("u_Texture", 0);
    outlinesShader.set("u_Width", width);
    outlinesShader.set("u_FillOpacity", fillOpacity / 255.0);
    outlinesShader.set("u_ShapeMode", shapeMode.ordinal());
    PostProcessRenderer.render();
}
Also used : WorldRendererAccessor(mathax.client.mixin.WorldRendererAccessor) SimpleFramebuffer(net.minecraft.client.gl.SimpleFramebuffer) Framebuffer(net.minecraft.client.gl.Framebuffer) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Example 4 with WorldRenderer

use of net.minecraft.client.render.WorldRenderer in project tweakermore by Fallen-Breath.

the class FlawlessFramesHandler method installHook.

private static void installHook() {
    hook = null;
    Class<?> clazz = null;
    WorldRenderer worldRenderer = MinecraftClient.getInstance().worldRenderer;
    for (String hookClass : HOOK_CLASSES) {
        try {
            clazz = Class.forName(hookClass);
            break;
        } catch (ClassNotFoundException ignored) {
        }
    }
    if (clazz == null) {
        TweakerMoreMod.LOGGER.error("Failed to located replay flawless rendering hook, searched {}", HOOK_CLASSES);
        return;
    }
    try {
        hook = clazz.getConstructor(WorldRenderer.class).newInstance(worldRenderer);
    } catch (Exception e) {
        TweakerMoreMod.LOGGER.error("Failed to construct replay flawless rendering hook", e);
    }
}
Also used : WorldRenderer(net.minecraft.client.render.WorldRenderer)

Example 5 with WorldRenderer

use of net.minecraft.client.render.WorldRenderer in project meteor-client by MeteorDevelopment.

the class EntityShaders method renderOutlines.

public static void renderOutlines(Runnable draw, boolean entities, int width, float fillOpacity, ShapeMode shapeMode) {
    WorldRenderer worldRenderer = mc.worldRenderer;
    WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer;
    Framebuffer fbo = worldRenderer.getEntityOutlinesFramebuffer();
    if (entities)
        wra.setEntityOutlinesFramebuffer(outlinesFramebuffer);
    else {
        outlinesFramebuffer.clear(false);
        outlinesFramebuffer.beginWrite(false);
    }
    draw.run();
    if (entities)
        wra.setEntityOutlinesFramebuffer(fbo);
    mc.getFramebuffer().beginWrite(false);
    GL.bindTexture(outlinesFramebuffer.getColorAttachment());
    outlinesShader.bind();
    outlinesShader.set("u_Size", mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
    outlinesShader.set("u_Texture", 0);
    outlinesShader.set("u_Width", width);
    outlinesShader.set("u_FillOpacity", fillOpacity / 255.0);
    outlinesShader.set("u_ShapeMode", shapeMode.ordinal());
    PostProcessRenderer.render();
}
Also used : WorldRendererAccessor(meteordevelopment.meteorclient.mixin.WorldRendererAccessor) SimpleFramebuffer(net.minecraft.client.gl.SimpleFramebuffer) Framebuffer(net.minecraft.client.gl.Framebuffer) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Aggregations

WorldRenderer (net.minecraft.client.render.WorldRenderer)7 Framebuffer (net.minecraft.client.gl.Framebuffer)4 SimpleFramebuffer (net.minecraft.client.gl.SimpleFramebuffer)4 WorldRendererAccessor (mathax.client.mixin.WorldRendererAccessor)2 WorldRendererAccessor (meteordevelopment.meteorclient.mixin.WorldRendererAccessor)2 ClientWorld (net.minecraft.client.world.ClientWorld)2 GameProfile (com.mojang.authlib.GameProfile)1 IEClientPlayNetworkHandler (com.qouteall.immersive_portals.ducks.IEClientPlayNetworkHandler)1 IEClientWorld (com.qouteall.immersive_portals.ducks.IEClientWorld)1 ChatScreen (net.minecraft.client.gui.screen.ChatScreen)1 ClientPlayNetworkHandler (net.minecraft.client.network.ClientPlayNetworkHandler)1 ClientConnection (net.minecraft.network.ClientConnection)1 LevelInfo (net.minecraft.world.level.LevelInfo)1