LibrarianLib

LibrarianLib

18M Downloads

Create Facade containers

thecodewarrior opened this issue ยท 1 comments

commented

Facade currently doesn't have container GUIs, so this needs to be added and, as usual, given the LibLib polish. A lot of the LibLib 4 implementation can be brought over, though some aspects could use being rebuilt or improved.

One notable addition I would like to do is making GUI <-> Container interaction easier through "messaging". Messaging will allow directly invoking (only annotated!) methods on the server or client. Here's an example of what this might look like:

class MyContainerScreen: FacadeContainerScreen {
    init {
        main.add(PastryButton("Perform action") { 
            this.sendMessage("doAction", 10, "text", Blocks.DIRT)
        })
    }
}

class MyContainer: FacadeContainer {
    @GuiMessage
    fun doAction(number: Int, text: String, block: Block) {
        // this will be invoked on the client-side container and a
        // packet will be sent to invoke it on the server-side container 
    }
}

It may even be viable to create delegates that will automatically sync value changes in one or both directions, along with providing value changed callbacks so GUIs can respond to syncs. Both synced values and message parameters must be binary serializable so they can be sent via packets.

commented

This has been implemented in 1.15-dev