Code Monkey home page Code Monkey logo

Comments (9)

andrewrk avatar andrewrk commented on August 16, 2024

There's a little bit of a gotcha with 0x38. If you look at protocol.js you can see that all those properties are namespaced under the "data" variable. Also those other length and count properties are implied from the meta array and the compressed chunk data buffer length. So if you're sending 0x38, you have to do something like this:

client.write(0x38, {data: {
    skyLightSent: true,
    compressedChunkData: world,
    meta: []
  }});

from node-minecraft-protocol.

Pablo-Merino avatar Pablo-Merino commented on August 16, 2024

Woah, didn't noticed! Still, it's failing with TypeError: Cannot read property 'length' of undefined on the same line, so I guess my code to create the world it's broken. Is there any specific way to create the data for a world? Or any guideline to code something that generates the world? I've been reading http://wiki.vg/SMP_Map_Format but I don't really understand how should I translate the parameters there to the code

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on August 16, 2024

did you set [] for meta instead of null?

from node-minecraft-protocol.

Pablo-Merino avatar Pablo-Merino commented on August 16, 2024

Yes, I did. Basically I copied the code example, changing variables, of course

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on August 16, 2024

@mappum might be willing to provide a code example. I know he has a server using this module.

from node-minecraft-protocol.

Pablo-Merino avatar Pablo-Merino commented on August 16, 2024

That'd be great! I've seen his redstone.io project and seems really promising!

from node-minecraft-protocol.

Pablo-Merino avatar Pablo-Merino commented on August 16, 2024

Update: after fiddling around the code and searching on GH, I've managed to put this 0x38 function which doesn't crashes the server. If I fly a little I finally find a grass block. This is what it looks currently: http://d.pr/i/UrAg. I guess it's now time to see how to make the map bigger and all.

This is the code:

var buffer = new Buffer((4096 + 2048 + 2048 + 2048) * 4 + 256);
  buffer.fill(0);
  buffer.writeUInt8(2, 8192 + 273);
  zlib.deflate(buffer, function(err, compressed) {

    client.write(0x38, {data: {
      skyLightSent: true,
      compressedChunkData: compressed,
      meta: [{
        x: 0,
        z: 0,
        bitMap: parseInt('00111100', 2),
        addBitMap: 0,
      }]
    }});

  });

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on August 16, 2024

Do you still need help, or may I close this issue?

from node-minecraft-protocol.

Pablo-Merino avatar Pablo-Merino commented on August 16, 2024

Nope, it's already fixed 😄

from node-minecraft-protocol.

Related Issues (20)

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.