mojira.dev
MCPE-237577

Vanilla dyeable items do not have ItemDyeableComponent in scripting

The @minecraft/server scripting API’s item component ItemDyeableComponent does not exist on Vanilla dyeable items. This bug affects any Vanilla dyeable item, including leather armor and leather horse armor.

Demonstration

The attached video demonstrates the issue. A script is run whenever a button is pressed in the world. The script looks at the held item in the main hand slot of the first player in the roster. If an item is held, a log is emitted indicating whether the item has the ItemDyeableComponent component.

Vanilla items always reports as undefined, as shown in the video. This happens even after manually dyeing the items.

Reproduction

The following script is sufficient for testing this bug:

const
	player = world.getAllPlayers()[0],
	itemSlot = player
	.getComponent(EntityEquippableComponent.componentId)
	?.getEquipmentSlot(EquipmentSlot.Mainhand)
if (!itemSlot) {console.warn("No equipment slot."); return}

const itemStack = itemSlot.getItem()
if (!itemStack) {console.warn("No held item."); return}

const dyeableComponent = itemStack.getComponent(ItemDyeableComponent.componentId)
if (!dyeableComponent) {console.warn("Held item not dyeable."); return}

The demo video and code are taken from the behavior pack in the attached world for convenience. This world can be opened (in Minecraft Preview) for inspection or unzipped to access the code associated with such. Ensure that content logs are enabled with at least the “Warn” log level.

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media][media]

Ciosciaa

(Unassigned)

Unconfirmed

Multiple

26.20.22 Preview

Retrieved