package protocolsupport.protocol.packet.middle.clientbound.play;

import protocolsupport.api.tab.TabAPI;
import protocolsupport.protocol.packet.middle.ClientBoundMiddlePacket;
import protocolsupport.protocol.serializer.PacketDataSerializer;
import protocolsupport.protocol.typeremapper.watchedentity.types.WatchedPlayer;

public abstract class MiddleLogin<T> extends ClientBoundMiddlePacket<T> {

	protected int playerEntityId;
	protected int gamemode;
	protected int dimension;
	protected int difficulty;
	protected int maxplayers;
	protected String leveltype;
	protected boolean reducedDebugInfo;

	@Override
	public void readFromServerData(PacketDataSerializer serializer) {
		playerEntityId = serializer.readInt();
		gamemode = serializer.readByte();
		dimension = serializer.readByte();
		difficulty = serializer.readByte();
		serializer.readByte();
		maxplayers = TabAPI.getMaxTabSize();
		leveltype = serializer.readString(16);
		reducedDebugInfo = serializer.readBoolean();
	}

	@Override
	public void handle() {
		storage.addWatchedSelfPlayer(new WatchedPlayer(playerEntityId));
		storage.setDimensionId(dimension);
	}

}

package protocolsupport.protocol.packet.middle.clientbound.play;

import protocolsupport.api.tab.TabAPI;
import protocolsupport.protocol.packet.middle.ClientBoundMiddlePacket;
import protocolsupport.protocol.serializer.PacketDataSerializer;
import protocolsupport.protocol.typeremapper.watchedentity.types.WatchedPlayer;

public abstract class MiddleLogin<T> extends ClientBoundMiddlePacket<T> {

	protected int playerEntityId;
	protected int gamemode;
	protected int dimension;
	protected int difficulty;
	protected int maxplayers;
	protected String leveltype;
	protected boolean reducedDebugInfo;

	@Override
	public void readFromServerData(PacketDataSerializer serializer) {
		playerEntityId = serializer.readInt();
		gamemode = serializer.readByte();
		dimension = serializer.readInt();
		difficulty = serializer.readByte();
		serializer.readByte();
		maxplayers = TabAPI.getMaxTabSize();
		leveltype = serializer.readString(16);
		reducedDebugInfo = serializer.readBoolean();
	}

	@Override
	public void handle() {
		storage.addWatchedSelfPlayer(new WatchedPlayer(playerEntityId));
		storage.setDimensionId(dimension);
	}

}

Fix dimension id read from login packet. This was working only because of pure luck, but that explains problems with players logging in non in overworld dimension.