AlexIIL / LibBlockAttributes

Library mod for fabric that adds items and attribute API's for blocks.
Mozilla Public License 2.0
43 stars 12 forks source link

BlockView support for mods depending on this library #42

Closed harleylizard closed 3 years ago

harleylizard commented 3 years ago

Hello, just wondering if you're able to change Attribute#getAll to use the BlockView interface instead of the World class, would allow to use child instances of BlockView in methods that don't provide a world instance. (World class implements BlockView, and you're using the methods that BlockView provides, so wouldn't have to change anything else)

AlexIIL commented 3 years ago

That's not really possible, since the World object is passed down through a lot more code than just Attribute.getAll, plus it ends up outside LBA code in the mods that actually provide attributes.

(The main problem is that I'd have to break LBA's APIs in order to make this work).

AlexIIL commented 3 years ago

(Woops, sorry for the miss-click closing).

What are you trying to do? LBA is a fairly general-purpose library, so there's no guarantee that attribute instances support just a BlockView. However there might be an alternative depending on what you need...

harleylizard commented 3 years ago

For the first reply, understandable, not much i can add onto that. For the second/third reply, yes i do need to grab attributes in a method that only provides a WorldView instance. Trying to set an attribute on the server, and then retrieve in a client, but that client method only provide the WorldView instance.

AlexIIL commented 3 years ago

Trying to set an attribute on the server, and then retrieve in a client

Sadly LBA doesn't provide that functionality - LBA can only retrieve objects on the same side as where they are provided.

AlexIIL commented 3 years ago

What kind of object are you setting/retrieving?

harleylizard commented 3 years ago

What kind of object are you setting/retrieving?

A custom attribute class, also do you have discord? (mines chaottic#3842) to chat on that instead of in this lol

AlexIIL commented 3 years ago

discord

Yes, https://discord.gg/BjnuMUs

AlexIIL commented 3 years ago

(Closing after discussion has long since finished).