setLayer form and make easyPlace rules require paper named "easyPlace"

This commit is contained in:
ForestOfLight
2025-04-12 20:56:24 -07:00
Unverified
parent 8da6474b38
commit 6ced22b57b
8 changed files with 48 additions and 34 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ const ACTION_SLOT = 35;
const easyPlace = new Rule({
identifier: 'easyPlace',
description: { text: 'Simplifies placing blocks in a structure (paper in bottom right inventory slot).' },
description: { text: "Simplifies placing blocks in a structure (paper named 'easyPlace' in bottom right inventory slot)." },
onEnableCallback: () => { world.beforeEvents.playerPlaceBlock.subscribe(onPlayerPlaceBlock); },
onDisableCallback: () => { world.beforeEvents.playerPlaceBlock.unsubscribe(onPlayerPlaceBlock); }
})
@@ -29,7 +29,7 @@ function hasActionItemInCorrectSlot(player) {
if (!inventory)
return false;
const actionSlot = inventory.getSlot(ACTION_SLOT);
return actionSlot.hasItem() && actionSlot.typeId === 'minecraft:paper';
return actionSlot.hasItem() && actionSlot.typeId === 'minecraft:paper' && actionSlot.nameTag === 'easyPlace';
}
function fetchStructureBlock(location) {