Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

much more comprehensive readme

  • Loading branch information...
commit 3e3987f75167f94c91161a79533a5be48b3194ef 1 parent 99194b4
Daniel Ribeiro danielribeiro authored

Showing 1 changed file with 31 additions and 3 deletions. Show diff stats Hide diff stats

  1. +31 3 README.md
34 README.md
Source Rendered
@@ -21,10 +21,10 @@ Quick Example
21 21 For more examples, check the
22 22 [examples](https://github.com/danielribeiro/RubyCraft/tree/master/examples) folder
23 23
24   -Manipulating Regions
  24 +Regions
25 25 ---------
26 26 When getting many chunks from Region#chunk method, don't forget to invoke Region#unloadChunk(z,
27   -x). This way the chunk will not ocupy memory.
  27 +x). This way the chunk will not occupy memory.
28 28
29 29 Alternatively you can use the Region#cube method. Example
30 30
@@ -41,8 +41,35 @@ receive a block, or it will return an Enumerable that iterates over the blocks o
41 41 cube. The proc receives four arguments: the block, and its relative coordinates to the
42 42 cube's origin point.
43 43
  44 +Chunks
  45 +---------
  46 +Chunks are both enumerable and indexable:
  47 +
  48 + chunk[0, 0, 0].name = :gold
  49 + chunk.each { |block| block.name = :gold }
  50 +
  51 +
  52 +Note that chunks have size 16x16x128 (width, length, height). Usually you don't create
  53 +chunks directly, but get them through Region#chunk method.
  54 +
  55 +Blocks
  56 +---------
  57 +Blocks have 3 attributes: block_type, pos and data. [Block type](https://github.com/danielribeiro/RubyCraft/blob/master/lib/block_type.rb) tells the name, id and
  58 +transparency (boolean) of the block. The pos attribute indicates the position of the block
  59 +inside its chunk, and data is the integer [data
  60 +value](http://www.minecraftwiki.net/wiki/Data_values)
44 61
45   -=============
  62 +Id is not usually accessed directly, as the name attribute provides a more friendly
  63 +interface. For wool blocks, changing the color directly is also possible in a more
  64 +friendly way.
  65 +
  66 + block.name = :wool
  67 + block.color = :purple
  68 + p block.color
  69 +
  70 +
  71 +Dependencies:
  72 +---------
46 73 [Nbtfile](http://github.com/mental/nbtfile)
47 74
48 75 Meta
@@ -53,3 +80,4 @@ Created by Daniel Ribeiro
53 80 Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
54 81
55 82 http://github.com/danielribeiro/RubyCraft
  83 +

0 comments on commit 3e3987f

Please sign in to comment.
Something went wrong with that request. Please try again.