js
module.exports.server = function(serv) { // Create your server events here
serv.onItemPlace('stone', () => {
console.log('stone');
});
};
I get TypeError: serv.onItemPlace is not a function
73dd100d6f29c9e8b053e6f176da339254df102f/src/lib/plugins/redstone.js
111 const notifyEndOfLine = async (world, pos, dir, tick) => {
112 const blockPos = pos.plus(dir)
113 const block = await world.getBlock(blockPos)
114 if (isSolid(block) && await isWireDirectedIn(world, pos, dir)) {
115 serv.updateBlock(world, blockPos, tick, tick)
116 serv.notifyNeighborsOfStateChangeDirectional(world, pos, dir, tick, tick)
117 }
118 }
119
>120 serv.on('asap', () => {
121 serv.onItemPlace('redstone', () => {
122 return { id: redstoneWireType, data: 0 }
123 })
124
125 serv.onItemPlace('redstone_torch', ({ direction }) => {
126 const directionToData = [0, 5, 4, 3, 2, 1]
127 // Placing an unlit torch allows to detect change on the first update
128 // and reduce the block updates
129 return { id: unlitRedstoneTorchType, data: directionToData[direction] }
js
const spawnedEntity = serv.spawnObject(entity.id, serv.getPlayer('user').world, serv.getPlayer('user').position, {
velocity: new Vec3((Math.random() - 0.5) * 10, Math.random() * 10 + 10, (Math.random() - 0.5) * 10)
});
console.log(spawnedEntity);
returns undefined