PrismarineJS / prismarine-block

Represent a minecraft block with its associated data
29 stars 31 forks source link

Set metadata to 0 when not defined #57

Closed IceTank closed 2 years ago

IceTank commented 2 years ago

When metadata is not given in the Block constructor it should default to 0 instead of undefined. undefined can lead to math errors that can lead to other modules treating metadata as NaN messing up a lot of things. stateId is already handled when not defined so metadata should too.

rom1504 commented 2 years ago

Ok, can you fix the lint?

IceTank commented 2 years ago

Should I also set a default value for Biome? Or does new Biome already have a default when you give it undefined as an argument?

IceTank commented 2 years ago

Lint is fine. It seams like Bedrock test for instant mine are failing. Idk it that has something to do with the change tho.

IceTank commented 2 years ago

Tests are failing on master too. It seams like this change has nothing to do with failing tests.

rom1504 commented 2 years ago

Not this only hides a bug in code not handling metadata properly

rom1504 commented 2 years ago

I think biome has a default