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;
}
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();
}
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();
}
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);
}
}
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();
}
Aggregations