Ars Additions

Ars Additions

6M Downloads

Handy Haversack does not function across dimensions in 1.20.1 and 1.21.1

Closed this issue · 2 comments

commented

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

  1. Place a chest
  2. Execute the command /forceload add ~ ~ while standing in the same chunk as the chest
  3. Link a Handy Haversack to the chest
  4. 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
commented

Tracing the call stack in 1.21.1 reveals a library bug:

  • The ItemHandler in HandyHaversack.transportItem() was null
  • The linked inventory's position was not loaded in HaversackData.getItemHandler()
  • The linked inventory's position (y=-60) was not within the build height in net.minecraft.world.level.Level.isLoaded()
  • The build height limit as defined by net.minecraft.world.level.LevelHeightAccessor.getMaxBuildHeight and getMinBuildHeight was [0, 256]

However, moving the linked inventory into the pre-Caves & Cliffs height range did not solve the problem:

  • The BlockEntity was null in HaversackData.getItemHandler()
  • net.minecraft.world.level.chunk.LevelChunk.getBlockEntity() returned null 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.

commented

Fixed in latest 1.21 build, I plan to eventually backport all the fixes to 1.20 for a final update, but I don't have the time currently.

I do appreciate the thorough bug report