Search in sources :

Example 1 with DimensionRenderHelper

use of com.qouteall.immersive_portals.render.DimensionRenderHelper in project ImmersivePortalsMod by qouteall.

the class ClientWorldLoader method initializeIfNeeded.

private void initializeIfNeeded() {
    if (!isInitialized) {
        assert (mc.world != null);
        assert (mc.worldRenderer != null);
        DimensionType playerDimension = mc.world.getDimension().getType();
        clientWorldMap.put(playerDimension, mc.world);
        worldRendererMap.put(playerDimension, mc.worldRenderer);
        renderHelperMap.put(mc.world.dimension.getType(), new DimensionRenderHelper(mc.world));
        isHardCore = mc.world.getLevelProperties().isHardcore();
        isInitialized = true;
    }
}
Also used : DimensionType(net.minecraft.world.dimension.DimensionType) DimensionRenderHelper(com.qouteall.immersive_portals.render.DimensionRenderHelper)

Example 2 with DimensionRenderHelper

use of com.qouteall.immersive_portals.render.DimensionRenderHelper in project ImmersivePortalsMod by qouteall.

the class ClientWorldLoader method getDimensionRenderHelper.

public DimensionRenderHelper getDimensionRenderHelper(DimensionType dimension) {
    initializeIfNeeded();
    DimensionRenderHelper result = renderHelperMap.computeIfAbsent(dimension, dimensionType -> {
        return new DimensionRenderHelper(getOrCreateFakedWorld(dimension));
    });
    assert result.world.dimension.getType() == dimension;
    return result;
}
Also used : DimensionRenderHelper(com.qouteall.immersive_portals.render.DimensionRenderHelper)

Example 3 with DimensionRenderHelper

use of com.qouteall.immersive_portals.render.DimensionRenderHelper in project ImmersivePortalsMod by qouteall.

the class MyCommandClient method reportFogColor.

private static int reportFogColor(CommandContext<ServerCommandSource> context) {
    MinecraftClient.getInstance().execute(() -> {
        StringBuilder str = new StringBuilder();
        CGlobal.clientWorldLoader.clientWorldMap.values().forEach(world -> {
            DimensionRenderHelper helper = CGlobal.clientWorldLoader.getDimensionRenderHelper(world.dimension.getType());
            str.append(String.format("%s %s %s %s\n", world.dimension.getType(), helper.fogRenderer, helper.getFogColor(), ((IEBackgroundRenderer) helper.fogRenderer).getDimensionConstraint()));
        });
        BackgroundRenderer currentFogRenderer = ((IEGameRenderer) MinecraftClient.getInstance().gameRenderer).getBackgroundRenderer();
        str.append(String.format("current: %s %s \n switched %s \n", currentFogRenderer, ((IEBackgroundRenderer) currentFogRenderer).getDimensionConstraint(), CGlobal.switchedFogRenderer));
        String result = str.toString();
        Helper.log(str);
        McHelper.getServer().execute(() -> {
            try {
                context.getSource().getPlayer().sendMessage(new LiteralText(result));
            } catch (CommandSyntaxException e) {
                e.printStackTrace();
            }
        });
    });
    return 0;
}
Also used : DimensionRenderHelper(com.qouteall.immersive_portals.render.DimensionRenderHelper) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) BackgroundRenderer(net.minecraft.client.render.BackgroundRenderer) LiteralText(net.minecraft.text.LiteralText)

Aggregations

DimensionRenderHelper (com.qouteall.immersive_portals.render.DimensionRenderHelper)3 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 BackgroundRenderer (net.minecraft.client.render.BackgroundRenderer)1 LiteralText (net.minecraft.text.LiteralText)1 DimensionType (net.minecraft.world.dimension.DimensionType)1