How to make a command block summon an end crystal on top of said command block in Minecraft 1.14.1

I want to put a command into a command block that will spawn an invulnerable end crystal directly on top of the command block relative to the command block's location in world.

This is the current command I am putting in the command block minus any tag for offset since the offset is what I am trying to figure out.

/summon minecraft:end_crystal ~ ~1 ~ {PersistenceRequired:1b,Attributes:[{Name:"generic.knockbackResistance",Base:1f}],Invulnerable:1}

Specific question: How do I put an offset in the command block command in order to get my desired result above?


Solution 1:

It seems to me like you've answered yourself, as you already have an "offset" in the command (the ~ ~1 ~ part).

If the question is towards the base of the end crystal being inside the command block, that's just because of it's unusually sized hitbox and texture. To fix this I made the command block summon the end crystal 0.5 blocks higher up, and the output was this:

End Crystal on top of Command Block

Either way, the command you supplied works perfectly fine in 1.14.1.