branchpanic / stockpile

A Minecraft mod all about storage.
MIT License
10 stars 5 forks source link

mod incompat with tubular/stockpile with barrels and tube connectors #82

Closed SDUBZ closed 4 years ago

SDUBZ commented 5 years ago

log: http://puu.sh/E6XOL/36d059da34.log

vini2003 commented 5 years ago

Stockpile apparently does not implement getInvAvailableSlots(), meaning Tubular doesn't know where to insert, thus inserting at a default inventory slot. I should probably just make it not work in such cases, but still, from my understanding, this should be fixed in Stockpile's SidedInventory implementation.

branchpanic commented 5 years ago

Thanks for the technical info. This should indeed be fixed in Stockpile. I've had trouble with the LibBlockAttributes wrapper I delegate Inventory to because, well, I'm kind of abusing it to get the result I want. I'll see if I can come up with something cleaner as soon as I get the chance.

vini2003 commented 5 years ago

After further investigation it seems like somehow the filter option in Tubular is broken as of last release. How this got past testing is beyond me.

Put this on hold for now as I try to fix this.

branchpanic commented 5 years ago

Will do, good luck and keep me updated if there's anything I should do on my part to make things easier.

SDUBZ commented 5 years ago

thank you guys for all your hard work i appreciate so much :D

vini2003 commented 5 years ago

Quick update, I'm still working on Tubular but there were a lot of things happening lately so I didn't get much done. This should be fixed or better debugged soon.

vini2003 commented 5 years ago

Rewrite finished, though LibGUI version update was necessary and I had to update to 19w36a. As such, I can't really fix this right now.

Whenever 1.15 is released and we both update to it, it'll be fixed. I don't really feel like bothering the LibGUI guys with backporting new features to 1.14 just for Tubular.

SDUBZ commented 5 years ago

oh so i gotta wait until 1.15 :(

vini2003 commented 5 years ago

Nevermind; backported to 1.14.4 successfully, working on this. Seems to be a weird issue though.

vini2003 commented 5 years ago

@branchpanic why does getInvStack() of FixedMassItemInv return ItemStack.EMPTY if accessing the inbound slot?

Given it gives me such slot as available for insertion, I need to know what it contains - otherwise the system tries to insert X in a slot with Y.

branchpanic commented 5 years ago

This is kind of a weird workaround for hoppers so bear with me. I had something that I thought was a bit more sensible before but just couldn't get it to work within the last stack of capacity so I settled on the following. I hope this makes sense because I'm really tired right now but that doesn't stop me from responding to issues.

The inbound slot stays empty so hoppers don't try to mess with it. If I recall correctly, they directly increment stack counts, which I couldn't figure out how to observe. But I noticed that some additional checks were done if the destination slot was formerly empty, so I figured the next best plan of action was to always make the input slot empty so I could have more control over whether or not I'd accept an item into it.

When checking item validity, the intention was for isItemValidForSlot and/or getMaxAmount to be used for checking whether or not and how much of an item can be inserted. As the free space in a barrel decreases to below its max stack size, so does the output of getMaxAmount for a valid item in the input slot. If your implementation allows it, maybe you could use these methods to check if you can insert?

I guess the problem with these is that they're as effective as signs in front of a bank that say "please don't rob this bank." Ideally the impossible state would be unrepresentable but I can't figure out how to achieve that when gluing my already-sketchy API code to Minecraft code via LBA.

I wish I could come up with a better solution (and hell, work on new features) but I only seem to have time when there's some other major bug to fix. If you have suggestions I'm open to a better solution because trust me I want one.

vini2003 commented 5 years ago

Ouch, I see it now. I'll see if there's anything I can do tomorrow.

vini2003 commented 4 years ago

I'll be fair, that tomorrow has been taking quite a while, though I am still working on a similar thing - in specific, Buffer, whose aim is to expose a single stack and keep the rest in an internal buffer of a special inventory type. It's been quite a ride so far given I, to say the least, suck at this right now.

branchpanic commented 4 years ago

That's awesome! You're of course free to reference any of Stockpile's code if it helps in any way. FWIW I've been considering relicensing as public domain by major version 2 or something like that since I clearly don't have enough time to maintain it.

Also if you ever separate out your new inventory code into a library or something like that I'd be happy to contribute to it and/or use it for Stockpile. I think having a consistent abstraction for buffer/mass storage inventories would be beneficial so mods that aren't dedicated to storage can get creative with them. All in all i suck at this too so don't worry about it 😉

vini2003 commented 4 years ago

It's been a while!

Buffer has been released and seems to be working relatively well aside an issue with voiding that I'll solve whenever I finish my GUI library,

I have discontinued Tubular because I've learned a lot since then and can probably make it work much better, so don't worry about this issue anymore.

SDUBZ commented 4 years ago

@vini2003 why you stop work on something like logistical pipes :O

branchpanic commented 4 years ago

Glad things have gone well and good luck with Buffer! I'll close this issue now since it seems like we've figured everything out.