Applied Energistics 2

Applied Energistics 2

137M Downloads

Add player starting the crafting, to the dummy container

mcenderdragon opened this issue ยท 11 comments

commented

Right now the container supplied to InventoryCrafting (used to get the crafting recipes & result) is empty and does not contain the player who requsted these items. As I have crafting recipes which are locked for players I am unable to determine who wants to craft and thus all recipes are blocked from ME automation. If the Player who requested the items would be supplied (or the GameProfile incase thew recipe is large & the player goes offline) all my recipes would work and players could outomate it.

commented

In most cases this data is not available or even trackable. E.g. crafting started automatically by interfaces, export buses or level emitters.

Further the whole calculation is not (and cannot really) be player aware. The basic checks are done during loading the patterns, at which point the player data might still not be available or change afterwards. As well as leading to cases that the network is validating it against a completely different player than the one making the request.

It would basically have to maintain a separate pattern for every single player on a server. Which makes it pretty much impossible to handle for us as well as the player. Especially once someone has the idea to require different inputs and produce different outputs on a per player basis and not just lock someone out.

commented

Technically yes, but nothing will check the recipe after it's added as valid pattern. For crafting it will basically just copy the encoded output regardless of who requests it. Pretty much shifting it to the other extreme and allow anyone to craft anything known to this particular ME network.

commented

I think thats ok as a player is willingly crafting that pattern. Is it possible fix the crafting grid, as a player has to open it and is interacting with there is a player, right now this is also not possible and there is no way for me to work araound it.

commented

Probably not. the whole crafting system in mc doesn't really care about the player at all. There might be ways to try and intercept it via crafting events, but in the end that will always be an issue as this is forge only and also not required. As well as in my experience usually a pretty hefty performance impact when more than a few items are crafted.

And just in case of custom patterns, I won't guarantee that it always works. It already prevents a couple optimizations we could do, but that would most limit it to only one pattern for a single recipe can exist at any point. E.g. it will always be linked to whichever pattern is loaded first. Every pattern created afterwards will always fallback to some other player. Until the next restart once it loads from a player not being able to craft it and breaking it for every player.

commented

Is it possible to make another item accepted as a pattern in the ME interface? I mean more like what do I need to implement in the Item so it is a useable pattern? Also do the matter fabricators check the crafting recipes again? (if so I coudl try to implement a version of them which save the UUID of the player who placed the block)

commented

Maybe we could use the Security Controller? You could select one player (as a new option), that is used for crafting there ...

commented

In order to do that instead of passing ContainerNull everywhere we would need a container with atleast 1 BlockPos, or better a link to the current network as right now there are no information about the crafting source.

commented

@Pingger has a nice point, extend the security attributes with an "owner"

if the owner player is capable of crafting the recipe, the ME system can too

every request done via interface (terminal, or mobile by any means) would store the player information and every sucessive pattern related crafting process (except thos provided by crafting cards in busses) would adapt this player information
(i don't see the need for a source block in this case)

and any "crafting card" request would be dealt with the owner player instead (or null in case of wildcard, resulting in no "crafting card" recipe working for limited recipes)

commented

I just checked the crafting grid & the pattern crafting dont need fixing, in the parent classes are the PlayerInventories so only autocrafting would need a solution. @mindforger I like this idea, as it is nice to setup player wise and somewhat reliable.

commented

i don't know what mod/pack you are working on but i remember this mod where you have to progress forward through achivements to be able to see blocks/items and crafting patterns ... unfortunately i rely so heavily on AE2 so i did not enjoy those modpacks very much but this could even solve this problem with a little extra work on the other modsite to adapt to this feature

commented

All need to make this work is a PlayerEntity or PlayerInventory in the DummyContainer.