Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
update readme & increase version to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LabyStudio committed May 1, 2021
1 parent 3e65056 commit 73594ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@ Click [here](https://docs.labymod.net/pages/server/minecraft/screen/) for more d
### Serialize widgets
```java
// Create new screen
JsonObject screen = new JsonObject();
screen.addProperty("id", 42); // Screen id. The client will send this id back on an interaction
screen.addProperty("action", EnumScreenAction.OPEN.ordinal()); // Open the GUI
WidgetScreen screen = new WidgetScreen(42); // The client will send this id back on an interaction

// Centered anchor
Anchor anchor = new Anchor(50, 50);

// Create widget list
List<Widget> widgets = new ArrayList<>();

Anchor anchor = new Anchor(50, 50); // X: 50% Y: 50%

// Add button to widget list
widgets.add(new ButtonWidget(0, anchor, -50, 20, "Apply", 100, 20));
screen.addWidget(new ButtonWidget(0, anchor, -50, 20, "Apply", 100, 20));

// Serialize widgets
screen.add("widgets", WidgetSerialization.toJsonArray(widgets));
JsonObject object = screen.toJsonObject(EnumScreenAction.OPEN); // OPEN = Open the screen
```

### Anchor explanation image
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'net.labymod.serverapi.common'
version '1.0.0'
version '1.1.0'

repositories {
mavenCentral()
Expand Down

0 comments on commit 73594ff

Please sign in to comment.