Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
RobertBouillon opened this issue Mar 25, 2024 · 9 comments
Labels
area-Minecraft This affects CC's Minecraft-specific content. bug A problem or unexpected behaviour with the mod.

Comments

@RobertBouillon
Copy link

RobertBouillon commented Mar 25, 2024

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.

@RobertBouillon RobertBouillon added the bug A problem or unexpected behaviour with the mod. label Mar 25, 2024
@fatboychummy
Copy link
Contributor

Can you screenshot your setup as well?

@RobertBouillon
Copy link
Author

@fatboychummy Updated

@Wojbie
Copy link
Contributor

Wojbie commented Mar 25, 2024

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.

@SquidDev SquidDev added wontfix A bug which I won't fix or an enhancement which won't be implemented. area-Minecraft This affects CC's Minecraft-specific content. and removed wontfix A bug which I won't fix or an enhancement which won't be implemented. labels Mar 25, 2024
@SquidDev
Copy link
Member

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.

@RobertBouillon
Copy link
Author

@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 :)

@Lupus590
Copy link
Contributor

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.

@SquidDev
Copy link
Member

That was Plethora-only.

@RobertBouillon
Copy link
Author

RobertBouillon commented Mar 25, 2024

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

@SquidDev
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Minecraft This affects CC's Minecraft-specific content. bug A problem or unexpected behaviour with the mod.
Projects
None yet
Development

No branches or pull requests

5 participants