Skip to content

Commit ff3cb5d

Browse files
committed
merge changes from #25
1 parent 955a822 commit ff3cb5d

6 files changed

Lines changed: 97 additions & 24 deletions

File tree

accessories/developer/dev_setup.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,30 @@ dependencies {
3232
#### Multiloader
3333

3434
::: code-group
35-
```groovy [Common - Arch]
35+
```groovy [Common - Arch Loom]
3636
dependencies {
3737
modImplementation("io.wispforest:accessories-common:${project.accessories_version}")
3838
}
3939
```
4040

41-
```groovy [Neoforge - Arch]
41+
```groovy [Neoforge - Arch Loom]
4242
dependencies {
4343
modImplementation("io.wispforest:accessories-neoforge:${project.accessories_version}")
4444
4545
// Required due to issues with JIJ dependency resolving in arch or something
4646
forgeRuntimeLibrary("blue.endless:jankson:1.2.2")
47+
48+
// For versions greater than or equal to 1.21.4
4749
forgeRuntimeLibrary("io.wispforest:endec:0.1.9")
48-
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5")
50+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.6")
4951
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.6")
50-
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.6")
52+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.5")
53+
54+
// For versions less than or equal to 1.21.1
55+
forgeRuntimeLibrary("io.wispforest:endec:0.1.5.1")
56+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.3.1")
57+
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.3.1")
58+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.2")
5159
}
5260
```
5361

@@ -93,22 +101,30 @@ dependencies {
93101
#### Multiloader
94102

95103
::: code-group
96-
```kotlin [Common - Arch]
104+
```kotlin [Common - Arch Loom]
97105
dependencies {
98106
modImplementation("io.wispforest:accessories-common:${properties["accessories_version"]}")
99107
}
100108
```
101109

102-
```kotlin [Neoforge - Arch]
110+
```kotlin [Neoforge - Arch Loom]
103111
dependencies {
104112
modImplementation("io.wispforest:accessories-neoforge:${properties["accessories_version"]}")
105113

106114
// Required due to issues with JIJ dependency resolving in arch or something
107115
forgeRuntimeLibrary("blue.endless:jankson:1.2.2")
116+
117+
// For versions greater than or equal to 1.21.4
108118
forgeRuntimeLibrary("io.wispforest:endec:0.1.9")
109-
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5")
119+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.6")
110120
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.6")
111-
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.6")
121+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.5")
122+
123+
// For versions less than or equal to 1.21.1
124+
forgeRuntimeLibrary("io.wispforest:endec:0.1.5.1")
125+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.3.1")
126+
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.3.1")
127+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.2")
112128
}
113129
```
114130

components/version_cache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ export const insertVersion = async (owner: string, repo: string, selector: strin
2222
for (const element of elements) {
2323
element.innerHTML = element.innerHTML.replaceAll("...", version);
2424
}
25-
});
26-
25+
});

owo/config/synchronization.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ To enable config sync, simply apply the `@Sync` annotation to the option you wan
1414
- `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`
1515

1616
::: 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.
1820
:::
1921

2022
### Detached Options

owo/features.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ oωo offers a flexible system for automatically registering a class' fields into
88
## Networking
99
<VersionMarker version="^0.4.0" />
1010

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.
1312

1413
## [Item Groups](item-groups.md)
1514
<VersionMarker version="^0.2.0" />
@@ -24,7 +23,7 @@ oωo provides two main systems for handling particles. Primarily there's a clien
2423
## Debug/Dev Features
2524
<VersionMarker version="^0.3.0" />
2625

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.
2827

2928
## Moddata
3029
<VersionMarker version="^0.3.0" />
@@ -50,3 +49,21 @@ The `TagInjector` system allows you to inject entries into tags at runtime. Ther
5049
<VersionMarker version="^0.5.0" />
5150

5251
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+
<VersionMarker version="^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+
<VersionMarker version="^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+
<VersionMarker version="^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]()

owo/networking.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
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.
66

77
## 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.
99

1010
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.
1111

@@ -97,8 +97,9 @@ You might also wonder what the two parameters in the handler represent. It's qui
9797
9898
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.
9999
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+
:::
102103
103104
Once you obtained a handle, you can use it to send a packet:
104105
@@ -116,4 +117,24 @@ MyModInitializer.MY_CHANNEL.serverHandle(blockEntity).send(new MyPacket(1, "this
116117
```java [Client Example]
117118
MyModInitializer.MY_CHANNEL.clientHandle().send(new MyPacket(1, "this", new Identifier("is", "podge")));
118119
```
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(
129+
Endec.INT.fieldOf("index", MyPacket::index),
130+
Endec.STRING.fieldOf("name", MyPacket::name),
131+
MinecraftEndecs.IDENTIFIER.fieldOf("target", MyPacket::target),
132+
Endec.STRING.listOf().nullableOf().fieldOf("additional_names", MyPacket::additionalNames),
133+
MyPacket::new
134+
);
135+
}
136+
137+
MyModInitializer.MY_CHANNEL.addEndecs(builder -> {
138+
builder.register(MyPacket.ENDEC, MyPacket.class);
139+
});
140+
```

owo/setup.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525

2626
```groovy [build.gradle (Neoforge)]
2727
dependencies {
28-
// Vanilla/Moddev Projects - Neoforge
28+
// Moddev Projects - Neoforge
2929
implementation "io.wispforest:owo-lib-neoforge:${project.owo_version}"
3030
accessTransformer "io.wispforest:owo-lib-neoforge:${project.owo_version}"
3131
interfaceInjectionData "io.wispforest:owo-lib-neoforge:${project.owo_version}"
@@ -34,11 +34,19 @@ dependencies {
3434
modImplementation "io.wispforest:owo-lib-neoforge:${project.owo_version}"
3535
3636
// Required due to issues with Arch Loom and JIJ within neo. May require bumping the version every once and awhile.
37-
forgeRuntimeLibrary("io.wispforest:endec:0.1.8")
38-
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.4")
39-
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5")
40-
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.5")
4137
forgeRuntimeLibrary("blue.endless:jankson:1.2.2")
38+
39+
// For versions greater than or equal to 1.21.4
40+
forgeRuntimeLibrary("io.wispforest:endec:0.1.9")
41+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.5")
42+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.6")
43+
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.6")
44+
45+
// For versions less than or equal to 1.21.1
46+
forgeRuntimeLibrary("io.wispforest:endec:0.1.5.1")
47+
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.2")
48+
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.3.1")
49+
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.3.1")
4250
}
4351
```
4452

@@ -62,7 +70,17 @@ owo_version=...
6270
:::
6371

6472
::: info
65-
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.
6684
:::
6785

6886
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

Comments
 (0)