gigaherz / Enderthing

Ender-chests evolved
https://www.curseforge.com/minecraft/mc-mods/enderthing
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

Suggestion/Feature: Capabilities upgrade #16

Closed xannor closed 6 years ago

xannor commented 7 years ago

Your potential feature lists fluids but you want a unique way. How about this, special craftable items that when put in the ender chest give all ender chests that capability. For instance a special crafted tank when placed would give the ender chest the capability to hold and move fluids (could be 1000mb by default or 8 or 16 to match other mods starting sizes) and this could be done on a capability and mod support basis (so you could do RF or EU or Telsa or what other capabilities there are) The item should be ignored by the regular inventory so it cannot be pulled out by automation, and the usual automation requirements should stand (so I have to make it private and use the security card for it to work.) This would reduce the number of slots available for items, which I believe is a fair trade. You could even keep the upgrade simple but allow multiples, so if I had 4 fluid upgrades the chest would hold 4000mb but I loose 4 item slots (actually I kinda like this idea best as I feel it balances it a little.) I would not reccomend multi-tank support (for multiple fluids) as that that could cause issues. Just my 2c.

gigaherz commented 7 years ago

That is actually an interesting idea. But I wouldn't call them "upgrades" so much as just a special item you place in the chest itself. So at most, you'd be able to have 27 buckets' worth of fluid in it. It also allows, as you said, for other types of special containers, such as batteries, to be exposed from the outside.

I wonder, though. One interesting way to approach that, would be to allow any tank or battery implementing the capability (while in item form) to be used. All I'd need is some kind of "aggregation adapter", that can take all the valid items and expose them on the outside, which would allow for extensibility of the supported APIs... But if I did that, there could be a situation where the chest contains more than one fluid, and I don't know how I'd handle that: Extraction would be easy, but what about insertion?

xannor commented 7 years ago

I can think of a lot of problems with proxying the capability, for instance, if you just re-exposed the api, what if the item exposes an item container, now you have a container in a container. Or if you exposed an unfiltered interace a mod may attempt to cast you or do other operations on you, yes that would be a broken mod, but you would get the bug reports.

I think the simpler would be to just implement the capabilities as simply as possible and then use a trigger item in the chest to enable them. You could event store nbt data on the item so if someone removed it and put it in another chest it would move the contents as well.

gigaherz commented 7 years ago

I'd never just expose items directly, I was talking about specific capabilities that would expose the item's contents indirectly (the outside mods would just see a block that claims to be a tank, they wouldn't know the tank contents come from items).

xannor commented 7 years ago

I guess I read too much into what you suggested. To aggregate the tanks you would just need a list with contents and free space in slot order. When an attempt to insert occurs, first try to find an existing tank with the fluid and insert, or pick the first empty and repeat until no space left. The only challenge would be a tank that can handle multiple fluids its self as this method would assume it cannot add new fluids to it. I don't know if the capabilities system provides enough information to recognize this and work around it, though maybe this should be something that is filtered out for simplicity.