use of net.minecraft.client.MinecraftClient in project BedrockIfy by juancarloscp52.
the class LoadingScreenWidget method render.
/**
* Renders the bedrockify loading screen.
* @param matrices Current MatrixStack.
* @param width window width
* @param height window height
* @param title Title of the loading screen.
* @param message Message of the loading screen. Set to null to use a random tip.
* @param progress Loading screen progress. Set to -1 is the screen has no progress bar.
*/
public void render(MatrixStack matrices, int width, int height, Text title, Text message, int progress) {
// If the background cube map is disabled for other screens, manually render the cube map for the loading screen.
if (!Bedrockify.getInstance().settings.isCubemapBackgroundEnabled())
BedrockifyRotatingCubeMapRenderer.getInstance().render();
MinecraftClient client = MinecraftClient.getInstance();
renderLogo(matrices, width, height, client);
renderLoadingWidget(matrices, width, height, client);
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
textRenderer.draw(matrices, title, width - textRenderer.getWidth(title) / 2.0f, height - 9.0f / 2.0f - 32, 76 + (76 << 8) + (76 << 16));
renderTextBody(matrices, width, height, message, textRenderer);
if (progress >= 0) {
renderLoadingBar(matrices, client, width, height, progress);
}
}
use of net.minecraft.client.MinecraftClient in project ImmersivePortalsMod by qouteall.
the class MyNetworkClient method processRedirectedPacket.
private static void processRedirectedPacket(DimensionType dimension, Packet packet) {
MinecraftClient mc = MinecraftClient.getInstance();
mc.execute(() -> {
ClientWorld packetWorld = CGlobal.clientWorldLoader.getOrCreateFakedWorld(dimension);
assert packetWorld != null;
assert packetWorld.getChunkManager() instanceof MyClientChunkManager;
ClientPlayNetworkHandler netHandler = ((IEClientWorld) packetWorld).getNetHandler();
if ((netHandler).getWorld() != packetWorld) {
((IEClientPlayNetworkHandler) netHandler).setWorld(packetWorld);
Helper.err("The world field of client net handler is wrong");
}
ClientWorld originalWorld = mc.world;
// some packet handling may use mc.world so switch it
mc.world = packetWorld;
try {
packet.apply(netHandler);
} catch (Throwable e) {
throw new IllegalStateException("handling packet in " + dimension, e);
} finally {
mc.world = originalWorld;
}
});
}
use of net.minecraft.client.MinecraftClient in project ImmersivePortalsMod by qouteall.
the class MyRenderHelper method setupCameraTransformation.
public static void setupCameraTransformation() {
MinecraftClient mc = MinecraftClient.getInstance();
// rendering post processing shader may change view port
if (OFInterface.isShaders.getAsBoolean()) {
// Shaders.setViewport(0, 0, mc.window.getFramebufferWidth(), mc.window.getFramebufferHeight());
} else {
GlStateManager.viewport(0, 0, mc.window.getFramebufferWidth(), mc.window.getFramebufferHeight());
}
((IEGameRenderer) PortalRenderer.mc.gameRenderer).applyCameraTransformations_(partialTicks);
Camera camera = PortalRenderer.mc.gameRenderer.getCamera();
camera.update(PortalRenderer.mc.world, (Entity) (PortalRenderer.mc.getCameraEntity() == null ? PortalRenderer.mc.player : PortalRenderer.mc.getCameraEntity()), PortalRenderer.mc.options.perspective > 0, PortalRenderer.mc.options.perspective == 2, partialTicks);
}
use of net.minecraft.client.MinecraftClient in project ImmersivePortalsMod by qouteall.
the class MyRenderHelper method onTotalRenderEnd.
public static void onTotalRenderEnd() {
MinecraftClient mc = MinecraftClient.getInstance();
CGlobal.clientWorldLoader.getDimensionRenderHelper(mc.world.dimension.getType()).switchToMe();
if (getRenderedPortalNum() != 0) {
// recover chunk renderer dispatcher
((IEWorldRenderer) mc.worldRenderer).getChunkRenderDispatcher().updateCameraPosition(mc.cameraEntity.x, mc.cameraEntity.z);
}
Vec3d currCameraPos = mc.gameRenderer.getCamera().getPos();
cameraPosDelta = currCameraPos.subtract(lastCameraPos);
if (cameraPosDelta.lengthSquared() > 1) {
cameraPosDelta = Vec3d.ZERO;
}
lastCameraPos = currCameraPos;
}
use of net.minecraft.client.MinecraftClient in project ImmersivePortalsMod by qouteall.
the class MOShaders method onInit.
// @Redirect(
// method = "loadShaderPack",
// at = @At(
// value = "INVOKE",
// target = "Lnet/minecraft/client/MinecraftClient;reloadResourcesConcurrently()Ljava/util/concurrent/CompletableFuture;"
// )
// )
// private static CompletableFuture<Void> redirectReloadResource(MinecraftClient minecraftClient) {
// if (!OFGlobal.shaderContextManager.isContextSwitched()) {
// return minecraftClient.reloadResourcesConcurrently();
// }
// else {
// return null;
// }
// }
@Inject(method = "init", at = @At("HEAD"))
private static void onInit(CallbackInfo ci) {
MinecraftClient mc = MinecraftClient.getInstance();
DimensionType currDimension = mc.world.dimension.getType();
Helper.log("Shader init " + currDimension);
}
Aggregations