HideFlags function
HideFlags method. It translates the human readable boolean values into an int.
HideFlags | bools |
---|---|
enchant | whether to show the enchantments |
attributes | whether to show the attributes |
unbreakable | whether to show the unbreakable tag |
canDestroy | whether to show the canDestroy tag |
canPlaceOn | whether to show the canPlaceOn tag |
others | whether to show other nbt information |
dye | whether to show Dyed on leather armor |
armorTrims | whether to show Upgrade on armors |
Example:
var flags = HideFlags(attributes:true, unbreakable: true, others: true); // = 38
...
Item(Items.apple,hideFlags: flags)
Implementation
int HideFlags({
/// whether to show the enchantments
bool enchantments = false,
/// whether to show the attributes
bool attributes = false,
/// whether to show the unbreakable tag
bool unbreakable = false,
/// whether to show the canDestroy tag
bool canDestroy = false,
/// whether to show the canPlaceOn tag
bool canPlaceOn = false,
/// whether to show other nbt information
bool others = false,
/// whether to show Dyed on leather armor
bool dye = false,
/// whether to show Upgrade on armors
bool armorTrims = false,
}) {
var res = 0;
if (enchantments) res += 1;
if (attributes) res += 2;
if (unbreakable) res += 4;
if (canDestroy) res += 8;
if (canPlaceOn) res += 16;
if (others) res += 32;
if (dye) res += 64;
if (armorTrims) res += 128;
return res;
}