
Handy Haversack does not function across dimensions in 1.20.1 and 1.21.1
Closed this issue · 2 comments
Issue Description
The Handy Haversack functions normally while in the same dimension as a linked inventory in a loaded chunk. However, upon leaving this dimension, the bag sprite closes and it ceases to function until returning to the inventory's dimension, despite being chunkloaded. It is worthy of note that this bug is also present in 1.21.1.
Reproduction Steps
- Place a chest
- Execute the command
/forceload add ~ ~
while standing in the same chunk as the chest - Link a Handy Haversack to the chest
- Use a Nether Portal to leave the Overworld dimension
Expected Behavior
In the Ars Additions changelog, the Handy Haversack is described as:
a one-way cross-dimension item-depositor.
Version Info
Minecraft Client
- Minecraft 1.20.1
Mod Loader
- NeoForge 47.1.106
Mod List
- Ars Additions 1.20.1-1.6.7
- Ars Nouveau 4.9.0
- Curios API 5.12.1+1.20.1
- Patchouli 1.20.1-84.1-FORGE
- GeckoLib 1.20.1-4.7.1.2
Tracing the call stack in 1.21.1 reveals a library bug:
- The
ItemHandler
inHandyHaversack.transportItem()
wasnull
- The linked inventory's position was not loaded in
HaversackData.getItemHandler()
- The linked inventory's position (
y=-60
) was not within the build height innet.minecraft.world.level.Level.isLoaded()
- The build height limit as defined by
net.minecraft.world.level.LevelHeightAccessor.getMaxBuildHeight
andgetMinBuildHeight
was[0, 256]
However, moving the linked inventory into the pre-Caves & Cliffs height range did not solve the problem:
- The
BlockEntity
wasnull
inHaversackData.getItemHandler()
net.minecraft.world.level.chunk.LevelChunk.getBlockEntity()
returnednull
for the linked inventory's position
After a bit more digging, it looks like the problem is the use of player.level()
in HandyHaversack.transportItem()
. The ItemHandler
is checking in the player's current dimension for the linked inventory, which means it will only locate the inventory if it and the player are in the same dimension.