Create Fabric

Create Fabric

11M Downloads

Some blocks disappear after disassembling the train

yamitaso opened this issue ยท 7 comments

commented

Describe the Bug

When dismantling the train, some blocks in the front part of the train disappear. At the same time, an error appears in the server console (the log was sent to pastebin).

Reproduction Steps

  1. Disassemble the train at the station
  2. Some blocks disappear

Expected Result

Blocks do not disappear

Screenshots and Videos

No response

Crash Report or Log

https://pastebin.com/JzEcXHpt

Operating System

Debian Linux (Server)

Mod Version

0.5.1c

Minecraft Version

1.19.2

Other Mods

- audioplayer 1.19.2-1.8.1
- automobility 0.4.2+1.19.2-fabric
- badpackets 0.2.2
- cardinal-components 5.0.2
- cloth-config 8.3.103
- collective 6.66
- create 0.5.1-c-build.1160+mc1.19.2
- dawn 3.5.0
- dcintegration-fabric 3.0.2
- doubledoors 5.0
- editsign 2.6.0
- emi 1.0.20+1.19.2+fabric
- exlinefurniture 2.3.2
- expandeddelight 0.2.5
- expandedstorage 8.3.4
- fabric-api 0.76.1+1.19.2
- fabric-language-kotlin 1.10.10+kotlin.1.9.10
- fabricloader 0.14.22
- farmersdelight 1.19.2-1.3.10.1
- ferritecore 5.0.3
- fusion 1.0.6
- jei 11.6.0.1018
- krypton 0.2.1
- lithium 0.11.1
- memoryleakfix 1.1.2
- minimotd-fabric 2.0.9
- mob_captains_mr 1-v2.1.2
- openpartiesandclaims 0.19.3
- pfm 1.1.1
- ping-wheel 1.5.1
- promenade 2.7.1
- railways 1.5.1+fabric-mc1.19.2
- rechiseled 1.1.4+a
- rechiseledcreate 1.0.0
- servercore 1.3.3-1.19.2
- sliceanddice 2.3.2
- sound_physics_remastered 1.19.2-1.2.1
- supermartijn642configlib 1.1.8
- supermartijn642corelib 1.1.13
- tawct 1.4.3+1.19.2
- travelersbackpack 1.19.2-8.2.28
- universal-graves 2.1.3+1.19.2
- voicechat 1.19.2-2.4.25
- wthit 5.19.0
- xaerominimap 23.8.2
- xaeroworldmap 1.34.1

Additional Context

No response

commented

As I understand it, the problem only appears when using storage from other mods on the train, for example chests from the Expanded Storage mod. If you use standard minecraft chests, everything works as it should.

commented

As I understand it, the problem only appears when using storage from other mods on the train, for example chests from the Expanded Storage mod. If you use standard minecraft chests, everything works as it should.

Nah, it happens with standard chests and barrels. The bug comes from using shift+click to remove things from chests/barrels before disassembly. I have submitted a PR to fix this bug here though that fix is for 1.20, no fix for 1.19 yet.

commented

Can confirm this still happens with 1.20 v0.5.1d

commented

Related bugs: #1038 #1080

commented

Found steps to reproduce, inspired by: #1080 (comment)

  1. Create a minimal train with a barrel glued on
  2. Fill the barrel with a block
  3. Assemble the train
  4. While the train is assembled, open a barrel and shift+click to remove stacks of items from the barrel
  5. disassemble the train

Edit:
Confirmed similar issue (server crash) happens with a single barrel attached to mechanical sticky piston (items where "removed" from barrel using via shift+click while piston was fully extended in "only place in starting position" mode)

Edit 2:
Tested chests with piston setup, crash stacktrace is slightly different

java.lang.IllegalArgumentException: Transfer variant may not be blank.
	at net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions.notBlank(StoragePreconditions.java:39)
	at net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions.notBlankNotNegative(StoragePreconditions.java:58)
	at net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage.extract(SingleStackStorage.java:136)
	at net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage.extract(SingleStackStorage.java:42)
	at io.github.fabricators_of_create.porting_lib.transfer.TransferUtil.clearStorage(TransferUtil.java:343)
	at com.simibubi.create.content.contraptions.MountedStorageManager.clear(MountedStorageManager.java:189)
	at com.simibubi.create.content.contraptions.Contraption.addBlocksToWorld(Contraption.java:1132)
[truncated]

Edit 3:
Confirm that this issue exists even if there's only 1 item in the barrel when it is removed via shift+clicking while in a contraption. Also confirmed the issue does NOT happen when inserting items via shift+click

Edit 4:
Issues does not happen if the world is saved + reloaded after shift+clicking removal while the contraption is an entity. Suggesting that the NBT data is still always correct. (viewing the world in NBTExplorer confirmed that things are apparently sane after shift+click removal)

Edit 5:
Speculation: io.github.fabricators_of_create.porting_lib.transfer.item.ItemStackHandler does not properly handle shift+clicking, will probably have to see what methods it's supposed to override later.

commented

Discovery: io.github.fabricators_of_create.porting_lib.transfer.item.ItemStackHandler.onStackChange only gets called with oldStack: "0 air", newStack: "0 air" during shift+clicking removal. The assumption that the oldStack contains the previous block does not apply.

commented

duplicate of #1080