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
@@ -11,7 +11,7 @@ const builderOption = new BuilderOption({
identifier: 'fastEasyPlace',
displayName: 'Fast Easy Place',
description: 'Place correct structure blocks just by looking at them.',
howToUse: "Look at structure blocks with a paper named 'Easy Place' in your hand to place them.",
howToUse: "Hold a paper named 'Easy Place' in your hand and look at blocks in a structure to place them."
});
system.runInterval(onTick, PROCESS_INTERVAL);
@@ -37,7 +37,9 @@ function isHoldingActionItem(player) {
const mainhandItemStack = player.getComponent(EntityComponentTypes.Equippable).getEquipment(EquipmentSlot.Mainhand);
if (!mainhandItemStack)
return false;
return mainhandItemStack.typeId === 'minecraft:paper' && mainhandItemStack.nameTag === 'Easy Place';
return mainhandItemStack.typeId === 'minecraft:paper'
&& mainhandItemStack.nameTag?.toLowerCase().includes('easy')
&& mainhandItemStack.nameTag?.toLowerCase().includes('place');
}
function tryPlaceBlock(player, worldBlock, structureBlock) {