Advanced Peripherals

Advanced Peripherals

29M Downloads

Inventory Manager is not compatible with Computercraft: Tweaked's relative directions.

OneTwoMint opened this issue ยท 9 comments

commented

The relative directions from Computercraft: Tweaked, such as "top", "bottom", "back", and "front" don't work as references to inventory blocks, returning Java Exception Thrown: java.lang.IllegalArgumentException: No enum constant net.minecraft.util.direction.BACK in the case of referring to an inventory placed behind the Inventory Manager using "back".

commented

Yes, i approve your message. I will add the cc direction integration to every block soon.

commented

The inventory manager uses cardinal points as the direction argument. Like "NORTH", "UP", "DOWN", ... .

commented

Why, though? Most things in Computercraft: Tweaked use the relative directions as far as I know, and even the Redstone Integrator is compatible with them. It seems strange that the Inventory Manager would have this limitation.

commented

this also doesn't work with named peripherals (like "minecraft:chest_0") when connecting by cable

commented

@Seniorendi

commented

this also doesn't work with named peripherals (like "minecraft:chest_0") when connecting by cable

What does not work?

commented

If you use the cables and wired modems, one cannot do manager.addItemToPlayer("minecraft:chest_0", 63, "minecraft:dirt") when that chest is connected to the cable. This is allowed on the normal inventory API on cc:tweaked as long as both inventories are wired. Trying to move items from a cabled chest to a cabled inventory manager causes a Java error because its not part of the enum of options, even though it should be able to be any connected inventory. @Seniorendi

CC: Tweaked equivalent of moving items between 2 chests:

local chest_a = peripheral.wrap("minecraft:chest_0")
local chest_b = peripheral.wrap("minecraft:chest_1")

chest_a.pushItems(peripheral.getName(chest_b), 1)

Source

commented

Also, it would be very cool if the inventory manager implemented the same api as the cctweaked inventory api as it would allow polymorphic code to utilize different inventories with less work. (This doesn't mean removing the old functions as that may break some new ones, just adding an alias to the standard names)

  • addItemToPlayer -> pullItems
  • removeItemFromPlayer -> pushItems
  • getItems -> list

And maybe implementing the others:

  • size() | Get the size of this inventory.
  • getItemDetail(slot) | Get detailed information about an item.
  • getItemLimit(slot) | Get the maximum number of items which can be stored in this
commented

This could also be done to the RS and AE bridges as they have similar import/export item functions which are similar to push/pull items from cct

I'm going to repackage this as a separate issue since it exceeds the scope of this issue.