McJtyMods / XNet

Advanced item/liquid/energy/... networking
MIT License
91 stars 49 forks source link

Insert on color not working when channel is connected through routers #531

Open TheProffessor opened 1 year ago

TheProffessor commented 1 year ago

Issue description: When using insert with any type of channel (item, fluid, or gas), if the input to extract is on a separate network, despite being correctly connected through a router, the item/fluid/gas will not be inserted when that color is active. It is only inserted when there are no color filters on the insert GUI. Insertion by color does work when the item/fluid/gas storage is on the same exact network, only when the input source is routed does it not work. Extract on color does work both locally and routed.

Steps to reproduce (using items as example, but the same holds true for liquids and gasses): Phase 1 (initial setup):

  1. Create 2-network setup: Controller A <-> Router A <-> Router B <-> Controller B
  2. Run power accordingly (I used channel 1 for power routing and shared between networks after initial powerup)
  3. Configure Item channels on both networks and route using published channel name (I used "Item In" on network A and "Item Out" on network B, both linked under Published name "ITEM")
  4. Add 1 chest to Network A, 2 chests to network B
  5. Configure chest on network A to extract
  6. Configure both chests on network B to insert, leaving chest 1 "enable on color" blank, set color for chest 2 to white
  7. Test; Items from chest on network A should start moving to B, this is functioning correctly
  8. Temporarily either disable Network B chest 1 insert or set to redstone high to prevent filling for next phase

Phase 2 (introducing the color variable):

  1. Add a lever to any connector on Network B and add a new logic channel
  2. Configure lever logic: "Rs !=0 -> white color"
  3. Test; with switch in the on position, the white color is enabled; this should begin inserting the blocks from the chest on network A into chest 2 on network B, but this does not work

Phase 3 (introducing a local color-enabled path):

  1. Add a second Item channel on controller B; this will not be routed to network A
  2. Configure chest 1 on the new item channel for extract, leave color as-is, and configure chest 2 for insert, change "active on color" to white
  3. on the original item channel on network B, re-enable insert into chest 1; this should resume transfer of items from the chest on network A to chest 1 of network B
  4. (optional) allow all items to transfer from network A chest to chest 1 of network B; the next test will succeed regardless if there are still items being transferred or not
  5. Test; with switch in the on position, the white color is enabled; this should begin transferring the items from chest 1 to chest 2, both on network B; network A is not involved with this transfer; this does indeed work as intended

Phase 4:

  1. disable the local transfer channel on network B
  2. re-transfer the items from any of the 3 chests back to the chest on network A
  3. with the switch in the on position, note same lack of transfer as in Phase 2 test
  4. keeping lever on, remove the "active on color" setting from chest 2 insert on network B
  5. Test; with the insert color disabled, the items will begin transferring directly from the chest on network A to chest 2 of network B (insert into chest 1 of network B is still disabled from end of phase 1)

Note that between the tests, the successful test in phase 3 proves that the color is being activated correctly within network B, and the extract/insert pair of connections works correctly. The unsuccessful test of phase 2 and the successful test in phase 4 shows the issue that items will not insert under any circumstances unless the color property is disabled entirely.

Because of this, any items being transferred between networks over a router will require an entire duplicate set of inventories on each and every network that the items are selectively sent to (using the levers); items cannot be selectively routed between networks as intended. This unfortunately defeats the purpose of using Xnet for a means to distribute items/fluids/gasses from a storage area to different machines in different combinations (as selected by the levers).

Optional Phase 5 (proving that there is no issue with extract on color):

  1. on the switch sensor for network B, add a second logic line: "Rs =0 -> purple color"
  2. add a new item channel to both controllers (I name backflowing channels "Item Recall" since it removes items currently already inserted into running machines to reset for the next recipe selection)
  3. Route channels in router
  4. On this new channel, configure chest 2 on network B to extract on color purple, and chest on network A to insert, leaving color blank
  5. with the switch in the on position, manually transfer items into chest 2 of network B
  6. Test; with switch in the off position, items should extract backwards from chest 2 of network B into the chest on network A; this works correctly

This phase proves that routing of triggered extractions in the reverse direction does work correctly, only "active on color" inserts are bugged.

Versions:

Possibly incompatible mods and versions: none known; no optifine installed

Relevant logs, if any: N/A (not sure how to produce logs as of yet)

Images attached:

  1. Basic layout of test area 1
  2. GUI of Controller A
    • (including optional phase 5)
    • Controller A channels: 1: Power; 2: Item In (sending to network B); 3: Item recall (pulling back from network B)
    • Currently selected element: Chest extract 2
  3. GUI of Controller B
    • (including optional phase 5)
    • Controller B channels: 1: Power; 2: Item Out (receiving from network A); 3: Logic (switch determines color); 4: Local Test; 5: Item recall (sending back to network A)
    • Topmost chest pictured is chest 2
    • Currently selected element: Chest extract 3
  4. Other selected elements from GUI of Controller B and Router A GUI: A. Chest 1 insert (used for phase 1, steps 6-8, disabled afterward, hence redstone high set) B. Switch logic (switches between white for forward movement, purple for recall (backward movement) C. Chest 2 insert on local test channel (used in phase 3) D. Chest 2 extract on Item Recall channel E. Router A GUI 4
Panderine commented 1 year ago

Same scenario but with a filter on the insert remote doesn't work. Using old filtering works

Senth commented 1 year ago

Got the same issue in 1.18.2

I also tested to publish the logic channel to both networks without it working. It could still read the color value through a redstone proxy.

Temporary fix that works okayish.

Use a redstone proxy to output the color and enable the connection by redstone instead of color.