Advanced Peripherals

Advanced Peripherals

29M Downloads

Wrapped Inventories doesn't pull / push the items from / to the right block

Bunny83 opened this issue · 5 comments

commented

Describe

Usually when you wrap an Inventory block (chest, furnace, etc) as a peripheral, in the classic OpenPeripherals pushing / pulling items in a certain direction had pushed / pulled those items relative to that inventory block. Currently the target seems to be relative to the computer executing the push / pull.

I hade a smoker at the bottom, an advanced turtle on top and on top of that a vanilla chest. Wrapping the bottom (smoker) and pulling items from the top, does not pull from the block above the smoker (from the turtle's inventory) but from the inventory on top of the turtle (from the vanilla chest). The same happens in reverse. Wrapping the chest on top and pusing items down does not push the items into the turtle but into the smoker. So it's completely impossible to move items in or out the turtle that way since it's essentially skipped. When the target inventory is determined it currently use the turtle as reference and not the actual peripheral.

ps: I've seen older issues which complained about the usage of the usual forge directions (up, down, north, east, south, west) as it was implemented in OpenPeripherals and that it was changed to the usual relative computercraft directions (top, bottom, front, back, left, right). While I appreciate a more consistent usage, its actually a breaking change compared to the behaviour of the original mods. I don't mind the directions change, however pulling / pushing from / to a turtle does not work at all with the current implementation. That renders many common usecases impossible as we can not access specific items from a chest. A hacky workaround would be to temporarily place a chest in front of the turtle, pull items from the smoker / chest diagonally into that front chest and then use an ordinary turtle.suck() to get the items into the turtle's inventory.

Anyways, thanks for keeping those essential CC addons alive.

Steps to reproduce

  1. Turtle with chest on top and smoker below
  2. wrap the smoker p = peripheral.wrap("bottom")
  3. try to pull items from the turtle into the smoker: p.pullItems("top",1,1,1)
  4. The pullItems call does not pull from the turtle that is on top of the smoker but from the chest on top of the turtle.

Multiplayer?

Yes

Version

1.19.2-0.7.19a (Latest 1.19)

Minecraft, Forge and maybe other related mods versions

1.19.2 forge-43.1.43

Screenshots or Videos

No response

Crashlog/log

No response

commented

I am a bit confused.
Your issue looks more like an issue with CC. You also do not mention any feature or block for AP

Are you sure that you're right here?

commented

Inventory features now exists in CC:Tweaked itself. Turtle have a problematic interaction with inventory, here is a nice picture describing it

Turtlepain

commented

Sorry for the late response I was quite busy the last week and essentially forgot about this. I'm actually confused myself now ^^.

Sorry if I wasted your time. Though I was searching through the code and found pushItems in the InventoryUtil class, though it seems the method isn't actually used anywhere in your code, This method however reflects exactly the issue mentioned :)

You provide the exact same parameters and the method takes a IComputerAccess and an ItemHandler. That item handler is the source, so the wrapped peripheral. The method getHandlerFromName is then used to grab the target, but this is done relative to the computer, not the wrapped item handler.

So I wrongly interpreted this as that the problem was in your code. I've acutally found the pushItems method in the CC Tweaked repository.

Yes, by reading the comments of the method it now makes sense what they actually had in mind. So you can use a wired network and push between any connected peripherals, Though that means the method does not work at all for pushing / pulling items to / from the turtle unless you connect it to a wired modem. This new functionaliry is of course much more powerful than the "old" one, though it breaks any previous (lua) code.

So again, sorry to bother you. Thanks for keeping CC and essential features alive.

commented

I'm glad that you found an answer to your question

You don't waste time (:
If you have any questions, you can ask in the discussion tab on github or on our discord https://discord.srendi.de/

commented

:) Yes, it's an answer, though it's sad that people always break well established APIs. Linus Torwalds would crush them if they did this in the kernel :D
Claiming they continue the old mod but breaking countless of things is not really continuing the mod. I do understand that they wanted to add new features, fine, however they could have added seperate methods for this.

Just noticed that you seem to be german? Dann hätten wir noch was gemeinsam :)