max-mapper / voxel-engine

3D HTML5 voxel game engine
http://maxogden.github.com/voxel-engine
BSD 3-Clause "New" or "Revised" License
1.29k stars 220 forks source link

Use game.materials.findIndex to find correct block type. Bump v0.16.3 #68

Closed shama closed 11 years ago

shama commented 11 years ago

game.materials.find('name') will return the actual index of the found material within game.materials but not the block type index.

So I added a new method to voxel-texture to fix this called game.materials.findIndex('name') and updated the test to simulate how textures are loaded into the materials API more closely.

Now doing game.setBlock([0, 0, 0], 'coal') will work correctly. My mistake!

max-mapper commented 11 years ago

thanks, published