Fabric API

Fabric API

152M Downloads

Fabric sending different RegistrySyncManager packet when item is added

Dioswilson opened this issue ยท 4 comments

commented

minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.16.14
fabric_version=0.87.2+1.19.4

When adding an item with Registry.register(Registry<V> registry, Identifier id, T entry), this method inside RegistrySyncManager sends different packet:

	private static void sendPacket(ServerPlayerEntity player, RegistryPacketHandler handler) {
		Map<Identifier, Object2IntMap<Identifier>> map = RegistrySyncManager.createAndPopulateRegistryMap(true, null);

		if (map != null) {
			handler.sendPacket(player, map);
		}
	}

It not only adds the items I registered, it also sends items that wasn't being sent before. In this case, pottery items which depend on FeatureFlags.UPDATE_1_20.

It can easly be fixed by just manually removing pottery entries from the packet just as I was doing with the items in my namespace.

I noticed by usinig 1.20.1's ViaFabricPlus which didn't let you join the world and threw the following error (which didn't happen before adding items):

[00:21:57] [Render thread/ERROR]: Registry entry (minecraft:pottery_shard_prize) is missing from local registry (minecraft:item)
[00:21:57] [Render thread/ERROR]: Registry entry (minecraft:pottery_shard_arms_up) is missing from local registry (minecraft:item)
[00:21:57] [Render thread/ERROR]: Registry entry (minecraft:pottery_shard_skull) is missing from local registry (minecraft:item)
[00:21:57] [Render thread/ERROR]: Registry remapping failed!
net.fabricmc.fabric.impl.registry.sync.RemapException: Received 4 registry entries that are unknown to this client.
This is usually caused by a mismatched mod set between the client and server. See the client logs for more details.
The following registry entry namespaces may be related:

minecraft

	at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.checkRemoteRemap(RegistrySyncManager.java:388) ~[fabric-registry-sync-v0-2.3.3+1802ada577-bfed0ebc340fa6c1.jar:?]
	at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.apply(RegistrySyncManager.java:284) ~[fabric-registry-sync-v0-2.3.3+1802ada577-bfed0ebc340fa6c1.jar:?]
	at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.lambda$receivePacket$0(RegistrySyncManager.java:118) ~[fabric-registry-sync-v0-2.3.3+1802ada577-bfed0ebc340fa6c1.jar:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
	at net.minecraft.class_1255.method_18859(class_1255.java:156) ~[client-intermediary.jar:?]
	at net.minecraft.class_4093.mixinextras$bridge$method_18859$5(class_4093.java) ~[client-intermediary.jar:?]
	at net.minecraft.class_4093.wrapOperation$dlf000$carpet-tis-addition$yeetUpdateSuppressionCrash_implForThreadExecutorTaskExecuting(class_4093.java:570) ~[client-intermediary.jar:?]
	at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.method_16075(class_1255.java:130) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.method_5383(class_1255.java:115) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1175) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480) ~[fabric-loader-0.16.14.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.16.14.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.16.14.jar:?]
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[NewLaunch.jar:?]
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[NewLaunch.jar:?]
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
	at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
[00:21:57] [Render thread/INFO]: pcaSyncProtocol onDisconnect.
commented

It should only attempt to sync a registry when it has been marked as modded (usually by a mod adding an item).

commented

Really seems like works as intended, just a cross version conflict

commented

This technically works as intended, as fabric needs to send all registry entries and their ids to map them on client correctly.
Issue here is that the items have different ids between versions, preventing you from joining (which also works as intended)

commented

So fabric doesn't even try to sync up if no item was added to the player? If so can that "automatic sync" be disabled?