PaperMC / PaperMC/Folia

Villager throws IllegalStateException: World mismatch when entering Nether Portal on Folia

Open
#431 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Shell
Stars
4.4k
Forks
623
PR merge metrics
No merged PRs in 30d

Description

Expected behavior

The Villager should safely teleport to the Nether, similar to other entities or players.

Observed/Actual behavior

The server throws an exception and the Villager fails to teleport:

Error Log
java.lang.IllegalStateException: World mismatch: expected world_nether but got world
at net.minecraft.world.level.Level.getCurrentWorldData(Level.java:830)
at net.minecraft.world.level.Level.getDayTime(Level.java:1914)
at net.minecraft.world.timeline.AttributeTrackSampler.applyTimeBased(AttributeTrackSampler.java:35)
at net.minecraft.world.attribute.EnvironmentAttributeSystem$ValueSampler.computeValueNotPositional(EnvironmentAttributeSystem.java:257)
at net.minecraft.world.attribute.EnvironmentAttributeSystem$ValueSampler.getDimensionValue(EnvironmentAttributeSystem.java:224)
at net.minecraft.world.attribute.EnvironmentAttributeSystem$ValueSampler.getValue(EnvironmentAttributeSystem.java:231)
at net.minecraft.world.attribute.EnvironmentAttributeSystem.getValue(EnvironmentAttributeSystem.java:117)
at net.minecraft.world.attribute.EnvironmentAttributeReader.getValue(EnvironmentAttributeReader.java:27)
at net.minecraft.world.entity.ai.Brain.updateActivityFromSchedule(Brain.java:313)
at net.minecraft.world.entity.npc.villager.Villager.registerBrainGoals(Villager.java:253)
at net.minecraft.world.entity.npc.villager.Villager.makeBrain(Villager.java:213)
at net.minecraft.world.entity.LivingEntity.(LivingEntity.java:326)
at net.minecraft.world.entity.Mob.(Mob.java:155)
at net.minecraft.world.entity.PathfinderMob.(PathfinderMob.java:17)
at net.minecraft.world.entity.AgeableMob.(AgeableMob.java:29)
at net.minecraft.world.entity.npc.villager.AbstractVillager.(AbstractVillager.java:49)
at net.minecraft.world.entity.npc.villager.Villager.(Villager.java:192)
at net.minecraft.world.entity.EntityType.create(EntityType.java:1523)
at net.minecraft.world.entity.Entity.transformForAsyncTeleport(Entity.java:4346)
at net.minecraft.world.entity.Entity.portalToAsync(Entity.java:4739)
at net.minecraft.world.entity.Entity.netherPortalLogicAsync(Entity.java:4491)
at net.minecraft.world.level.block.NetherPortalBlock.portalAsync(NetherPortalBlock.java:186)
at net.minecraft.world.entity.PortalProcessor.portalAsync(PortalProcessor.java:37)
at net.minecraft.world.entity.Entity.handlePortal(Entity.java:3524)
...

Steps/models to reproduce

Run a Folia server.
Create an Overworld (world) and Nether (world_nether).
Spawn a Villager in the Overworld.
Push the Villager into a Nether Portal.
Observe the server console.

Plugin and Datapack List

pl
[08:58:01 INFO]: ℹ Server Plugins (2):
[08:58:01 INFO]: Bukkit Plugins:
[08:58:01 INFO]: - ViaBackwards, ViaVersion

Folia version

Folia Version: 1.21.11 (build 1.21.11-10-1aa7055)

Other

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce on Folia 1.21.11 with a Villager entering a Nether Portal, then trace the async path through NetherPortalBlock.portalAsync, PortalProcessor.portalAsync, and Entity.portalToAsync. Compare the Villager construction in Entity.transformForAsyncTeleport with the World mismatch stack in Villager.makeBrain. Done means the Villager reaches world_nether without the IllegalStateException and the reproduction no longer logs the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.