minecraft_api 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.md ADDED
@@ -0,0 +1,15 @@
1
+ History
2
+ -------
3
+
4
+ 0.1.0 (in progress)
5
+ -----
6
+ Bumped minor version because of backward-incompatible changes
7
+
8
+ *
9
+ * allow creation of wool with color
10
+ * renamed block_type to block
11
+ * factored out classes to seperate api components
12
+
13
+ 0.0.1
14
+ -----
15
+ * Initial Release
data/README.md CHANGED
@@ -1,4 +1,25 @@
1
- minecraft_api
2
- ==================
1
+ Minecraft API for the Raspberry Pi
2
+ ----------------------------------
3
3
 
4
4
  An API for the Raspberry Pi version of minecraft
5
+
6
+ Prerequisites:
7
+
8
+ * A [Raspberry Pi](http://www.raspberrypi.org)
9
+ * [Prerelease version of Minecraft](https://dl.dropbox.com/s/hqk8wsdzlyyujli/minecraft-pi-0.1.tar.gz)
10
+
11
+ To install:
12
+
13
+ gem install minecraft-api
14
+
15
+ and in your code:
16
+
17
+ require 'minecraft-api'
18
+
19
+ api = MinecraftApi.new(hostname, 4711) # <-- where ever your server is
20
+ api.world.block(5,10,15,Block::WOOD)
21
+ api.player.go(20,40,60)
22
+
23
+ etc...
24
+
25
+
data/lib/block.rb ADDED
@@ -0,0 +1,94 @@
1
+ class Block
2
+
3
+ @@all_blocks = {}
4
+
5
+ attr_reader :id
6
+
7
+ def initialize(id)
8
+ @id = id
9
+ @@all_blocks[id] = self
10
+ end
11
+
12
+ AIR = Block.new(0)
13
+ STONE = Block.new(1)
14
+ GRASS = Block.new(2)
15
+ DIRT = Block.new(3)
16
+ COBBLESTONE = Block.new(4)
17
+ WOOD_PLANKS = Block.new(5)
18
+ SAPLING = Block.new(6)
19
+ BEDROCK = Block.new(7)
20
+ WATER_FLOWING = Block.new(8)
21
+ WATER_STATIONARY = Block.new(9)
22
+ LAVA_FLOWING = Block.new(10)
23
+ LAVA_STATIONARY = Block.new(11)
24
+ SAND = Block.new(12)
25
+ GRAVEL = Block.new(13)
26
+ GOLD_ORE = Block.new(14)
27
+ IRON_ORE = Block.new(15)
28
+ COAL_ORE = Block.new(16)
29
+ WOOD = Block.new(17)
30
+ LEAVES = Block.new(18)
31
+ GLASS = Block.new(20)
32
+ LAPIS_LAZULI_ORE = Block.new(21)
33
+ LAPIS_LAZULI_BLOCK = Block.new(22)
34
+ SANDSTONE = Block.new(24)
35
+ BED = Block.new(26)
36
+ COBWEB = Block.new(30)
37
+ GRASS_TALL = Block.new(31)
38
+ FLOWER_YELLOW = Block.new(37)
39
+ FLOWER_CYAN = Block.new(38)
40
+ MUSHROOM_BROWN = Block.new(39)
41
+ MUSHROOM_RED = Block.new(40)
42
+ GOLD_BLOCK = Block.new(41)
43
+ IRON_BLOCK = Block.new(42)
44
+ STONE_SLAB_DOUBLE = Block.new(43)
45
+ STONE_SLAB = Block.new(44)
46
+ BRICK_BLOCK = Block.new(45)
47
+ TNT = Block.new(46)
48
+ BOOKSHELF = Block.new(47)
49
+ MOSS_STONE = Block.new(48)
50
+ OBSIDIAN = Block.new(49)
51
+ TORCH = Block.new(50)
52
+ FIRE = Block.new(51)
53
+ STAIRS_WOOD = Block.new(53)
54
+ CHEST = Block.new(54)
55
+ DIAMOND_ORE = Block.new(56)
56
+ DIAMOND_BLOCK = Block.new(57)
57
+ CRAFTING_TABLE = Block.new(58)
58
+ FARMLAND = Block.new(60)
59
+ FURNACE_INACTIVE = Block.new(61)
60
+ FURNACE_ACTIVE = Block.new(62)
61
+ DOOR_WOOD = Block.new(64)
62
+ LADDER = Block.new(65)
63
+ STAIRS_COBBLESTONE = Block.new(67)
64
+ DOOR_IRON = Block.new(71)
65
+ REDSTONE_ORE = Block.new(73)
66
+ SNOW = Block.new(78)
67
+ ICE = Block.new(79)
68
+ SNOW_BLOCK = Block.new(80)
69
+ CACTUS = Block.new(81)
70
+ CLAY = Block.new(82)
71
+ SUGAR_CANE = Block.new(83)
72
+ FENCE = Block.new(85)
73
+ GLOWSTONE_BLOCK = Block.new(89)
74
+ BEDROCK_INVISIBLE = Block.new(95)
75
+ STONE_BRICK = Block.new(98)
76
+ GLASS_PANE = Block.new(102)
77
+ MELON = Block.new(103)
78
+ FENCE_GATE = Block.new(107)
79
+ GLOWING_OBSIDIAN = Block.new(246)
80
+ NETHER_REACTOR_CORE = Block.new(247)
81
+
82
+ def as_parameter_list
83
+ @id
84
+ end
85
+
86
+ def self.find(id)
87
+ @@all_blocks[id]
88
+ end
89
+
90
+ def ==(another_block)
91
+ @id == another_block.id
92
+ end
93
+
94
+ end
data/lib/camera.rb ADDED
@@ -0,0 +1,19 @@
1
+ class Camera
2
+
3
+ def initialize(api)
4
+ @api = api
5
+ end
6
+
7
+ def mode(mode,x=nil,y=nil,z=nil)
8
+ case mode
9
+ when :normal then command = "setNormal()"
10
+ when :third_person then command = "setThirdPerson()"
11
+ when :fixed then command = "setFixed()"
12
+ when :position then command = "setPos(#{x},#{y},#{z})"
13
+ else raise RuntimeError.new("valid camera settings are: :normal, :third_person, :fixed, and :position")
14
+ end
15
+
16
+ @api.send("camera.mode.#{command}")
17
+ end
18
+
19
+ end
data/lib/color.rb ADDED
@@ -0,0 +1,18 @@
1
+ class Color
2
+ WHITE = 0
3
+ ORANGE = 1
4
+ MAGENTA = 2
5
+ LIGHT_BLUE = 3
6
+ YELLOW = 4
7
+ LIME = 5
8
+ PINK = 6
9
+ GRAY = 7
10
+ LIGHT_GRAY = 8
11
+ CYAN = 9
12
+ PURPLE = 10
13
+ BLUE = 11
14
+ BROWN = 12
15
+ GREEN = 13
16
+ RED = 14
17
+ BLACK = 15
18
+ end
data/lib/minecraft_api.rb CHANGED
@@ -1,17 +1,28 @@
1
1
  require 'socket'
2
2
  require 'io/wait'
3
3
 
4
+ require_relative 'world'
5
+ require_relative 'camera'
6
+ require_relative 'player'
7
+
4
8
  class MinecraftApi
5
9
 
10
+ attr_reader :world
11
+ attr_reader :camera
12
+ attr_reader :player
13
+
6
14
  def initialize(host = 'localhost', port = 4711)
7
15
  @socket = TCPSocket.new host, port
16
+ @world = World.new(self)
17
+ @camera = Camera.new(self)
18
+ @player = Player.new(self)
8
19
  end
9
20
 
10
21
  # The other api's have a method like this
11
22
  # I haven't seen it be invoked yet. Perhaps it is not needed
12
23
  def drain()
13
24
  while @socket.ready?
14
- puts "**** READ A CHARACTER [#{@socket.gets}]"
25
+ puts "DRAINING DATA FROM SOCKET [#{@socket.gets}]"
15
26
  end
16
27
  end
17
28
 
@@ -25,54 +36,6 @@ class MinecraftApi
25
36
  @socket.gets.chomp
26
37
  end
27
38
 
28
- def get_block_type(x,y,z)
29
- response = send_and_receive("world.getBlock(#{x},#{y},#{z})")
30
- BlockType.find(response.to_i)
31
- end
32
-
33
- def set_block(x,y,z,block_type)
34
- send("world.setBlock(#{x},#{y},#{z},#{block_type.id})")
35
- end
36
-
37
- def set_blocks(x1,y1,z1,x2,y2,z2,block_type)
38
- send("world.setBlocks(#{x1},#{y1},#{z1},#{x2},#{y2},#{z2},#{block_type.id})")
39
- end
40
-
41
- def get_height(x,z)
42
- send_and_receive("world.getHeight(#{x},#{z})").to_i
43
- end
44
-
45
- def checkpoint_save
46
- send("word.checkpoint.save()")
47
- end
48
-
49
- def checkpoint_restore
50
- send("word.checkpoint.restore()")
51
- end
52
-
53
- def chat_post(message)
54
- send("chat.post(#{message})")
55
- end
56
-
57
- def camera_mode(mode,x=nil,y=nil,z=nil)
58
- case mode
59
- when :normal then send("camera.mode.setNormal()")
60
- when :third_person then send("camera.mode.setThirdPerson()")
61
- when :fixed then send("camera.mode.setFixed()")
62
- when :position then send("camera.mode.setPos(#{x},#{y},#{z})")
63
- else raise RuntimeError.new("valid camera settings are: :normal, :third_person, :fixed, and :position")
64
- end
65
- end
66
-
67
- def player_set_tile(x,y,z)
68
- send("player.setTile(#{x},#{y},#{z})")
69
- end
70
-
71
- def player_get_tile
72
- response = send_and_receive("player.getTile()")
73
- response.split(',').map { |s| s.to_i }
74
- end
75
-
76
39
  def close
77
40
  @socket.close
78
41
  end
data/lib/player.rb ADDED
@@ -0,0 +1,14 @@
1
+ class Player
2
+ def initialize(api)
3
+ @api = api
4
+ end
5
+
6
+ def go(x,y,z)
7
+ @api.send("player.setTile(#{x},#{y},#{z})")
8
+ end
9
+
10
+ def location
11
+ response = @api.send_and_receive("player.getTile()")
12
+ response.split(',').map { |s| s.to_i }
13
+ end
14
+ end
data/lib/wool.rb ADDED
@@ -0,0 +1,23 @@
1
+ require_relative 'block'
2
+ require_relative 'color'
3
+
4
+ class Wool < Block
5
+ WOOL_BLOCK_ID = 35
6
+ private_constant :WOOL_BLOCK_ID
7
+
8
+ attr_reader :color
9
+
10
+ def initialize(color)
11
+ super(WOOL_BLOCK_ID)
12
+ @color = color
13
+ end
14
+
15
+ def as_parameter_list
16
+ "#{@id},#{@color}"
17
+ end
18
+
19
+ def ==(another_wool)
20
+ @id == another_wool.id && @color == another_wool.color
21
+ end
22
+
23
+ end
data/lib/world.rb ADDED
@@ -0,0 +1,36 @@
1
+ require_relative 'block'
2
+
3
+ class World
4
+ def initialize(api)
5
+ @api = api
6
+ end
7
+
8
+ def block_at(x,y,z)
9
+ response = @api.send_and_receive("world.getBlock(#{x},#{y},#{z})")
10
+ Block.find(response.to_i)
11
+ end
12
+
13
+ def block(x,y,z,block)
14
+ @api.send("world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})")
15
+ end
16
+
17
+ def cube(x1,y1,z1,x2,y2,z2,block)
18
+ @api.send("world.setBlocks(#{x1},#{y1},#{z1},#{x2},#{y2},#{z2},#{block.as_parameter_list})")
19
+ end
20
+
21
+ def height(x,z)
22
+ @api.send_and_receive("world.getHeight(#{x},#{z})").to_i
23
+ end
24
+
25
+ def save
26
+ @api.send("world.checkpoint.save()")
27
+ end
28
+
29
+ def restore
30
+ @api.send("world.checkpoint.restore()")
31
+ end
32
+
33
+ def chat_post(message)
34
+ @api.send("chat.post(#{message})")
35
+ end
36
+ end
@@ -2,8 +2,8 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'minecraft_api'
4
4
  s.description = 'An API for the Raspberry Pi version of Minecraft'
5
- s.version = '0.0.1'
6
- s.date = '2013-01-25'
5
+ s.version = '0.1.0'
6
+ s.date = '2013-02-14'
7
7
  s.summary = 'Minecraft API'
8
8
  s.homepage = 'https://github.com/nhajratw/minecraft_api'
9
9
  s.authors = ["Nayan Hajratwala"]
@@ -0,0 +1,10 @@
1
+ require 'block'
2
+
3
+ describe 'Block' do
4
+
5
+ it 'is equivalent to another type with the same id' do
6
+ b1 = Block.new(0)
7
+ b2 = Block.new(0)
8
+ b1.should eq(b2)
9
+ end
10
+ end
@@ -1,6 +1,6 @@
1
1
  require 'minecraft_api'
2
2
 
3
- describe "Minecraft server" do
3
+ describe "Minecraft API", :integration => true do
4
4
 
5
5
  before(:each) do
6
6
  @mcapi = MinecraftApi.new('10.0.1.129', 4711)
@@ -15,76 +15,93 @@ describe "Minecraft server" do
15
15
  response.should eq('Fail')
16
16
  end
17
17
 
18
- it "can create a block" do
19
- @mcapi.set_block(0,0,0,BlockType::WOOD)
20
- block_type = @mcapi.get_block_type(0,0,0)
21
- block_type.should eq(BlockType::WOOD)
22
- end
18
+ describe "The World" do
23
19
 
24
- it "can create a block of a different type" do
25
- @mcapi.set_block(0,0,0,BlockType::SAND)
26
- block_type = @mcapi.get_block_type(0,0,0)
27
- block_type.should eq(BlockType::SAND)
28
- end
20
+ let(:world) { @mcapi.world }
29
21
 
30
- it "can create multiple blocks" do
31
- @mcapi.set_blocks(0,0,0,2,2,2,BlockType::SAND)
32
- # need to figure out assertion here.
33
- # The assertions on each vector come too fast and end up returning
34
- # types of 0.
35
- end
22
+ it "can have blocks placed in it" do
23
+ world.block(0,0,0,Block::WOOD)
24
+ block = world.block_at(0,0,0)
25
+ block.should eq(Block::WOOD)
26
+ end
36
27
 
37
- it "can get the height of the world" do
38
- y = @mcapi.get_height(5,5)
39
- y.should eq(2)
40
- end
28
+ it "can create a block of a different type" do
29
+ world.block(0,0,0,Block::SAND)
30
+ block = world.block_at(0,0,0)
31
+ block.should eq(Block::SAND)
32
+ end
41
33
 
42
- it "can checkpoint save" do
43
- @mcapi.checkpoint_save
44
- end
34
+ it "can create a block colored wool" do
35
+ wool = Wool.new(Color::RED)
36
+ world.block(0,0,0,wool)
37
+ block = world.block_at(0,0,0)
38
+ block.should eq(wool)
39
+ end
45
40
 
46
- it "can checkpoint restore" do
47
- @mcapi.checkpoint_restore
48
- end
41
+ it "can create cubes" do
42
+ world.cube(0,0,0,2,2,2,Block::SAND)
43
+ # need to figure out assertion here.
44
+ # The assertions on each vector come too fast and end up returning
45
+ # types of 0.
46
+ end
49
47
 
50
- it "can send chats" do
51
- @mcapi.chat_post("hello")
48
+ it "can get the height of the world" do
49
+ y = world.height(5,5)
50
+ y.should eq(7)
51
+ end
52
+
53
+ it "can checkpoint save" do
54
+ world.save
55
+ end
56
+
57
+ it "can checkpoint restore" do
58
+ world.restore
59
+ end
60
+
61
+ it "can send chats" do
62
+ world.chat_post("hello")
63
+ end
52
64
  end
53
65
 
54
- describe "Camera API" do
66
+ describe "Camera" do
67
+ let(:camera) { @mcapi.camera }
68
+
55
69
  it "can be set to normal" do
56
- @mcapi.camera_mode(:normal)
70
+ camera.mode(:normal)
57
71
  end
58
72
 
59
73
  it "can be set to third person" do
60
- @mcapi.camera_mode(:third_person)
74
+ camera.mode(:third_person)
61
75
  end
62
76
 
63
77
  it "can be set to fixed" do
64
- @mcapi.camera_mode(:fixed)
78
+ camera.mode(:fixed)
65
79
  end
66
80
 
67
81
  it "can be set to a certain position" do
68
- @mcapi.camera_mode(:position,10,20,30)
82
+ camera.mode(:position,10,20,30)
69
83
  end
70
84
 
71
85
  it "throws an error when an invalid mode is specified" do
72
86
  expect {
73
- @mcapi.camera_mode(:fake)
87
+ camera.mode(:fake)
74
88
  }.to raise_error(RuntimeError, "valid camera settings are: :normal, :third_person, :fixed, and :position")
75
89
  end
76
90
  end
77
91
 
78
- describe "Player API" do
79
- it "can put the player on a particular tile" do
80
- @mcapi.player_set_tile(20,40,60)
81
- vector = @mcapi.player_get_tile
92
+ describe "Player" do
93
+
94
+ let(:player) { @mcapi.player }
95
+
96
+ it "can go to a particular tile" do
97
+ player.go(20,40,60)
98
+ vector = player.location
82
99
  vector.should eq([20,40,60])
83
100
  end
84
101
 
85
- it "can put the player somewhere else" do
86
- @mcapi.player_set_tile(-5,10,15)
87
- vector = @mcapi.player_get_tile
102
+ it "can go to another tile" do
103
+ player.go(-5,10,15)
104
+ vector = player.location
88
105
  vector.should eq([-5,10,15])
89
106
  end
90
107
  end
data/spec/wool_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'wool'
2
+
3
+ describe 'Wool' do
4
+ it 'can be created with color' do
5
+ wool = Wool.new(Color::RED)
6
+ wool.color.should == Color::RED
7
+ end
8
+
9
+ it 'wool instances should be equal' do
10
+ wool1 = Wool.new(Color::RED)
11
+ wool2 = Wool.new(Color::RED)
12
+ wool1.should == wool2
13
+ end
14
+
15
+ it 'wool instances should be equal' do
16
+ wool1 = Wool.new(Color::RED)
17
+ wool2 = Wool.new(Color::BLACK)
18
+ wool1.should_not == wool2
19
+ end
20
+ end
21
+
@@ -0,0 +1,36 @@
1
+ describe 'the World' do
2
+ let(:api) { double() }
3
+ let(:world) { World.new(api) }
4
+
5
+ it 'sends the proper setBlock command for normal blocks' do
6
+ api.should_receive(:send).with("world.setBlock(10,20,30,20)")
7
+ world.block(10,20,30,Block::GLASS)
8
+ end
9
+
10
+ it 'sends the proper setBlock command for blocks with extra data' do
11
+ api.should_receive(:send).with("world.setBlock(5,6,7,35,14)")
12
+ world.block(5,6,7,Wool.new(Color::RED))
13
+ end
14
+
15
+ it 'sends the proper setBlocks command for normal blocks' do
16
+ api.should_receive(:send).with("world.setBlocks(10,20,30,40,50,60,20)")
17
+ world.cube(10,20,30,40,50,60,Block::GLASS)
18
+ end
19
+
20
+ it 'sends the proper setBlocks command for blocks with extra data' do
21
+ api.should_receive(:send).with("world.setBlocks(5,6,7,9,9,9,35,14)")
22
+ world.cube(5,6,7,9,9,9,Wool.new(Color::RED))
23
+ end
24
+
25
+ it 'translates data into blocks' do
26
+ api.stub(:send_and_receive).with("world.getBlock(5,6,7)") { "10" }
27
+ block = world.block_at(5,6,7)
28
+ block.should == Block::LAVA_FLOWING
29
+ end
30
+
31
+ it 'translates data into blocks with extra data' do
32
+ api.stub(:send_and_receive).with("world.getBlock(5,6,7)") { "35,14" }
33
+ block = world.block_at(5,6,7)
34
+ block.should == Wool.new(Color::RED)
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minecraft_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-02-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: An API for the Raspberry Pi version of Minecraft
15
15
  email:
@@ -19,12 +19,20 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - .gitignore
22
+ - History.md
22
23
  - README.md
23
- - lib/block_type.rb
24
+ - lib/block.rb
25
+ - lib/camera.rb
26
+ - lib/color.rb
24
27
  - lib/minecraft_api.rb
28
+ - lib/player.rb
29
+ - lib/wool.rb
30
+ - lib/world.rb
25
31
  - minecraft_api.gemspec
26
- - spec/block_type_spec.rb
32
+ - spec/block_spec.rb
27
33
  - spec/minecraft_api_spec.rb
34
+ - spec/wool_spec.rb
35
+ - spec/world_spec.rb
28
36
  homepage: https://github.com/nhajratw/minecraft_api
29
37
  licenses: []
30
38
  post_install_message:
@@ -45,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
53
  version: '0'
46
54
  requirements: []
47
55
  rubyforge_project:
48
- rubygems_version: 1.8.23
56
+ rubygems_version: 1.8.25
49
57
  signing_key:
50
58
  specification_version: 3
51
59
  summary: Minecraft API
data/lib/block_type.rb DELETED
@@ -1,91 +0,0 @@
1
- class BlockType
2
-
3
- @@all_block_types = {}
4
-
5
- attr_reader :id
6
-
7
- def initialize(id)
8
- @id = id
9
- @@all_block_types[id] = self
10
- end
11
-
12
- def self.find(id)
13
- @@all_block_types[id]
14
- end
15
-
16
- AIR = BlockType.new(0)
17
- STONE = BlockType.new(1)
18
- GRASS = BlockType.new(2)
19
- DIRT = BlockType.new(3)
20
- COBBLESTONE = BlockType.new(4)
21
- WOOD_PLANKS = BlockType.new(5)
22
- SAPLING = BlockType.new(6)
23
- BEDROCK = BlockType.new(7)
24
- WATER_FLOWING = BlockType.new(8)
25
- WATER_STATIONARY = BlockType.new(9)
26
- LAVA_FLOWING = BlockType.new(10)
27
- LAVA_STATIONARY = BlockType.new(11)
28
- SAND = BlockType.new(12)
29
- GRAVEL = BlockType.new(13)
30
- GOLD_ORE = BlockType.new(14)
31
- IRON_ORE = BlockType.new(15)
32
- COAL_ORE = BlockType.new(16)
33
- WOOD = BlockType.new(17)
34
- LEAVES = BlockType.new(18)
35
- GLASS = BlockType.new(20)
36
- LAPIS_LAZULI_ORE = BlockType.new(21)
37
- LAPIS_LAZULI_BLOCK = BlockType.new(22)
38
- SANDSTONE = BlockType.new(24)
39
- BED = BlockType.new(26)
40
- COBWEB = BlockType.new(30)
41
- GRASS_TALL = BlockType.new(31)
42
- WOOL = BlockType.new(35)
43
- FLOWER_YELLOW = BlockType.new(37)
44
- FLOWER_CYAN = BlockType.new(38)
45
- MUSHROOM_BROWN = BlockType.new(39)
46
- MUSHROOM_RED = BlockType.new(40)
47
- GOLD_BLOCK = BlockType.new(41)
48
- IRON_BLOCK = BlockType.new(42)
49
- STONE_SLAB_DOUBLE = BlockType.new(43)
50
- STONE_SLAB = BlockType.new(44)
51
- BRICK_BLOCK = BlockType.new(45)
52
- TNT = BlockType.new(46)
53
- BOOKSHELF = BlockType.new(47)
54
- MOSS_STONE = BlockType.new(48)
55
- OBSIDIAN = BlockType.new(49)
56
- TORCH = BlockType.new(50)
57
- FIRE = BlockType.new(51)
58
- STAIRS_WOOD = BlockType.new(53)
59
- CHEST = BlockType.new(54)
60
- DIAMOND_ORE = BlockType.new(56)
61
- DIAMOND_BLOCK = BlockType.new(57)
62
- CRAFTING_TABLE = BlockType.new(58)
63
- FARMLAND = BlockType.new(60)
64
- FURNACE_INACTIVE = BlockType.new(61)
65
- FURNACE_ACTIVE = BlockType.new(62)
66
- DOOR_WOOD = BlockType.new(64)
67
- LADDER = BlockType.new(65)
68
- STAIRS_COBBLESTONE = BlockType.new(67)
69
- DOOR_IRON = BlockType.new(71)
70
- REDSTONE_ORE = BlockType.new(73)
71
- SNOW = BlockType.new(78)
72
- ICE = BlockType.new(79)
73
- SNOW_BLOCK = BlockType.new(80)
74
- CACTUS = BlockType.new(81)
75
- CLAY = BlockType.new(82)
76
- SUGAR_CANE = BlockType.new(83)
77
- FENCE = BlockType.new(85)
78
- GLOWSTONE_BLOCK = BlockType.new(89)
79
- BEDROCK_INVISIBLE = BlockType.new(95)
80
- STONE_BRICK = BlockType.new(98)
81
- GLASS_PANE = BlockType.new(102)
82
- MELON = BlockType.new(103)
83
- FENCE_GATE = BlockType.new(107)
84
- GLOWING_OBSIDIAN = BlockType.new(246)
85
- NETHER_REACTOR_CORE = BlockType.new(247)
86
-
87
- def ==(another_block_type)
88
- @id == another_block_type.id
89
- end
90
-
91
- end
@@ -1,10 +0,0 @@
1
- require 'block_type'
2
-
3
- describe 'BlockType' do
4
-
5
- it 'is equivalent to another block type with the same id' do
6
- bt1 = BlockType.new(0)
7
- bt2 = BlockType.new(0)
8
- bt1.should eq(bt2)
9
- end
10
- end