mojira.dev
MC-109593

Debug world spamming "Tried to assign a mutable BlockPos to a block entity" warnings

Affects any version 1.10.2 and forward, in a Debug world. Not sure about 1.10.1, since that was the crashing one.

Doesn't matter in what version the world was created. Happens in any gamemode, Spectator included.

Just open the world, and the following is spammed in the Game Output:

[17:00:46] [Chunk Batcher 4/WARN]: Tried to assign a mutable BlockPos to a block entity...
java.lang.Error: class co$a
	at arz.a(SourceFile:259) [16w44a.jar:?]
	at aul.a(SourceFile:657) [16w44a.jar:?]
	at ajp.a(SourceFile:1941) [16w44a.jar:?]
	at aul.a(SourceFile:636) [16w44a.jar:?]
	at ajy.a(SourceFile:68) [16w44a.jar:?]
	at ajy.r(SourceFile:60) [16w44a.jar:?]
	at bey$5.a(SourceFile:51) [16w44a.jar:?]
	at bey.a(SourceFile:189) [16w44a.jar:?]
	at bqz.a(SourceFile:238) [16w44a.jar:?]
	at bqz.c(SourceFile:113) [16w44a.jar:?]
	at bqz.a(SourceFile:51) [16w44a.jar:?]
	at bqz.a(SourceFile:42) [16w44a.jar:?]
	at bqx.a(SourceFile:65) [16w44a.jar:?]
	at btb.b(SourceFile:178) [16w44a.jar:?]
	at bsx.a(SourceFile:100) [16w44a.jar:?]
	at bsx.run(SourceFile:43) [16w44a.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]

Submitted in case this indicates a wider issue than just a debug-world thing.

Linked issues

Comments 1

I looked into this, and from my understanding there's not an actual "problem".

The code pretty much is behaving as it should, but Mojang added a "warning" here even though this code path should be expected.

To "avoid" this would defeat the purpose of the mutable positions as you would have to defensive clone it before passing it to another method.

My suggestion is to remove this debug, and ensure anytime a block position is set to a field, to do something like

pos.cloneIfMutable(); where immutable pos will return self and Mutable overrides and clones.

Then we have assurance that mutables will not be stored into fields.

shufboyardee

Erik Broes

Confirmed

Minecraft 1.10.2, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11, Minecraft 16w50a

Minecraft 1.11.1

Retrieved