Create Fabric

Create Fabric

7M Downloads

Item on belt got duplicated when processed by a deployer

KeithTsao opened this issue · 1 comments

commented

Describe the Bug

image
The item splits when got processed by a deployer. One stays and waits for the next deploying, and the other copy moves on. The screenshot just shows the structure of the test, for i cannot capture the right time it duplicates.

Reproduction Steps

  1. Use item_duplicator.zip or build the structure in the screenshot above. The upper motor is at 256RPM and the lower is at -128RPM.
  2. Put x gold ingots into the left barrel. x should be larger than 1, but larger x will increase the probability of reproduction.
  3. Wait until there is no item on the belt, check the number of the items in the right barrel.

Expected Result

The number of the items in the right barrel is usually larger than x, but should be strictly equal to x. The screenshot shows the result of one run of the test. The bug rarely occurs when x is 2, but not never.
image

Screenshots and Videos

No response

Crash Report or Log

No response

Operating System

Windows 11

Mod Version

0.5.0i

Minecraft Version

1.18.2

Other Mods

fabric-api-0.76.0

This bug would occur with or without sodium and indium.

Additional Context

No response

commented

This was hell to fix.
When a belt applies processing, all added and removed items are collected, and these changes are applied next tick.
Between ticks, items could be transferred out of the belt, which is bad on its own. But if transfer is simulated or cancelled, that would result in the whole item list being copied. Since TransportedItemStack had no equals() impl, an item marked as toRemove would no longer be recognized.