setLayer form and make easyPlace rules require paper named "easyPlace"
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Raycaster } from '../classes/Raycaster';
|
||||
let runner = void 0;
|
||||
const easyPlace = new Rule({
|
||||
identifier: 'fastEasyPlace',
|
||||
description: { text: 'Looking at structure blocks with paper in your hand will place them.' },
|
||||
description: { text: "Looking at structure blocks with paper named 'easyPlace' in your hand will place them." },
|
||||
onEnableCallback: () => { runner = system.runInterval(onTick, 2); },
|
||||
onDisableCallback: () => { system.clearRun(runner); }
|
||||
})
|
||||
@@ -35,7 +35,7 @@ function isHoldingActionItem(player) {
|
||||
const mainhandItemStack = player.getComponent(EntityComponentTypes.Equippable).getEquipment(EquipmentSlot.Mainhand);
|
||||
if (!mainhandItemStack)
|
||||
return false;
|
||||
return mainhandItemStack.typeId === 'minecraft:paper';
|
||||
return mainhandItemStack.typeId === 'minecraft:paper' && mainhandItemStack.nameTag === 'easyPlace';
|
||||
}
|
||||
|
||||
function tryPlaceBlock(player, worldBlock, structureBlock) {
|
||||
|
||||
Reference in New Issue
Block a user