mojira.dev
MC-136975

Type uniformity for the level of enchantement

I've noticed this bug while I was trying to detect the level of enchantment of a bow.
It seems that you can set the level of an enchantment both with an integer, and a string :

First, I added an enchantment to my bow :

/enchant @s minecraft:power 4

Then, I tried to detect the bow as it is in my hand :

/say @s[nbt={Inventory:[{id:"minecraft:bow",tag:{Enchantments:[{id:"minecraft:power",lvl:4s}]}}]}] got the bow power 4!

It returned (chat display) : [Piccomaster] Piccomaster got the bow power 4!

But, as I tried to generate a more customised bow, I omitted specifying the type of the level :

/give @s minecraft:bow{Damage:383,Enchantments:[{id:"minecraft:power",lvl:4}],Unbreakable:1,display:{Name:""Custom bow""}} 1

(you can see that the "s" after the level number in {id:"minecraft:power",lvl:4} is missing) So as I did my test again : 

/say @s[nbt={Inventory:[{id:"minecraft:bow",tag:{Enchantments:[{id:"minecraft:power",lvl:4s}]}}]}] got the bow power 4!

It returned (chat display) : [Piccomaster] got the bow power 4!

 

Strangely, if I use :

/say @s[nbt={Inventory:[{id:"minecraft:bow",tag:{Enchantments:[{id:"minecraft:power",lvl:4}]}}]}] got the bow power 4!

(omitting the "s" again)

It will return : [Piccomaster] Piccomaster got the bow power 4!

 

So the level can be both registered with or without the "s", but the detection will work differently in those two cases. I thought it was a bug, so I tried this :

/give @s minecraft:bow{Enchantments:[{id:"minecraft:power",lvl:4s},{id:"minecraft:power",lvl:4}],display:{Name:""Custom bow""}} 1

And guess what : (see the photo)

Linked issues

Attachments

Comments 0

No comments.

TARDIO Gaël

(Unassigned)

Unconfirmed

detection, enchantment, level, nbt, value

Minecraft 1.13.1

Retrieved