mojira.dev
MC-270964

Race condition in can_break/can_place_on item stack components

When loading a datapack with a command that uses the can_break/can_place_on item stack components with a block tag, there's a race between the thread loading the block tags and the thread loading the functions, leading to the following error when parsing the command:

[15:56:44] [Server thread/ERROR]: Failed to load function test:a
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Could not parse command: null at position 82: ...my_tag"}]}<--[HERE]
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Could not parse command: null at position 82: ...my_tag"}]}<--[HERE]
	at ib.a(SourceFile:80) ~[server-1.20.5-rc2.jar:?]
	at alt.a(SourceFile:83) ~[server-1.20.5-rc2.jar:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
	... 6 more

To reproduce, create a custom block tag e.g. #test:my_tag.
And a bunch of mcfunction files with the following command

give @s minecraft:stone[minecraft:can_break={predicates:[{blocks:"#test:my_tag"}]}]

See the attached datapack

Attachments

Comments 0

No comments.

chokoboy3

gegy

Confirmed

Platform

Important

Data Packs

1.20.5 Release Candidate 2

1.20.5 Release Candidate 3

Retrieved