Giter Club home page Giter Club logo

mineflayer-item-map-downloader's Introduction

Mineflayer map downloader

Automatically downloads item maps when in render distance of an item frame with a map in it or if a map is in the bots inventory.

In game image of the map

Downloaded image of the map

Notice: some colors for pre 1.12 might be slightly wrong

Supported minecraft versions

1.8.x - 1.20

Installing

  1. Install the plugin with npm
npm i --save mineflayer-item-map-downloader
  1. Load the plugin with the mineflayer plugin API
const { mapDownloader } = require('mineflayer-item-map-downloader')

bot.loadPlugin(mapDownloader) // load it before spawning to get all maps

Examples

Look at the examples folder for out of the box examples.

API

bot.mapDownloader.activate()

Activates map downloading. The downloader is active by default. Note: This function is only available after inject_allowed has fired.

bot.mapDownloader.deactivate()

Deactivate map downloading. Note: This function is only available after inject_allowed has fired.

Options

This plugin extends the BotOptions type from mineflayer. Add them to the createBot options when creating the bot. You can also change them later by changing the bot.mapDownloader properties.

Example for an option

const bot = mineflayer.createBot({
  "mapDownloader-outputDir": "some/output/dir"
})

"mapDownloader-outputDir"

  • Sets an output directory where maps should be saved. Maps are saved in the format map_<map id>.png where the map id has leading zeros.

"mapDownloader-saveToFile"

  • If maps should be saved to file. If false maps are only stored internally. Usefull if you only want to look at maps with the web viewer. Default is true

"mapDownloader-saveInternal"

  • If maps should be saved under maps. When downloading many maps this could prevent the process from using to much memory.

"mapDownloader-filePrefix"

  • Saved maps file prefix

"mapDownloader-fileSuffix"

  • Saved maps file suffix

Events

(new_map, { name, png, id })

  • Emitted by the mapSaver and the bot when a new map was detected.
  • Parses an object when emitted:
    • name - String. The name that would be given to this map.
    • png - Buffer. The png Buffer of the created map.
    • id - Number. The map id off the map.

(new_map_saved, { name, id })

  • Emitted by the mapSaver and the bot when a new map was saved.
  • Emitted only when saveToFile is true.
  • Parses an object when emitted:
    • name - String. The name that would be given to this map.
    • id - Number. The map id off the map.

mineflayer-item-map-downloader's People

Contributors

icetank avatar ulcuber avatar zardoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mineflayer-item-map-downloader's Issues

1.20 support

Hi,
I'd like to use this for a 1.20 server. Would it be possible to support this version?
I see that for 1.19 the only thing that needed to be done was add a single line of code to lib/util.js (a82d6f7), will that be sufficient for 1.20 too?

Thanks in advance

Version issue

image

Fix: util.js ->
if (!supportedVersions.includes(version.split('.').slice(0,2).join('.'))) throw new Error......

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.