Patched

Patched

23.1k Downloads

Failure to load packs that contain filters

Estecka opened this issue ยท 1 comments

commented

Hi,

When I try loading a datapack that contains a filter list, Patched will throw an error, which subsequently prevents the game from loading the pack at all. The pack does not even need to include patches or declare patched:has_patches to trigger the issue.

This time, the issue is not related to the packs being built into my mod. The same happens with packs loaded from the world folder.

To reproduce, simply add this snippet to pack.mcmeta, and try loading the pack:

{
	"pack": {
		// ...
	},
	"filter": {
		"block": [
			{ "namespace": "minecraft", "path":"recipes/painting.json" }
		]
	}
}

The log contains a bunch of repeating errors for what seems to be every json in the game: (full log)

[01:32:48] [Render thread/ERROR] (Minecraft) Registry loading errors:
> Errors in registry minecraft:chat_type:
>> Errors in element minecraft:chat:
java.lang.IllegalStateException: Failed to parse minecraft:chat_type/chat.json from pack vanilla
	at net.minecraft.registry.RegistryLoader.load(RegistryLoader.java:179)
 	// <snip>
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.resource.ResourcePack.getName()" because "pack" is null
	at net.enderturret.patchedmod.fabric.FabricPlatform.getName(FabricPlatform.java:65)
	at net.enderturret.patchedmod.util.MixinCallbacks$Entry.<init>(MixinCallbacks.java:270)
	at net.enderturret.patchedmod.util.MixinCallbacks$Entry.<init>(MixinCallbacks.java:266)
	at net.enderturret.patchedmod.util.MixinCallbacks.patch(MixinCallbacks.java:104)
	at net.enderturret.patchedmod.util.MixinCallbacks.patch(MixinCallbacks.java:77)
	at net.enderturret.patchedmod.util.MixinCallbacks.lambda$chain$0(MixinCallbacks.java:58)
	at net.enderturret.patchedmod.util.PatchingInputStream.transform(PatchingInputStream.java:30)
	at net.enderturret.patchedmod.util.PatchingInputStream.read(PatchingInputStream.java:66)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177)
	at java.base/java.io.BufferedReader.fill(BufferedReader.java:162)
	at java.base/java.io.BufferedReader.read1(BufferedReader.java:213)
	at java.base/java.io.BufferedReader.read(BufferedReader.java:287)
	at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1349)
	at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1387)
	at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1665)
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:543)
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:433)
	at com.google.gson.internal.Streams.parse(Streams.java:47)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:102)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:70)
	at net.minecraft.registry.RegistryLoader.load(RegistryLoader.java:174)
	... 33 more

I observed the issue on Minecraft 1.20.1 and 1.20.2, using Patched 3.2.2 and 3.2.1.

However no error occurred when I tested on 1.19.4 using 1.19.3-1.0.2; everything works as expected on this version. Don't know if this is due to a difference in Patched or in Minecraft though.

commented

Should be fixed as of 3.2.3+1.20.1.