Class: World

Inherits:
Object
  • Object
show all
Defined in:
lib/world.rb

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ World

Returns a new instance of World.



4
5
6
# File 'lib/world.rb', line 4

def initialize(api)
  @api = api
end

Instance Method Details

#block(x, y, z, block) ⇒ Object



13
14
15
# File 'lib/world.rb', line 13

def block(x,y,z,block)
  @api.send("world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})")
end

#block_at(x, y, z) ⇒ Object



8
9
10
11
# File 'lib/world.rb', line 8

def block_at(x,y,z)
  response = @api.send_and_receive("world.getBlock(#{x},#{y},#{z})")
  Block.find(response.to_i) 
end

#chat_post(message) ⇒ Object



33
34
35
# File 'lib/world.rb', line 33

def chat_post(message)
  @api.send("chat.post(#{message})")
end

#cube(x1, y1, z1, x2, y2, z2, block) ⇒ Object



17
18
19
# File 'lib/world.rb', line 17

def cube(x1,y1,z1,x2,y2,z2,block)
  @api.send("world.setBlocks(#{x1},#{y1},#{z1},#{x2},#{y2},#{z2},#{block.as_parameter_list})")
end

#height(x, z) ⇒ Object



21
22
23
# File 'lib/world.rb', line 21

def height(x,z)
  @api.send_and_receive("world.getHeight(#{x},#{z})").to_i
end

#restoreObject



29
30
31
# File 'lib/world.rb', line 29

def restore
  @api.send("world.checkpoint.restore()")
end

#saveObject



25
26
27
# File 'lib/world.rb', line 25

def save
  @api.send("world.checkpoint.save()")
end