Skip to content

nbtTypeCheck

SPGoding edited this page May 13, 2020 · 2 revisions

Rule Details

⚠️ Diagnostic: this is a diagnostic rule used by the diagnostic feature.

🔧 Fixable: violations of this rule can be fixed by Code Actions.

Check the types of the NBT values.

  • ("strictly"): the type of your NBT values should match exactly what they should be.
  • ("loosely"): bytes, shorts, longs, floats, and doubles can be written as integers as long as they are not in an NBT predicate.

Examples

Default

{
    "nbtTypeCheck": ["warning", "loosely"]
}

👍 Good

summon minecraft:armor_stand ~ ~ ~ {Invisible: 1b}
summon minecraft:armor_stand ~ ~ ~ {Invisible: 1}
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1b}]

👎 Bad

summon minecraft:armor_stand ~ ~ ~ {Invisible: "haha"}
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1}]

Strictly

{
    "nbtTypeCheck": ["warning", "strictly"]
}

👍 Good

summon minecraft:armor_stand ~ ~ ~ {Invisible: 1b}
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1b}]

👎 Bad

summon minecraft:armor_stand ~ ~ ~ {Invisible: "haha"}
summon minecraft:armor_stand ~ ~ ~ {Invisible: 1}
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1}]

Disabled

{
    "nbtTypeCheck": null
}

👍 Good

summon minecraft:armor_stand ~ ~ ~ {Invisible: "haha"}
summon minecraft:armor_stand ~ ~ ~ {Invisible: 1b}
summon minecraft:armor_stand ~ ~ ~ {Invisible: 1}
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1b}]
execute if entity @e[type=minecraft:armor_stand,nbt={Invisible: 1}]

History

Version Description
2.0.0 Firstly introduced this rule.
2.0.1 Change the default setting to loosely from strictly.
Clone this wiki locally