Skip to content

NullPointerException in RegionDataManager when teleporting to dynamically created dimensions #190

@spexce

Description

@spexce

Used Minecraft Version

1.21.1

Used Modloader

NeoForge

Modloader Version

21.1.219

Bug Description

YAWP Version: 0.6.2-beta1

When using the Multiworld mod to create dimensions at runtime (e.g. multiworld:nether2), attempting to teleport to the new dimension causes a NullPointerException in YAWP's EntityTravelToDimensionEvent handler. The teleport is completely blocked.

Stack Trace
java.lang.NullPointerException: Cannot invoke "de.z0rdak.yawp.data.region.LevelRegionData.getLocalList()" because the return value of "de.z0rdak.yawp.data.region.RegionDataManager.getOrCreate(net.minecraft.resources.ResourceLocation)" is null
at de.z0rdak.yawp.data.region.RegionDataManager.getLocalsFor(RegionDataManager.java:298)
at de.z0rdak.yawp.api.FlagEvaluator.getInvolvedRegionsFor(FlagEvaluator.java:228)
at de.z0rdak.yawp.api.FlagEvaluator.getInvolvedRegionFor(FlagEvaluator.java:244)
at de.z0rdak.yawp.api.FlagEvaluator.findResponsibleRegion(FlagEvaluator.java:207)
at de.z0rdak.yawp.api.FlagEvaluator.evaluate(FlagEvaluator.java:146)
at de.z0rdak.yawp.api.FlagEvaluator.processCheck(FlagEvaluator.java:75)
at de.z0rdak.yawp.api.FlagEvaluator.processCheck(FlagEvaluator.java:111)
at de.z0rdak.yawp.handler.flags.WorldFlagHandler.onTravelToDim(WorldFlagHandler.java:175)

Cause
RegionDataManager.getOrCreate() returns null for dimensions that were created at runtime (via the Fantasy API / Multiworld mod), since YAWP never initialized region data for them. The code then calls .getLocalList() on the null result without a null check.

Steps To Reproduce

Steps to Reproduce

  1. Install YAWP + Multiworld mod on NeoForge 1.21.1
  2. Start server
  3. Run /mw create nether2 NETHER
  4. Run /mw tp nether2
  5. Teleport fails with the above NPE

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions