Add item_model data component support for tokens

This commit is contained in:
PurpleGale
2026-04-24 03:57:05 +03:00
parent 7b10ed61ae
commit 70caa9e145
5 changed files with 137 additions and 2 deletions

View File

@@ -238,6 +238,21 @@ public class TokenData {
}
}
// set the item model
if (tokenConfig.getBoolean("item-model.enabled")) {
String itemModelValue = tokenConfig.getString("item-model.value");
if (itemModelValue == null || itemModelValue.isEmpty()) {
toolStats.logger.info("Could not find item model value for token {}", tokenType);
return null;
}
NamespacedKey itemModelKey = NamespacedKey.fromString(itemModelValue);
if (itemModelKey == null) {
toolStats.logger.info("{} is not a valid namespaced key!", itemModelValue);
return null;
}
token.setData(DataComponentTypes.ITEM_MODEL, itemModelKey);
}
return token;
}