CC: Tweaked

CC: Tweaked

59M Downloads

I can pull from #2 to #1 but I can't push from #1 to #2 - "#2 is not an inventory"

RobertBouillon opened this issue ยท 9 comments

commented

Minecraft Version

1.19.x

Version

1.101.4

Details

Overview

I have two inventories on a network. I can pull from #2 to #1 but I can't push from #1 to #2 ("#2 is not an inventory").

Steps to reproduce

  1. Create a new creative world
  2. Place an advanced computer, spores recreator, functional storage controller, and 1x1 Oak Drawer
  3. Connect all blocks using wired modems
  4. Link the oak drawer to the controller using the linking tool
  5. Add 64 red mushrooms to the storage drawer
  6. Run peripherals and update the below script with the correct ID's accordingly
  7. Script breaks on line 8 :(
local storage_name = "functionalstorage:storage_controller_2"
local shrooms_name = "industrialforegoing:spores_recreator_8"

local storage = peripheral.wrap(storage_name)
local shrooms = peripheral.wrap(shrooms_name)

shrooms.pullItems(storage_name,1,1)  --Works fine
storage.pushItems(shrooms_name,1,1)  --'industrialforegoing:spores_recreator_8` is not an inventory

Screenshot

image

Notes

If I change the industrial foregoing machine to a minecraft barrel, it works. Maybe it's a problem with industrial foregoing's implementation of the API? Not sure who "owns" the compatibility there, but maybe it'll help debug.

commented

Can you screenshot your setup as well?

commented
commented

Can you run 'peripherals' program and screenshot results? I am guessing one of them does not have inventory type and is basic peripheral? You can bypass issue by having working peripheral both push and pull on nonworking one.

commented

Thank you for the report, was incredibly helpful!

This is a really messy problem:

So a lot of inventories in Minecraft are "sided". For instance, furnaces receive items to be smelted from the top, and can only extract the result from the bottom. However, computers want to be able to see the whole inventory, not just the "top" slots (for example) of a furnace.

We can do this by requesting the null side when fetching the inventory. Unfortunately, industrial foregoing doesn't support this (InnovativeOnlineIndustries/Titanium#89), and so CC:T doesn't find it as an inventory.

Ideally IndustrialForgegoing would correctly handle the null side. However, as a workaround, we can fall back to the current side the peripheral is attached on.

commented

@SquidDev Thanks so much for the prompt and thorough reply. This makes complete sense to me.

Would it be possible to add a parameter to the push/pull methods to specify a side? This would improve mod compatibility.

As a workaround, I can use @Wojbie's suggestion and interface with a container.

Would it be possible to get a more descriptive error message, or have this caveat added to the documentation? That may prevent more bug reports from being written :)

commented

Would it be possible to add a parameter to the push/pull methods to specify a side? This would improve mod compatibility.

I believe that you already can by appending the side to the peripheral name when you wrap it. Or was that a Plethora thing?

minecraft:chest_0:north or something I think.

commented

That was Plethora-only.

commented

What's nice about the change that was just made is that you can add a modem to each side you need access to (see image below), so this was a great quick fix.

An API change would allow users to access any side, regardless to what side the connector is on. This is a really nice feature I've used a lot with XNET, which allows you to insert on one side and extract from another using the same connector. XNET limits this feature to advanced connectors, which is a nice progression-lock. Not sure if something like an "advanced modem" would fit with the design objectives for CC:T, though.

image

commented

The inventory peripherals generally try to ignore sides as much as possible. Conceptually you're using the whole block as a peripheral - the side shouldn't matter.

We do obviously have some handling for sides, but that's purely to work around mods which don't implement the capability contract correctly. I definitely understand the motivation, but I don't want to add too much extra functionality just to work around bugs in other mods.


Not entirely relevant, but part of the reason this didn't make it across from Plethora is that the API design here is quite tricky. CC tries to avoid using the cardinal directions anywhere - everything is relative to the computer's orientation (so left/right/front/back rather than north/south/east/west). However, there's no obvious frame of reference for peripherals - is it relative to the modem/computer, or to the block itself?