Skip to content

Commit

Permalink
Adds Diamond Slab example
Browse files Browse the repository at this point in the history
  • Loading branch information
simon816 committed Oct 20, 2013
1 parent 9c3992e commit 928125f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/Diamond Slab.cmod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Diamond Slab.cmod - Demonstration of how to use custom block rendering, collisions and Block API rules
Block(128).create("diamondSlab", {
textures: [24, 24],
canBePiecedVertically: false,
getBlockVertexBufferPieced: Model.PieceSlab[1],
getBlockIndexBuffer: Model.PieceSlab[0],
isNormal: false,
getCollisionBoundingBoxFromPool: function (world, x, y, z) {
return AxisAlignedBB(x, y, z, x + 1, y + 0.5, z + 1)
},
canPlaceBlockAt: function (world, x, y, z) {
i = world.getBlockID(x, y, z)
return i == 129 || i == 0
},
shouldSideBeRendered: function (world, x, y, z, side) {
!world.isBlockNormal(x, y, z) || side == 4
}
})

0 comments on commit 928125f

Please sign in to comment.