Storage Drawers

Storage Drawers

151M Downloads

Drawer Controller Question

thiakil opened this issue ยท 13 comments

commented

At https://github.com/jaquadro/StorageDrawers/blob/1.10/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java#L866

You return false regardless, is there a particular reason for this?

I ask because OpenComputers checks this method on inventories with its fake player and doesn't allow interacting if false.

commented

Never gave it much thought because there's no GUI component behind controllers. And as far as I knew they were working fine with OpenComputers (though maybe only via Computronix, which can expose much better information via the SD API).

commented

Unfortunately it looks like that will never make it past 1.7.10 (I'm on 1.10.2), and I can't find any documentation on what support that adds, i.e. if it adds the ability to withdraw items etc...

commented

I'm not sure, as I didn't use it personally. It was important in 1.7.10 for handling of the deep inventory aspect, which was impossible to introspect through IInventory.

I actually consider IInventory to be fully deprecated on my blocks (for public access anyway), and all inventory handling should be done through Forge's inventory capability. It's even possible to take full advantage of the deep inventory slots with a bit of cleverness, without requiring special integration.

Perhaps you or someone from the OC project could elaborate a bit more on its storage / inventory behavior.

commented

As far as I understand it, it uses purely IInventory :(

Check of IInventory, check IInventory.isUseableByPlayer with OC fake player, if true, exposes the standard functions in its api, otherwise denies access.

What is exposed by that interface on the controller? I usually use OC to explore what Inventories expose haha

commented

Forge has been trying to push everyone away from IInventory since 1.8.9. It is a truly awful interface.

In 1.7.10 I had to write a lot of complex balancing code to deal with the different ways IInventory lets you modify state, let alone the expectation that changing the returned stack will also reflect those changes in the originating inventory. Easy enough to mess up and god forbid you used IInventory explicitly without relying on ISidedInventory methods to check first, because half the slots exposed were virtual. Yuck. That code still exists in the mod, but it's my intention to remove it, in which case there would be no practical way to read or write the inventory through IInventory.

The controller concatenates all of the inventory slots of all the drawers it can see in its range, and exposes that. It just looks like a giant many-slotted drawer.

I could always try to internalize the integration code that was in computronics and thus expose SD-specific functions (and that's still useful for its auxiliary functions like locking/conealment/etc), but it seems like a major defficiency to me if OC is not supporting IItemHandler.

commented

Hmm, actually looks like I was wrong, I read some post saying work was abandoned, but there appear to be 1.10 commits on github for Computronics.

Unfortunately it doesn't appear to allow withdrawal/depositing.

I have no idea of their intentions but I would assume the use of I(sided)Inventory is a holdover from the earlier versions of the OC mod, as there still seem to be a number of non-inventory related bugs

commented

I was drawn to this, I'm on 1.7.10 with OC & computronix. I'm wondering what you did to interface with the controller, the standard adapter / inventory controller returns no slots when attempting to talk to an Drawer controller.

commented

Unfortunately it is not possible, for the above reasons.

a) OC checks for isUseableByPlayer(), Storage Drawers returns false because it has no GUI
b) OC doesn't use the inter-mod item capability (not applicable to 1.7.10 I think)

If you're running a private instance and are capable of compiling mods, you could edit the isUseableByPlayer method to let it work, or remove the check from OC.

For 1.10+ when OC is using the capability interface (it's on my list to do) it should be able to work with storage drawers

commented

It would be fine to change in 1.7.10 (I think). There is in fact an inventory GUI, albeit a nontraditional one. The IInventory expressed through the tile entity would be fine to use as long as OC strictly respected it as an ISidedInventory.

In 1.10 I already have a branch with the vanilla inventory support completely gutted top to bottom. I'm not sure if I will merge that into a 1.10 release or not, just because I did export it through one of my APIs. It's already a done deal in 1.11 though -- gone. IItemHandler is all that's available.

commented

as long as OC strictly respected it as an ISidedInventory

I'm fairly certain it does, in the LUA api you need to specify the side

Yup, definitely my goal is to have OC use only IItemHandler

commented

What was the resolution regarding closing this?

commented

Looks like this should have been addressed in MightyPirates/OpenComputers#2175.

On the SD side, the IInventory in all capacity was formally lost as of the 3.7.0 release.

commented

Correct, not an issue with newer OC version.