Added item name instead of id and clean up

This commit is contained in:
Jean-Yves Faye 2011-02-27 16:52:30 +01:00 committed by Jean-Yves FAYE
parent 1633ba1dad
commit 498eeb33a7

19
mce.py
View File

@ -618,19 +618,18 @@ class mce(object):
With no filename, saves signs to <worldname>.chests With no filename, saves signs to <worldname>.chests
Output is newline-delimited. 5 lines per sign. Coordinates are Output is newline-delimited. 5 lines per sign. Coordinates are
on the first line, followed by a line by item slot For example: on the first line, followed by a line by inventory slot For example:
[229, 118, -15] [222, 51, 22]
64 Cobblestone 2 String
32 Glass 3 String
Empty 3 Iron bar
[...]
Empty
Coordinates are ordered the same as point inputs: Coordinates are ordered the same as point inputs:
[North/South, Down/Up, East/West] [North/South, Down/Up, East/West]
""" """
from items import items
if len(command): if len(command):
filename = command[0] filename = command[0]
else: else:
@ -650,12 +649,10 @@ class mce(object):
for tileEntity in chunk.TileEntities: for tileEntity in chunk.TileEntities:
if tileEntity["id"].value == "Chest": if tileEntity["id"].value == "Chest":
chestCount += 1; chestCount += 1;
outFile.write(str(map(lambda x:tileEntity[x].value, "xyz")) + "\n"); outFile.write(str(map(lambda x:tileEntity[x].value, "xyz")) + "\n");
# for i in range(26):
# outFile.write(tileEntity["Text{0}".format(i+1)].value + "\n");
for Item in tileEntity["Items"]: for Item in tileEntity["Items"]:
outFile.write(str(Item["Count"].value) + " " + str(Item["id"].value) + "\n"); outFile.write(str(Item["Count"].value) + " " + items.itemtypes[Item["id"].value].name + "\n");
if i % 100 == 0: if i % 100 == 0:
print "Chunk {0}...".format(i) print "Chunk {0}...".format(i)