Skip to content

Commit 60d4822

Browse files
committed
test: Add client scope to example mod
1 parent 9bbfef8 commit 60d4822

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fabric-example/src/main/java/net/blay09/mods/shogi/fabric/FabricShogiExample.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.blay09.mods.shogi.fabric;
22

33
import net.blay09.mods.shogi.Shogi;
4+
import net.blay09.mods.shogi.scope.ShogiScope;
45
import net.fabricmc.api.ModInitializer;
56
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
67
import net.minecraft.resources.Identifier;
@@ -16,6 +17,9 @@ public void onInitialize() {
1617
final var booleanValue = Shogi.booleanValue(id("boolean"), _ -> false).networked();
1718
final var nameValue = Shogi.componentValue(id("name"), Player::getName);
1819

20+
final var clientScope = Shogi.scope(id("client"), ShogiScope::loadOnClient);
21+
final var clientIntValue = clientScope.intValue(id("int"), _ -> 1337);
22+
1923
ServerTickEvents.START_SERVER_TICK.register(server -> {
2024
for (final var player : server.getPlayerList().getPlayers()) {
2125
if (player.isShiftKeyDown()) {
@@ -24,6 +28,7 @@ public void onInitialize() {
2428
System.out.println(stringValue.get(player));
2529
System.out.println(booleanValue.get(player));
2630
System.out.println(nameValue.get(player));
31+
System.out.println(clientIntValue.get(player));
2732
}
2833
}
2934
});

0 commit comments

Comments
 (0)