use of net.minecraft.world.level.LevelInfo 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;
}
Aggregations