You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: owo/config/synchronization.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ To enable config sync, simply apply the `@Sync` annotation to the option you wan
14
14
-`Option.SyncMode.OVERRIDE_CLIENT`: Send the server's value to the client and temporarily override the client's value. Enabling `OVERRIDE_CLIENT` implies `INFORM_SERVER`
15
15
16
16
::: info Option Serialization
17
-
To send your config's value over the network, owo's networking stack is employed - specifically the `PacketBufSerializer` system. It *should* support all commonly used types out-of-the box, yet it is not impossible to think of a situation where you may need a custom serializer. For those cases, simply call `PacketBufSerializer.register(...)`**before** you load your config and provide the necessary code.
17
+
To send your config's value over the network, owo's networking stack is employed - specifically the `Endec` serialization framework . It *should* support all commonly used types out-of-the box, yet it is not impossible to think of a situation where you may need a custom `Endec`.
18
+
19
+
For those cases, you can add your custom `Endec` by adding to your Config instance's `ReflectiveEndecBuilder` within the `createAndLoad` method by passing a custom `BuilderConsumer`. This allows you to add your custom `Endec` by calling the `ReflectiveEndecBuilder.register(...)` method.
Copy file name to clipboardExpand all lines: owo/features.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,7 @@ oωo offers a flexible system for automatically registering a class' fields into
8
8
## Networking
9
9
<VersionMarkerversion="^0.4.0" />
10
10
11
-
oωo provides a fully-featured network serialization system. Built around `OwoNetChannel` and the `PacketBufSerializer` framework, packet data is automatically (de-)serialized and the corresponding handlers invoked without the need of keeping track of Identifiers or channel associations - everything is derived from the data class. Packet contents are defined
12
-
as Java `record`s, making it highly ergonomic. The serialization backend fully supports serializers for custom types and all channel-layout related data is synced between client and server making it so an incompatible server cannot be joined.
11
+
oωo provides a fully-featured network serialization system. Built around `OwoNetChannel` and the `Endec` framework, packet data is automatically (de-)serialized and the corresponding handlers invoked without the need of keeping track of Identifiers or channel associations - everything is derived from the data class. Packet contents are defined as Java `record`s, making it highly ergonomic. The serialization backend fully supports serializers for custom types and, in development, all channel-layout related data is synced between client and server making it so you cannot forget to register a handler on one side.
13
12
14
13
## [Item Groups](item-groups.md)
15
14
<VersionMarkerversion="^0.2.0" />
@@ -24,7 +23,7 @@ oωo provides two main systems for handling particles. Primarily there's a clien
24
23
## Debug/Dev Features
25
24
<VersionMarkerversion="^0.3.0" />
26
25
27
-
When in a development environment, oωo's debug mode is automatically enabled which adds a host of features like commands for damaging/healing the player or dumping information about game objects, automatically disabled weather and daylight cycle and a few more.
26
+
When in a development environment, oωo's debug mode is automatically enabled which adds a host of features like commands for damaging/healing the player or dumping information about game objects, automatically **disabled weather and daylight cycle** and a few more.
28
27
29
28
## Moddata
30
29
<VersionMarkerversion="^0.3.0" />
@@ -50,3 +49,21 @@ The `TagInjector` system allows you to inject entries into tags at runtime. Ther
50
49
<VersionMarkerversion="^0.5.0" />
51
50
52
51
The `OfflineDataLookup` and `OfflineAdvancementLookup` interfaces enable easily querying and/or modifying the NBT and Advancement data of offline players. As everything in oωo, the API surface is non-verbose to use and usually does not require more than a single method call.
52
+
53
+
54
+
## [UI Framework](./ui/index.md)
55
+
56
+
<VersionMarkerversion="^0.8.0" />
57
+
58
+
owo-ui is a declarative UI framework that helps with building dynamic screens quickly and easily. It strives to be highly embeddable, performant and, most of all, super easy to use. More information pertaining to it features and capabilities can be found within [UI section](./ui/index.md)
59
+
60
+
## [Configuration](./config/index.md)
61
+
62
+
<VersionMarkerversion="^0.8.0" />
63
+
64
+
oωo provides a highly flexible annotation-driven configuration system. It aims to be simple yet powerful and offers a wide range of customizability and features as discussed within the [Config section](./config/index.md)
65
+
66
+
## Endec
67
+
<VersionMarkerversion="^0.12.0" />
68
+
69
+
[endec](https://github.com/wisp-forest/endec) is a format-agnostic serialization framework inspired by Rust's [serde](https://serde.rs) library and the Codec API from Mojang's [DataFixerUpper](https://github.com/mojang/datafixerupper). More information on its features and implementation details can be found within the (WIP: Planned addition) [Endec Section]()
Copy file name to clipboardExpand all lines: owo/networking.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
Networking can be quite the hassle to set up and maintain when using only the tools provided to you by Minecraft and Fabric API. owo, however, includes an easy-to-use networking stack which is quick to set up and even easier to maintain while still keeping high performance.
6
6
7
7
## Concepts
8
-
owo's networking API comprises of two core systems - the `OwoNetChannel`, which handles all networking, and the mostly self-contained `PacketBufSerializer`, which takes care of serializing objects into packet buffers.
8
+
owo's networking API comprises of two core systems - the `OwoNetChannel`, which handles all networking, and the `Endec` serialization framework, which takes care of serializing objects into packet buffers.
9
9
10
10
For safety reasons, using a channel in your mod will enable owo's handshaking procedure. This verifies that the channel layout on both server and client is identical, to prevent possible crashes or malformed data received, if one side is encoding differently than the other expects.
11
11
@@ -97,8 +97,9 @@ You might also wonder what the two parameters in the handler represent. It's qui
97
97
98
98
In order to send a packet via an `OwoNetChannel`, you need what we call a `Handle`. This is an object bound to a certain target, with a `send` method which sends packets to that target. To bind and obtain a `Handle`, use either the `clientHandler()` or any of the `serverHandle(...)` methods. A handle is always named after where it is sending *from*, thus a `ServerHandle` sends *from* the server *to* the client and vice-versa.
99
99
100
-
!!! attention
101
-
The server and client handles are re-used. Each channel stores exactly one handle of each kind and binds it every time you request it via any of the methods. This means you *cannot* store a handle for later usage - it is not in any way guaranteed to still be bound to the same target and could thus cause all kinds of weird and undefined behavior.
100
+
::: danger Attention
101
+
The server and client handles are re-used. Each channel stores exactly one handle of each kind and binds it every time you request it via any of the methods. This means you *cannot* store a handle for later usage - it is not in any way guaranteed to still be bound to the same target and could thus cause all kinds of weird and undefined behavior.
102
+
:::
102
103
103
104
Once you obtained a handle, you can use it to send a packet:
MyModInitializer.MY_CHANNEL.clientHandle().send(new MyPacket(1, "this", new Identifier("is", "podge")));
118
119
```
119
-
:::
120
+
:::
121
+
122
+
### Registering Custom Endec
123
+
124
+
There may be a point where a given message may contain object types that cannot be reflectively built using the `ReflectiveEndecBuilder`. In this case, you need to register custom `Endec`(s). This can be accomplished by calling the channel's `addEndecs(...)` method, which accepts a callback that can register additional `Endec`s to the channel's endec builder.
125
+
126
+
```java
127
+
public record MyPacket(int index, String name, Identifier target, @Nullable List<String> additionalNames) {
128
+
public static final StructEndec<MyPacket> ENDEC = StructEndecBuilder.of(
As you can see, this example also includes `owo-sentinel`. sentinel is a super tiny mod which is designed to be Jar-in-Jar'd by mods that depend on owo. If a player then installs your mod without installing owo, sentinel will prevent their game from launching and instead open a window warning them that owo is required. It gives them the option to automatically install owo or open owo's page so they can do it manually
73
+
As you can see, this example also includes `owo-sentinel`. sentinel is a super tiny mod which is designed to be Jar-in-Jar'd by mods that depend on owo. If a player then installs your mod without installing owo, sentinel will prevent their game from launching and instead open a window warning them that owo is required. It gives them the option to automatically install owo or open owo's page so they can do it manually.
74
+
75
+
**Important:** owo-sentinel *never* does anything without user consent. It has a built-in explanation and only establishes a network connection or modifies files on disk after the user explicitly requests it with a clearly labeled button.
76
+
:::
77
+
78
+
::: danger owo-sentinel dependency declaration
79
+
Even when using owo-sentinel, it is still necessary and **very important** that you correctly declare your dependency on owo in *both* your mod's `fabric.mod.json` and on whichever distribution platforms you use.
80
+
81
+
If you don't do this, you **will** cause for other developers and players. Launchers will not be able to correctly instally owo as a dependency, mod bisection tools will not detect your owo dependency and trigger an uncesssary sentinel launch, and so on and so forth.
82
+
83
+
owo-sentinel is meant to be a *last-resort* convenience option for users who install your mod without using a launcher or similar tool which takes care of installing the owo dependency. It does not absolve you of the responsibility to manage your dependencies correctly.
66
84
:::
67
85
68
86
If you want to use a version other than the most current one, check the [GitHub releases page](https://github.com/wisp-forest/owo-lib/releases/)
0 commit comments