public final void setLevel(Level var1) {
		if(this.applet == null || !this.applet.getDocumentBase().getHost().equalsIgnoreCase("minecraft.net") && !this.applet.getDocumentBase().getHost().equalsIgnoreCase("www.minecraft.net") || !this.applet.getCodeBase().getHost().equalsIgnoreCase("minecraft.net") && !this.applet.getCodeBase().getHost().equalsIgnoreCase("www.minecraft.net")) {
			var1 = null;
		}

		this.level = var1;
		if(var1 != null) {
			var1.initTransient();
			this.gamemode.apply(var1);
			var1.font = this.fontRenderer;
			var1.rendererContext$5cd64a7f = this;
			if(!this.isOnline()) {
				this.player = (Player)var1.findSubclassOf(Player.class);
			} else if(this.player != null) {
				this.player.resetPos();
				this.gamemode.preparePlayer(this.player);
				if(var1 != null) {
					var1.player = this.player;
					var1.addEntity(this.player);
				}
			}
		}

		if(this.player == null) {
			this.player = new Player(var1);
			this.player.resetPos();
			this.gamemode.preparePlayer(this.player);
			if(var1 != null) {
				var1.player = this.player;
			}
		}

		if(this.player != null) {
			this.player.input = new InputHandlerImpl(this.settings);
			this.gamemode.apply(this.player);
		}

		if(this.levelRenderer != null) {
			LevelRenderer var3 = this.levelRenderer;
			if(this.levelRenderer.level != null) {
				var3.level.removeListener(var3);
			}

			var3.level = var1;
			if(var1 != null) {
				var1.addListener(var3);
				var3.refresh();
			}
		}

		if(this.particleManager != null) {
			ParticleManager var5 = this.particleManager;
			if(var1 != null) {
				var1.particleEngine = var5;
			}

			for(int var4 = 0; var4 < 2; ++var4) {
				var5.particles[var4].clear();
			}
		}

		System.gc();
	}