MagicStorage icon indicating copy to clipboard operation
MagicStorage copied to clipboard

Items being voided from storage component.

Open Renari opened this issue 3 years ago • 10 comments

After breaking the storage heart and moving it from the bottom of a storage component to the right side of the storage component all items inside that storage component are deleted. I was able to kill the server before this saved and was then able to replicate the issue afterwards.

System.InvalidCastException: Unable to cast object of type 'Terraria.GameContent.Tile_Entities.TETeleportationPylon' to type 'MagicStorage.Components.TEStorageUnit'.
   at MagicStorage.NetHelper.ServerReciveSyncStorageUnit(BinaryReader reader, Int32 remoteClient) in MagicStorage\NetHelper.cs:line 97
   at Terraria.ModLoader.ModNet.HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length) in tModLoader\Terraria\ModLoader\ModNet.cs:line 429
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType) in tModLoader\Terraria\MessageBuffer.cs:line 3575
   at DMD<Terraria.NetMessage::CheckBytes>(Int32 bufferIndex)
   at Terraria.Netplay.UpdateServerInMainThread() in tModLoader\Terraria\Netplay.cs:line 64
   at Terraria.Main.DoUpdate(GameTime& gameTime) in tModLoader\Terraria\Main.cs:line 12729
   at Terraria.Main.Update(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 12618
   at DMD<Terraria.Main::DedServ_PostModLoad>(Main this, Boolean& reloadMods)
   at Terraria.Main.DedServ() in tModLoader\Terraria\Main.cs:line 4144
   at Terraria.Program.LaunchGame_(Boolean isServer) in tModLoader\Terraria\Program.cs:line 231
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs) in tModLoader\Terraria\Program.cs:line 194
   at MonoLaunch.<>c__DisplayClass2_0.<Main>b__0() in tModLoader\Terraria\MonoLaunch.cs:line 65
   at System.Threading.Thread.StartCallback()

https://user-images.githubusercontent.com/1839179/176888851-75b6e74c-d9c6-47c3-b048-8ce96b28c7fb.mp4

Renari avatar Jul 01 '22 11:07 Renari

Is there a teleport pylon nearby?

ExterminatorX99 avatar Jul 01 '22 12:07 ExterminatorX99

There is not, there is only one pylon in the world and it is near the ocean (about as far away as it could possibly be).

Renari avatar Jul 01 '22 12:07 Renari

Does this happen in single player?

ExterminatorX99 avatar Jul 01 '22 19:07 ExterminatorX99

Does not appear to happen in single player.

Renari avatar Jul 01 '22 20:07 Renari

Does it happen with only Magic Storage enabled?

ExterminatorX99 avatar Jul 01 '22 21:07 ExterminatorX99

I was able to replicate it in the same world after turning off all other mods, there were however some drawing issues where almost all tiles were not drawing, including the magic storage blocks (I was able to move it without seeing it though).

Renari avatar Jul 01 '22 21:07 Renari

Does it happen in a new world with only magic storage? Cheat sheet and hero mod are fine to use

ExterminatorX99 avatar Jul 02 '22 08:07 ExterminatorX99

Yes it's reproducible in a world with just magic storage, hero's mod and cheat sheet.

Steps to reproduce:

  • Place down storage heart
  • Place Storage unit on top of storage heart
  • Fill storage unit
  • Upgrade storage unit to demonite
  • Fill storage unit
  • Mine storage heart and move it to the right side of the storage unit
  • Items are deleted from storage unit

The stack trace did change, but the result was the same:

System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at MagicStorage.NetHelper.ServerReciveSyncStorageUnit(BinaryReader reader, Int32 remoteClient) in MagicStorage\NetHelper.cs:line 97
   at Terraria.ModLoader.ModNet.HandleModPacket(BinaryReader reader, Int32 whoAmI, Int32 length) in tModLoader\Terraria\ModLoader\ModNet.cs:line 433
   at Terraria.MessageBuffer.GetData(Int32 start, Int32 length, Int32& messageType) in tModLoader\Terraria\MessageBuffer.cs:line 3575
   at Terraria.NetMessage.CheckBytes(Int32 bufferIndex) in tModLoader\Terraria\NetMessage.cs:line 2202
   at Terraria.Netplay.UpdateServerInMainThread() in tModLoader\Terraria\Netplay.cs:line 64
   at Terraria.Main.DoUpdate(GameTime& gameTime) in tModLoader\Terraria\Main.cs:line 12742
   at Terraria.Main.Update(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 12631
   at Terraria.Main.DedServ_PostModLoad(Boolean& reloadMods) in tModLoader\Terraria\Main.cs:line 4620
   at Terraria.Main.DedServ() in tModLoader\Terraria\Main.cs:line 4156
   at Terraria.Program.LaunchGame_(Boolean isServer) in tModLoader\Terraria\Program.cs:line 236
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs) in tModLoader\Terraria\Program.cs:line 195
   at MonoLaunch.<>c__DisplayClass2_0.<Main>b__0() in tModLoader\Terraria\MonoLaunch.cs:line 65
   at System.Threading.Thread.StartCallback()

Renari avatar Jul 02 '22 11:07 Renari

this is so bizarre

the NetHelper.ServerReciveSyncStorageUnit() method only gets used by packets sent using MessageType.SyncStorageUnit... which are only sent from TEStorageUnit.NetReceive()

meaning it should be impossible for the assigned tile entity ID to be sent from a storage unit, but then end up as some other tile entity (or not even in the world in the case for the second stacktrace posted)

absoluteAquarian avatar Jul 05 '22 08:07 absoluteAquarian

actually just a reboot of the server with the heart of magic storage in a right place 'returns' all of the items back and fixes a problem

Illatior avatar Jul 06 '22 20:07 Illatior