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

Commit 73594ff

Browse files
committed
update readme & increase version to 1.1.0
1 parent 3e65056 commit 73594ff

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

README.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,16 @@ Click [here](https://docs.labymod.net/pages/server/minecraft/screen/) for more d
1515
### Serialize widgets
1616
```java
1717
// Create new screen
18-
JsonObject screen = new JsonObject();
19-
screen.addProperty("id", 42); // Screen id. The client will send this id back on an interaction
20-
screen.addProperty("action", EnumScreenAction.OPEN.ordinal()); // Open the GUI
18+
WidgetScreen screen = new WidgetScreen(42); // The client will send this id back on an interaction
2119

2220
// Centered anchor
23-
Anchor anchor = new Anchor(50, 50);
24-
25-
// Create widget list
26-
List<Widget> widgets = new ArrayList<>();
27-
21+
Anchor anchor = new Anchor(50, 50); // X: 50% Y: 50%
22+
2823
// Add button to widget list
29-
widgets.add(new ButtonWidget(0, anchor, -50, 20, "Apply", 100, 20));
24+
screen.addWidget(new ButtonWidget(0, anchor, -50, 20, "Apply", 100, 20));
3025

3126
// Serialize widgets
32-
screen.add("widgets", WidgetSerialization.toJsonArray(widgets));
27+
JsonObject object = screen.toJsonObject(EnumScreenAction.OPEN); // OPEN = Open the screen
3328
```
3429

3530
### Anchor explanation image

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'net.labymod.serverapi.common'
6-
version '1.0.0'
6+
version '1.1.0'
77

88
repositories {
99
mavenCentral()

0 commit comments

Comments
 (0)