make item names non-case-and-whitespace-sensitive

This commit is contained in:
ForestOfLight
2025-06-07 02:06:42 -07:00
Unverified
parent 9aa8e9d009
commit e4fa6d115c
3 changed files with 13 additions and 7 deletions
@@ -8,7 +8,7 @@ const builderOption = new BuilderOption({
identifier: 'materialGrabber',
displayName: 'Material Grabber',
description: 'Pulls structure items from inventories.',
howToUse: "Interact with inventories using an item named 'Material Grabber' to pull structure items from them.",
howToUse: "Interact with inventories using an item named 'Material Grabber' to pull structure items from them."
});
world.beforeEvents.itemUse.subscribe(onItemUse);
@@ -40,7 +40,8 @@ function onPlayerInteract(event) {
}
function isActionItem(itemStack) {
return itemStack?.nameTag === 'Material Grabber';
return itemStack?.nameTag?.toLowerCase().includes('material')
&& itemStack?.nameTag?.toLowerCase().includes('grabber');
}
function getActiveMaterials(player) {