added reader for the items.txt kindly supplied by copyboy
This commit is contained in:
parent
aadc0fcffe
commit
b7c98bead3
239
items.py
Normal file
239
items.py
Normal file
@ -0,0 +1,239 @@
|
||||
|
||||
items_txt = """
|
||||
|
||||
:version 10
|
||||
|
||||
# Blocks
|
||||
# ID NAME FILE CORDS
|
||||
1 Rock terrain.png 1,0
|
||||
2 Grass terrain.png 3,0
|
||||
3 Dirt terrain.png 2,0
|
||||
4 Cobblestone terrain.png 0,1
|
||||
5 Wood terrain.png 4,0
|
||||
6 Sapling terrain.png 15,0
|
||||
7 Adminium terrain.png 1,1
|
||||
8 Water terrain.png 15,13
|
||||
9 Still_water terrain.png 15,13
|
||||
10 Lava terrain.png 15,15
|
||||
11 Still_lava terrain.png 15,15
|
||||
12 Sand terrain.png 2,1
|
||||
13 Gravel terrain.png 3,1
|
||||
14 Gold_ore terrain.png 0,2
|
||||
15 Iron_ore terrain.png 1,2
|
||||
16 Coal_ore terrain.png 2,2
|
||||
17 Tree terrain.png 4,1
|
||||
18 Leaves terrain.png 4,3
|
||||
19 Sponge terrain.png 0,3
|
||||
20 Glass terrain.png 1,3
|
||||
35 Cloth terrain.png 0,4
|
||||
37 Flower terrain.png 13,0
|
||||
38 Rose terrain.png 12,0
|
||||
39 Brown_mushroom terrain.png 13,1
|
||||
40 Red_mushroom terrain.png 12,1
|
||||
41 Gold_block terrain.png 7,2
|
||||
42 Iron_block terrain.png 6,2
|
||||
43 Double_stair terrain.png 5,0
|
||||
44 Stair special.png 0,0
|
||||
45 Brick terrain.png 7,0
|
||||
46 TNT terrain.png 8,0
|
||||
47 Bookshelf terrain.png 3,2
|
||||
48 Mossy_cobblestone terrain.png 4,2
|
||||
49 Obsidian terrain.png 5,2
|
||||
50 Torch terrain.png 0,5
|
||||
51 Fire special.png 1,0
|
||||
52 Mob_spawner terrain.png 1,4
|
||||
53 Wood_stairs special.png 3,0
|
||||
54 Chest terrain.png 11,1
|
||||
55 Redstone_dust terrain.png 4,5
|
||||
56 Diamond_ore terrain.png 2,3
|
||||
57 Diamond_block terrain.png 8,2
|
||||
58 Workbench terrain.png 12,3
|
||||
59 Crop terrain.png 15,5
|
||||
60 Soil terrain.png 7,5
|
||||
61 Furnace terrain.png 12,2
|
||||
62 Lit_furnace terrain.png 13,3
|
||||
65 Ladder terrain.png 3,5
|
||||
66 Rails terrain.png 0,8
|
||||
67 Cobblestone_stairs special.png 4,0
|
||||
69 Lever terrain.png 0,6
|
||||
70 Rock_plate special.png 0,1
|
||||
72 Wood_plate special.png 1,1
|
||||
73 Redstone_ore terrain.png 3,3
|
||||
74 Redstone_ore_2 terrain.png 3,3
|
||||
75 Redstone_torch_off terrain.png 3,7
|
||||
76 Redstone_torch terrain.png 3,6
|
||||
77 Button special.png 2,1
|
||||
78 Snow special.png 3,1
|
||||
79 Ice terrain.png 3,4
|
||||
80 Snow_block terrain.png 2,4
|
||||
81 Cactus terrain.png 6,4
|
||||
82 Clay_block terrain.png 8,4
|
||||
83 Reed_block terrain.png 9,4
|
||||
84 Jukebox terrain.png 10,4
|
||||
85 Fence special.png 2,0
|
||||
|
||||
# Items
|
||||
# ID NAME FILE CORDS DAMAGE
|
||||
256 Iron_shovel items.png 2,5 128
|
||||
257 Iron_pickaxe items.png 2,6 128
|
||||
258 Iron_axe items.png 2,7 128
|
||||
259 Flint_and_steel items.png 5,0 64
|
||||
260 Apple items.png 10,0 0
|
||||
261 Bow items.png 5,1
|
||||
262 Arrow items.png 5,2
|
||||
263 Coal items.png 7,0
|
||||
264 Diamond items.png 7,3
|
||||
265 Iron_bar items.png 7,1
|
||||
266 Gold_bar items.png 7,2
|
||||
267 Iron_sword items.png 2,4 128
|
||||
268 Wood_sword items.png 0,4 32
|
||||
269 Wood_shovel items.png 0,5 32
|
||||
270 Wood_pickaxe items.png 0,6 32
|
||||
271 Wood_axe items.png 0,7 32
|
||||
272 Stone_sword items.png 1,4 64
|
||||
273 Stone_shovel items.png 1,5 64
|
||||
274 Stone_pickaxe items.png 1,6 64
|
||||
275 Stone_axe items.png 1,7 64
|
||||
276 Diamond_sword items.png 3,4 1024
|
||||
277 Diamond_shovel items.png 3,5 1024
|
||||
278 Diamond_pickaxe items.png 3,6 1024
|
||||
279 Diamond_axe items.png 3,7 1024
|
||||
280 Stick items.png 5,3
|
||||
281 Bowl items.png 7,4 0
|
||||
282 Bowl_with_soup items.png 8,4 0
|
||||
283 Gold_sword items.png 4,4 32
|
||||
284 Gold_shovel items.png 4,5 32
|
||||
285 Gold_pickaxe items.png 4,6 32
|
||||
286 Gold_axe items.png 4,7 32
|
||||
287 String items.png 8,0
|
||||
288 Feather items.png 8,1
|
||||
289 Gunpowder items.png 8,2
|
||||
290 Wood_hoe items.png 0,8 32
|
||||
291 Stone_hoe items.png 1,8 64
|
||||
292 Iron_hoe items.png 2,8 128
|
||||
293 Diamond_hoe items.png 3,8 1024
|
||||
294 Gold_hoe items.png 4,8 32
|
||||
295 Seeds items.png 9,0
|
||||
296 Wheat items.png 9,1
|
||||
297 Bread items.png 9,2 0
|
||||
298 Leather_helmet items.png 0,0 34
|
||||
299 Leather_chestplate items.png 0,1 48
|
||||
300 Leather_pants items.png 0,2 46
|
||||
301 Leather_boots items.png 0,3 40
|
||||
302 Chainmail_helmet items.png 1,0 68
|
||||
303 Chainmail_chestplate items.png 1,1 96
|
||||
304 Chainmail_pants items.png 1,2 92
|
||||
305 Chainmail_boots items.png 1,3 80
|
||||
306 Iron_helmet items.png 2,0 136
|
||||
307 Iron_chestplate items.png 2,1 192
|
||||
308 Iron_pants items.png 2,2 184
|
||||
309 Iron_boots items.png 2,3 160
|
||||
310 Diamond_helmet items.png 3,0 272
|
||||
311 Diamond_chestplate items.png 3,1 384
|
||||
312 Diamond_pants items.png 3,2 368
|
||||
313 Diamond_boots items.png 3,3 320
|
||||
314 Gold_helmet items.png 4,0 68
|
||||
315 Gold_chestplate items.png 4,1 96
|
||||
316 Gold_pants items.png 4,2 92
|
||||
317 Gold_boots items.png 4,3 80
|
||||
318 Flint items.png 6,0
|
||||
319 Meat items.png 7,5 0
|
||||
320 Cooked_meat items.png 8,5 0
|
||||
321 Painting items.png 10,1 0
|
||||
322 Golden_apple items.png 11,0 0
|
||||
323 Sign items.png 10,2 0
|
||||
324 Wood_Door items.png 11,2 0
|
||||
325 Bucket items.png 10,4 0
|
||||
326 Water_bucket items.png 11,4 0
|
||||
327 Lava_bucket items.png 12,4 0
|
||||
328 Minecart items.png 7,8 0
|
||||
329 Saddle items.png 8,6 0
|
||||
330 Iron_door items.png 12,2 0
|
||||
331 Redstone_dust items.png 8,3
|
||||
332 Snowball items.png 14,0
|
||||
333 Boat items.png 8,8 0
|
||||
334 Leather items.png 7,6
|
||||
335 Milk_bucket items.png 13,4
|
||||
336 Brick items.png 6,1
|
||||
337 Clay items.png 9,3
|
||||
338 Reed items.png 11,1
|
||||
339 Paper items.png 10,3
|
||||
340 Book items.png 11,3
|
||||
341 Slime_orb items.png 14,1
|
||||
342 Storage_minecart items.png 7,9 0
|
||||
343 Powered_minecart items.png 7,10 0
|
||||
344 Egg items.png 12,0
|
||||
2256 Gold_record items.png 0,15 0
|
||||
2257 Green_record items.png 1,15 0
|
||||
|
||||
# Groups
|
||||
# NAME ICON ITEMS
|
||||
~ Blocks 2 1,2,3,12,13,82,4,48,67,17,5,53,20,35,44,49,79,80,7,45,19
|
||||
~ Plants 6 18,81,6,37,38,39,40
|
||||
~ Tools 257 269,270,271,290,273,274,275,291,256,257,258,292,277,278,279,293,284,285,286,294,259
|
||||
~ Weapons 267 268,272,267,276,283,261,262,332
|
||||
~ Armor 303 298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317
|
||||
~ Food 297 260,322,281,282,295,296,297,319,320,344
|
||||
~ Ores 56 16,15,14,56,73,263,265,266,264,42,41,57
|
||||
~ Special 54 8,9,10,11,58,54,61,47,84,2256,2257,46,52,51,50,85,280,287,288,289,334,341,318,337,336,338,339,340,321,323,324,330,325,326,327,335
|
||||
~ Movement 328 65,66,328,342,343,333,329
|
||||
~ Logic 76 331,76,69,70,72,77
|
||||
|
||||
"""
|
||||
class ItemType (object):
|
||||
def __init__(self, id, name, imagefile = None, imagecoords = None, maxdamage = None):
|
||||
self.id=id
|
||||
self.name=name
|
||||
self.imagefile=imagefile
|
||||
self.imagecoords=imagecoords
|
||||
self.maxdamage=maxdamage
|
||||
def __repr__(self):
|
||||
return "ItemType({0}, '{1}')".format(self.id, self.name)
|
||||
def __str__(self):
|
||||
return "ItemType {0}: {1}".format(self.id, self.name)
|
||||
|
||||
class Items (object):
|
||||
items_txt = items_txt
|
||||
def __init__(self, filename = None):
|
||||
if filename is None:
|
||||
items_txt = self.items_txt
|
||||
else:
|
||||
try:
|
||||
with file(filename) as f:
|
||||
items_txt = f.read()
|
||||
except Exception, e:
|
||||
print "Error reading items.txt: ", e;
|
||||
print "Using internal data."
|
||||
items_txt = self.items_txt
|
||||
|
||||
self.itemtypes = {};
|
||||
|
||||
for line in items_txt.split("\n"):
|
||||
try:
|
||||
line = line.strip()
|
||||
if len(line) == 0: continue
|
||||
if line[0] == "#": continue;
|
||||
if line[0] == "~": continue; #groups
|
||||
|
||||
fields = line.split();
|
||||
if len(fields) >= 4:
|
||||
maxdamage = None;
|
||||
id, name, imagefile, imagecoords = fields[0:4]
|
||||
if len(fields) > 4:
|
||||
maxdamage = int(fields[4])
|
||||
id = int(id);
|
||||
name = name.replace("_", " ");
|
||||
imagecoords = imagecoords.split(",");
|
||||
|
||||
self.itemtypes[id] = ItemType(id, name, imagefile, imagecoords, maxdamage)
|
||||
except Exception, e:
|
||||
print "Error reading line:", e
|
||||
print "Line: ", line
|
||||
print
|
||||
|
||||
self.names = dict((item.name, item.id) for item in self.itemtypes.itervalues())
|
||||
|
||||
|
||||
|
||||
items = Items();
|
||||
|
177
items.txt
Normal file
177
items.txt
Normal file
@ -0,0 +1,177 @@
|
||||
:version 10
|
||||
|
||||
# Blocks
|
||||
# ID NAME FILE CORDS
|
||||
1 Rock terrain.png 1,0
|
||||
2 Grass terrain.png 3,0
|
||||
3 Dirt terrain.png 2,0
|
||||
4 Cobblestone terrain.png 0,1
|
||||
5 Wood terrain.png 4,0
|
||||
6 Sapling terrain.png 15,0
|
||||
7 Adminium terrain.png 1,1
|
||||
8 Water terrain.png 15,13
|
||||
9 Still_water terrain.png 15,13
|
||||
10 Lava terrain.png 15,15
|
||||
11 Still_lava terrain.png 15,15
|
||||
12 Sand terrain.png 2,1
|
||||
13 Gravel terrain.png 3,1
|
||||
14 Gold_ore terrain.png 0,2
|
||||
15 Iron_ore terrain.png 1,2
|
||||
16 Coal_ore terrain.png 2,2
|
||||
17 Tree terrain.png 4,1
|
||||
18 Leaves terrain.png 4,3
|
||||
19 Sponge terrain.png 0,3
|
||||
20 Glass terrain.png 1,3
|
||||
35 Cloth terrain.png 0,4
|
||||
37 Flower terrain.png 13,0
|
||||
38 Rose terrain.png 12,0
|
||||
39 Brown_mushroom terrain.png 13,1
|
||||
40 Red_mushroom terrain.png 12,1
|
||||
41 Gold_block terrain.png 7,2
|
||||
42 Iron_block terrain.png 6,2
|
||||
43 Double_stair terrain.png 5,0
|
||||
44 Stair special.png 0,0
|
||||
45 Brick terrain.png 7,0
|
||||
46 TNT terrain.png 8,0
|
||||
47 Bookshelf terrain.png 3,2
|
||||
48 Mossy_cobblestone terrain.png 4,2
|
||||
49 Obsidian terrain.png 5,2
|
||||
50 Torch terrain.png 0,5
|
||||
51 Fire special.png 1,0
|
||||
52 Mob_spawner terrain.png 1,4
|
||||
53 Wood_stairs special.png 3,0
|
||||
54 Chest terrain.png 11,1
|
||||
55 Redstone_dust terrain.png 4,5
|
||||
56 Diamond_ore terrain.png 2,3
|
||||
57 Diamond_block terrain.png 8,2
|
||||
58 Workbench terrain.png 12,3
|
||||
59 Crop terrain.png 15,5
|
||||
60 Soil terrain.png 7,5
|
||||
61 Furnace terrain.png 12,2
|
||||
62 Lit_furnace terrain.png 13,3
|
||||
65 Ladder terrain.png 3,5
|
||||
66 Rails terrain.png 0,8
|
||||
67 Cobblestone_stairs special.png 4,0
|
||||
69 Lever terrain.png 0,6
|
||||
70 Rock_plate special.png 0,1
|
||||
72 Wood_plate special.png 1,1
|
||||
73 Redstone_ore terrain.png 3,3
|
||||
74 Redstone_ore_2 terrain.png 3,3
|
||||
75 Redstone_torch_off terrain.png 3,7
|
||||
76 Redstone_torch terrain.png 3,6
|
||||
77 Button special.png 2,1
|
||||
78 Snow special.png 3,1
|
||||
79 Ice terrain.png 3,4
|
||||
80 Snow_block terrain.png 2,4
|
||||
81 Cactus terrain.png 6,4
|
||||
82 Clay_block terrain.png 8,4
|
||||
83 Reed_block terrain.png 9,4
|
||||
84 Jukebox terrain.png 10,4
|
||||
85 Fence special.png 2,0
|
||||
|
||||
# Items
|
||||
# ID NAME FILE CORDS DAMAGE
|
||||
256 Iron_shovel items.png 2,5 128
|
||||
257 Iron_pickaxe items.png 2,6 128
|
||||
258 Iron_axe items.png 2,7 128
|
||||
259 Flint_and_steel items.png 5,0 64
|
||||
260 Apple items.png 10,0 0
|
||||
261 Bow items.png 5,1
|
||||
262 Arrow items.png 5,2
|
||||
263 Coal items.png 7,0
|
||||
264 Diamond items.png 7,3
|
||||
265 Iron_bar items.png 7,1
|
||||
266 Gold_bar items.png 7,2
|
||||
267 Iron_sword items.png 2,4 128
|
||||
268 Wood_sword items.png 0,4 32
|
||||
269 Wood_shovel items.png 0,5 32
|
||||
270 Wood_pickaxe items.png 0,6 32
|
||||
271 Wood_axe items.png 0,7 32
|
||||
272 Stone_sword items.png 1,4 64
|
||||
273 Stone_shovel items.png 1,5 64
|
||||
274 Stone_pickaxe items.png 1,6 64
|
||||
275 Stone_axe items.png 1,7 64
|
||||
276 Diamond_sword items.png 3,4 1024
|
||||
277 Diamond_shovel items.png 3,5 1024
|
||||
278 Diamond_pickaxe items.png 3,6 1024
|
||||
279 Diamond_axe items.png 3,7 1024
|
||||
280 Stick items.png 5,3
|
||||
281 Bowl items.png 7,4 0
|
||||
282 Bowl_with_soup items.png 8,4 0
|
||||
283 Gold_sword items.png 4,4 32
|
||||
284 Gold_shovel items.png 4,5 32
|
||||
285 Gold_pickaxe items.png 4,6 32
|
||||
286 Gold_axe items.png 4,7 32
|
||||
287 String items.png 8,0
|
||||
288 Feather items.png 8,1
|
||||
289 Gunpowder items.png 8,2
|
||||
290 Wood_hoe items.png 0,8 32
|
||||
291 Stone_hoe items.png 1,8 64
|
||||
292 Iron_hoe items.png 2,8 128
|
||||
293 Diamond_hoe items.png 3,8 1024
|
||||
294 Gold_hoe items.png 4,8 32
|
||||
295 Seeds items.png 9,0
|
||||
296 Wheat items.png 9,1
|
||||
297 Bread items.png 9,2 0
|
||||
298 Leather_helmet items.png 0,0 34
|
||||
299 Leather_chestplate items.png 0,1 48
|
||||
300 Leather_pants items.png 0,2 46
|
||||
301 Leather_boots items.png 0,3 40
|
||||
302 Chainmail_helmet items.png 1,0 68
|
||||
303 Chainmail_chestplate items.png 1,1 96
|
||||
304 Chainmail_pants items.png 1,2 92
|
||||
305 Chainmail_boots items.png 1,3 80
|
||||
306 Iron_helmet items.png 2,0 136
|
||||
307 Iron_chestplate items.png 2,1 192
|
||||
308 Iron_pants items.png 2,2 184
|
||||
309 Iron_boots items.png 2,3 160
|
||||
310 Diamond_helmet items.png 3,0 272
|
||||
311 Diamond_chestplate items.png 3,1 384
|
||||
312 Diamond_pants items.png 3,2 368
|
||||
313 Diamond_boots items.png 3,3 320
|
||||
314 Gold_helmet items.png 4,0 68
|
||||
315 Gold_chestplate items.png 4,1 96
|
||||
316 Gold_pants items.png 4,2 92
|
||||
317 Gold_boots items.png 4,3 80
|
||||
318 Flint items.png 6,0
|
||||
319 Meat items.png 7,5 0
|
||||
320 Cooked_meat items.png 8,5 0
|
||||
321 Painting items.png 10,1 0
|
||||
322 Golden_apple items.png 11,0 0
|
||||
323 Sign items.png 10,2 0
|
||||
324 Wood_Door items.png 11,2 0
|
||||
325 Bucket items.png 10,4 0
|
||||
326 Water_bucket items.png 11,4 0
|
||||
327 Lava_bucket items.png 12,4 0
|
||||
328 Minecart items.png 7,8 0
|
||||
329 Saddle items.png 8,6 0
|
||||
330 Iron_door items.png 12,2 0
|
||||
331 Redstone_dust items.png 8,3
|
||||
332 Snowball items.png 14,0
|
||||
333 Boat items.png 8,8 0
|
||||
334 Leather items.png 7,6
|
||||
335 Milk_bucket items.png 13,4
|
||||
336 Brick items.png 6,1
|
||||
337 Clay items.png 9,3
|
||||
338 Reed items.png 11,1
|
||||
339 Paper items.png 10,3
|
||||
340 Book items.png 11,3
|
||||
341 Slime_orb items.png 14,1
|
||||
342 Storage_minecart items.png 7,9 0
|
||||
343 Powered_minecart items.png 7,10 0
|
||||
344 Egg items.png 12,0
|
||||
2256 Gold_record items.png 0,15 0
|
||||
2257 Green_record items.png 1,15 0
|
||||
|
||||
# Groups
|
||||
# NAME ICON ITEMS
|
||||
~ Blocks 2 1,2,3,12,13,82,4,48,67,17,5,53,20,35,44,49,79,80,7,45,19
|
||||
~ Plants 6 18,81,6,37,38,39,40
|
||||
~ Tools 257 269,270,271,290,273,274,275,291,256,257,258,292,277,278,279,293,284,285,286,294,259
|
||||
~ Weapons 267 268,272,267,276,283,261,262,332
|
||||
~ Armor 303 298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317
|
||||
~ Food 297 260,322,281,282,295,296,297,319,320,344
|
||||
~ Ores 56 16,15,14,56,73,263,265,266,264,42,41,57
|
||||
~ Special 54 8,9,10,11,58,54,61,47,84,2256,2257,46,52,51,50,85,280,287,288,289,334,341,318,337,336,338,339,340,321,323,324,330,325,326,327,335
|
||||
~ Movement 328 65,66,328,342,343,333,329
|
||||
~ Logic 76 331,76,69,70,72,77
|
Reference in New Issue
Block a user