Skip to content

Commit 029785e

Browse files
committed
Added CustomRegistry#syncValues
1 parent c348e0a commit 029785e

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/main/java/dev/latvian/mods/klib/KLibMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void serverStarting(ServerStartingEvent event) {
4848

4949
@SubscribeEvent
5050
public static void syncDataPacks(OnDatapackSyncEvent event) {
51-
event.getRelevantPlayers().forEach(CustomRegistry::sync);
51+
event.getRelevantPlayers().forEach(CustomRegistry::syncAll);
5252
}
5353

5454
@SubscribeEvent

src/main/java/dev/latvian/mods/klib/registry/CustomRegistry.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static void buildAllMeta() {
7676
}
7777
}
7878

79-
public static void sync(ServerPlayer player) {
79+
public static void syncAll(ServerPlayer player) {
8080
var registryAccess = player.registryAccess();
8181
var platformType = PlatformHelper.CURRENT.getPlatformOf(player);
8282
var packets = new ArrayList<Packet<? super ClientGamePacketListener>>();
@@ -693,4 +693,10 @@ public ArgumentType<Ref<V>> createArgument(CommandBuildContext ctx) {
693693
var ops = ctx.createSerializationContext(NbtOps.INSTANCE);
694694
return new CustomRegistryArgument<>(ops, TagParser.create(ops), this);
695695
}
696+
697+
public void syncValues(ServerPlayer player) {
698+
var registryAccess = player.registryAccess();
699+
var platformType = PlatformHelper.CURRENT.getPlatformOf(player);
700+
player.connection.send(new ClientboundCustomPayloadPacket(new SyncCustomRegistryValuesPayload(writeValues(registryAccess, platformType))));
701+
}
696702
}

0 commit comments

Comments
 (0)