mojira.dev
MC-61864

/fill x1 y1 z1 x2 y2 z2 [tile entity] replace [block] gives parse error

The problem occurs if running via command block and normally via chat.

Steps to reproduce the problem:
1. Place a command block with fill ~ ~1 ~ ~ ~1 ~ minecraft:unpowered_comparator 3 replace minecraft:diamond_block
2. Place a diamond block on top
3. Activate the command block

Expected behaviour:
The diamond block gets turned into comparator

Actual behaviour:
Error message
Data tag parsing failed: Invalid tag encountered, expected '{' as first char.

Additional information:
The command fill ~ ~1 ~ ~ ~1 ~ minecraft:unpowered_comparator 3 works.
It also works with block other than unpowered_comparator.
According to the wiki the command expects fill <x1> <y1> <z1> <x2> <y2> <z2> <TileName> <dataValue> replace [replaceTileName] [replaceDataValue].

Linked issues

MC-48114 /fill and /setblock replace not working correctly with underscores. Resolved MC-48285 "/fill ... replace ..." doesn't parse correctly for blocks that support data tags Resolved MC-50117 /fill with Flowerpots Resolved MC-50153 fill flowerpot 0 replace air not workin Resolved MC-50362 /fill cannot replace commandblocks,brewingstand, ect Resolved

Comments 14

Sebastian Grygiel

Somebody attached a duplicate link to a different issue. I don't know how to remove the link.

The issue described there is affecting all blocks with underscore and it simply cannot find them.

This issue affects unpowered_comparator and not, for example, unpowered_repeater. The error message is completely different.

That someone was me.
You're describing exactly the behaviour of MC-48114.

Sebastian Grygiel

MC-48114 clearly states that the command doesn't work for any block with an underscore within its name. It points out in an example that it doesn't work for lapis_ore. The error message clearly says that it began to parse lapis_ore as json and cannot find key-value separator (:).

This is different issue. I can confirm that this command works with lapis_ore or several other blocks with an underscore within its name. The issue occurs only with unpowered_comparator (out of tested blocks). The error message also says something different - it expects a json string but it doesn't start parsing it. It says that it expects { which is nowhere to be found.

Please, point me to a part that makes the issues similar apart from the command used and the fact that unpowered_comparator actually contains an underscore and this has nothing to do with it as, at least in 14w28b, the command fill ~ ~1 ~ ~ ~1 ~ minecraft:unpowered_repeater 3 replace minecraft:diamond_block works - the problem only occurs with unpowered_comparator.

Sounds plausible. Reopened.

Confirmed.

4 more comments

I was bashing my head around for a while trying to figure out why it wasn't working right. Certainly would be nice to see in the future at some point.

The suggested syntax is at least wrong:

/fill <x1> <y1> <z1> <x2> <y2> <z2> <name> [<data>] [replace [<FilterblockName> [<FilterblockMetadata>]]|destroy|keep|hollow|outline] [<NBT-Data>]

It should be:

/fill <x1> <y1> <z1> <x2> <y2> <z2> <name> [<data>] [replace [<FilterblockName> [<FilterblockMetadata>]]|replace|destroy|keep|hollow|outline [<NBT-Data>]]

Question: Can you revamp the command so that it is /fill <coordinates> <name> [dataValue|state] replace [<blockToReplace> [dataValue|-1|state|*]] [fillBlockDataTag]?
(It is easy to detect a <code>{</code> vs a different character for starting an item technical name in my opinion)

So, if you wanted to replace wood planks with chests (with a bow inside) between 0, 0, 0 and 1, 1, 1, you would do {{/fill 0 0 0 1 1 1 chest 0 replace planks * {Items:[0:{Slot:0,Item:"minecraft:bow",Count:1b,Damage:0s}]} }}.

However, if you wanted to fill chests regardless of planks, you would remove the planks *.

Yeah, I'd have to agree that this is more of a "Won't Fix" rather than "Works as Intended".

I found a way around it, but only if you want to target a specific block, not a group of blocks. You could probably make it target different things though to have the same effect as an "AOE."

/execute ~ ~ ~ detect ~ ~1 ~ minecraft:diamond_block /fill ~ ~1 ~ ~ ~1 ~ minecraft:unpowered_comparator 3 replace

Sebastian Grygiel

michael

Confirmed

Minecraft 14w28b, Minecraft 14w29a, Minecraft 14w29b, Minecraft 1.11.2

Retrieved