PrismarineJS / flying-squid

Create Minecraft servers with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/flying-squid/
MIT License
531 stars 99 forks source link

Using items #106

Open rom1504 opened 8 years ago

rom1504 commented 8 years ago

buckets, ... This should be plugged in block_place : check whether the player is using an item ( if(items[heldItem.id] ) and do stuff depending on the item.

rom1504 commented 8 years ago

So we mostly agreed on a pattern here with @demipixel . Have a "useItem", a "useBlock" and a "placeBlock" each emitted in the "block_place" packet listener. They should be emitted depending on some conditions (shift-clicking, what you are holding, what is where you are clicking)

These events/behaviors can be used for example in chest.js , for notes, and for all the various cases of item uses (see also #9 and "placing items" like bed/doors/...)

demipixel commented 8 years ago

It seems like "useBlock" will only really work on furnaces, crafting benches, chests, enchantment tables, etc (anything that opens a window, except for villagers, that's a useEntity)

EDIT: Also redstone stuff like pressing a button or pulling a lever