mineflayer-mouse
Version:
First-class **battle-tested** simple API for emulating real Minecraft mouse control in Mineflayer. You should use it for digging (mining) or placing blocks and entity attacking or using and using items!
48 lines (47 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.itemToBlockRemaps = exports.activatableBlockWithoutItemPatterns = void 0;
exports.isBlockActivatable = isBlockActivatable;
// these have
// protected InteractionResult useWithoutItem
// but not protected InteractionResult useItemOn
exports.activatableBlockWithoutItemPatterns = [
// Containers
/^(barrel|hopper|dispenser|dropper)$/,
/^.*chest$/,
/^.*shulker_box$/,
/^.*(furnace|smoker)$/,
/^(brewing_stand|beacon)$/,
// Crafting
/^.*table$/,
/^(grindstone|stonecutter|loom|smithing_table|cartography_table)$/,
/^.*anvil$/,
// Redstone
/^(lever|repeater|comparator|daylight_detector|observer|note_block|jukebox|bell)$/,
// Buttons
/^.*button$/,
// Doors, gates and trapdoors
/^.*door$/,
/^.*trapdoor$/,
/^.*fence_gate$/,
// Functional blocks
/^(enchanting_table|lectern|composter|respawn_anchor|lodestone|conduit)$/,
/^.*bee.*$/,
// Beds
/^.*bed$/,
// Technical blocks
/^(command_block|jigsaw|structure_block|moving_piston)$/,
// Plants and natural blocks
/^(dragon_egg|flower_pot|sweet_berry_bush|cave_vines.*|.*candle.*)$/,
// Misc
/^(cake|decorated_pot|crafter|trial_spawner|vault)$/,
// fence (ignore)
// sign (ignore)
];
exports.itemToBlockRemaps = {
redstone: 'redstone_wire',
tripwire_hook: 'tripwire'
};
function isBlockActivatable(blockName) {
return exports.activatableBlockWithoutItemPatterns.some(pattern => pattern.test(blockName));
}