// <--[tag]
// @attribute <i@item.potion_color>
// @returns dColor
// @mechanism dItem.potion_color
// @group properties
// @description
// Returns the color of this potion item.
// -->
if (attribute.startsWith("potion_color") {
return new dColor(((PotionMeta)item.getItemStack().getItemMeta()).getColor()).getAttribute(attribute.fulfill((1)));
}
...
// <--[mechanism]
// @object dItem
// @name potion_color
// @input dColor
// @description
// Sets the potion's color.
// @tags
// <i@item.potion_color>
// -->
if (mechanism.matches("potion_color")) {
dColor data = mechanism.getValue().asType(dColor.class);
if (data == null) {
dB.echoError("Invalid dColor '" + data + "'");
}
else {
PotionMeta meta = (PotionMeta)item.getItemStack().getItemMeta();
meta.setColor(data.getColor());
item.getItemStack().setItemMeta(meta);
}
}