Antique Atlas

Antique Atlas

32M Downloads

Invalid code detected causes server crashing

Pangamma opened this issue ยท 2 comments

commented

For now I fixed it on my own server by recompiling the code so it avoids the logging statement.
The real cause of the issue is that you are trying to get a DimensionType by the ID of a dimension. The dimension ID does not necessarily match up to a DimensionType ID. So when you get into multiple worlds it becomes an issue. Anyways. That is my theory. I would submit the fix myself, but my IDE is total garbage and is providing me with zero autocomplete right now. The code below is what we crammed into the server and it is working for now.

	@Override
	public void onEntityRemoved(Entity entity) {
		if (entity instanceof EntityPlayerMP) {
			EntityPlayerMP player = (EntityPlayerMP) entity;
			if (isEntityInPortal(entity)) {
				Log.info("Exiting");
				// player.worldObj.provider.dimensionId is the dimension of origin
				int originDimension = player.getEntityWorld().provider.getDimension();
				switch (originDimension){
					case -1:
					case 1:
					case 0:
					case 111:
						Log.info("Player %s left the %s", player.getGameProfile().getName(),
								DimensionType.getById(originDimension).getName());
						teleportingPlayersOrigin.put(entity.getEntityId(), originDimension);
						// TODO Check what is the target dimension
						addPortalMarkerIfNone(player, originDimension);
						break;
					default:
						// Lol fuck that
						teleportingPlayersOrigin.put(entity.getEntityId(), originDimension);
						// TODO Check what is the target dimension
						addPortalMarkerIfNone(player, originDimension);
						break;
				}
			}
		}
	}

Time: 6/10/20 2:00 AM
Description: Exception in server tick loop

java.lang.IllegalArgumentException: Invalid dimension id 13
at net.minecraft.world.DimensionType.func_186069_a(DimensionType.java:77)
at hunternif.mc.atlas.marker.NetherPortalWatcher.func_72709_b(NetherPortalWatcher.java:97)
at net.minecraft.world.World.func_72847_b(World.java:1231)
at net.minecraft.world.WorldServer.func_72847_b(WorldServer.java:1128)
at net.minecraft.world.World.func_72900_e(World.java:1254)
at net.minecraft.server.management.PlayerList.func_72367_e(PlayerList.java:413)
at net.minecraft.network.NetHandlerPlayServer.func_147231_a(NetHandlerPlayServer.java:853)
at net.minecraft.network.NetworkManager.func_179293_l(NetworkManager.java:453)
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:213)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:790)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:748)

commented

Same problem

commented

There won't be another 1.12 update, so I'm closing this.