Merge branch 'master' of git@github.com:codewarrior0/pymclevel.git

This commit is contained in:
David Vierra 2010-10-06 17:48:13 -10:00
commit 87eb272195
3 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ from materials import classicMaterials, materials
from numpy import * from numpy import *
NOTEX = 184 NOTEX = 184
#wow, punching this map in would have been much easier in hex #wow, punching this map in would have been much easier in hex
class MCMaterials(): class MCMaterials(object):
def materialNamed(self, name): def materialNamed(self, name):
return self.names.index(name); return self.names.index(name);
@ -423,4 +423,4 @@ def texCoords(idx):
materials.blockTextures = array([map(texCoords, faces) for (faces, name) in materials.blockTextures], dtype='uint8') materials.blockTextures = array([map(texCoords, faces) for (faces, name) in materials.blockTextures], dtype='uint8')
classicMaterials.blockTextures = array([map(texCoords, faces) for (faces, name) in classicMaterials.blockTextures], dtype='uint8') classicMaterials.blockTextures = array([map(texCoords, faces) for (faces, name) in classicMaterials.blockTextures], dtype='uint8')
alphaMaterials = materials; alphaMaterials = materials;

View File

@ -269,7 +269,7 @@ def decompress_first(func):
return func(self, *args, **kw); return func(self, *args, **kw);
return dec_first return dec_first
class MCLevel: class MCLevel(object):
""" MCLevel is an abstract class providing many routines to the different level types, """ MCLevel is an abstract class providing many routines to the different level types,
including a common copyEntitiesFrom built on class-specific routines, and including a common copyEntitiesFrom built on class-specific routines, and
a dummy getChunk/getPresentChunks for the finite levels. a dummy getChunk/getPresentChunks for the finite levels.
@ -1188,7 +1188,7 @@ class PlayerNotFound(Exception): pass
class ChunkNotPresent(Exception): pass class ChunkNotPresent(Exception): pass
class ChunkMalformed(ChunkNotPresent): pass class ChunkMalformed(ChunkNotPresent): pass
class ZeroChunk: class ZeroChunk(object):
" a placebo for neighboring-chunk routines " " a placebo for neighboring-chunk routines "
def compress(self): pass def compress(self): pass
def load(self): pass def load(self): pass

10
nbt.py
View File

@ -23,7 +23,7 @@ import StringIO;
from numpy import array, zeros, uint8, fromstring from numpy import array, zeros, uint8, fromstring
TAGfmt = ">b" TAGfmt = ">b"
class TAG_Value: class TAG_Value(object):
"""Simple values. Subclasses override fmt to change the type and size. """Simple values. Subclasses override fmt to change the type and size.
Subclasses may set dataType instead of overriding setValue for automatic data type coercion""" Subclasses may set dataType instead of overriding setValue for automatic data type coercion"""
@ -141,8 +141,9 @@ class TAG_Byte_Array(TAG_Value):
tag = 7; tag = 7;
fmt = ">i%ds" fmt = ">i%ds"
def setValue(self, val):
_value = numpy.array(val, uint8) def dataType(self, value):
return array(value, uint8)
def __repr__(self): def __repr__(self):
return "<%s: length %d> ( %s )" % (self.__class__, len(self.value), self.name) return "<%s: length %d> ( %s )" % (self.__class__, len(self.value), self.name)
@ -169,8 +170,7 @@ class TAG_String(TAG_Value):
tag = 8; tag = 8;
fmt = ">h%ds" fmt = ">h%ds"
def setValue(self, val): dataType = str
_value = str(val)
def __init__(self, value="", name=None, data=""): def __init__(self, value="", name=None, data=""):
self.name=name self.name=name