BlockTypePixmap shows textures again. BlockTypeSet[] prepends namePrefix again.
This commit is contained in:
parent
e0128c9921
commit
069001d6b1
@ -74,7 +74,7 @@ cdef class BlockModels(object):
|
||||
|
||||
if block.renderType != 3: # only rendertype 3 uses block models
|
||||
continue
|
||||
name = block.internalName.replace(blocktypes.namePrefix, "")
|
||||
nameAndState = block.internalName + block.blockState
|
||||
try:
|
||||
statesJson = self._getBlockState(block.resourcePath)
|
||||
except KeyError:
|
||||
@ -183,7 +183,7 @@ cdef class BlockModels(object):
|
||||
blockColor = r, g, b
|
||||
|
||||
for element in allElements:
|
||||
quads = self.buildBoxQuads(element, name, textureVars, variantXrot, variantYrot, variantZrot, blockColor)
|
||||
quads = self.buildBoxQuads(element, nameAndState, textureVars, variantXrot, variantYrot, variantZrot, blockColor)
|
||||
allQuads.extend(quads)
|
||||
|
||||
|
||||
@ -191,11 +191,11 @@ cdef class BlockModels(object):
|
||||
self.modelQuads[block.internalName + block.blockState] = allQuads
|
||||
|
||||
except Exception as e:
|
||||
log.error("Failed to parse variant of block %s\nelements:\n%s\ntextures:\n%s", name,
|
||||
log.error("Failed to parse variant of block %s\nelements:\n%s\ntextures:\n%s", nameAndState,
|
||||
allElements, textureVars)
|
||||
raise
|
||||
|
||||
def buildBoxQuads(self, element, name, textureVars, variantXrot, variantYrot, variantZrot, blockColor):
|
||||
def buildBoxQuads(self, element, nameAndState, textureVars, variantXrot, variantYrot, variantZrot, blockColor):
|
||||
quads = []
|
||||
shade = element.get("shade", True)
|
||||
fromPoint = Vector(*element["from"])
|
||||
@ -230,7 +230,7 @@ cdef class BlockModels(object):
|
||||
else:
|
||||
raise ValueError("Texture variable loop detected!")
|
||||
|
||||
self.firstTextures.setdefault(name, texture)
|
||||
self.firstTextures.setdefault(nameAndState, texture)
|
||||
self._textureNames.add(texture)
|
||||
|
||||
quads.append((box, face,
|
||||
|
@ -61,6 +61,7 @@ def BlockTypePixmap(block, textureAtlas):
|
||||
image = reader.read()
|
||||
pixmap = QtGui.QPixmap.fromImage(image)
|
||||
else:
|
||||
log.info("No texture for %s!", block.internalName + block.blockState)
|
||||
return QtGui.QPixmap(32, 32)
|
||||
|
||||
w = pixmap.width()
|
||||
|
@ -198,7 +198,9 @@ class BlockTypeSet(object):
|
||||
if isinstance(nameAndState, tuple):
|
||||
internalName, blockState = nameAndState
|
||||
if isinstance(internalName, basestring):
|
||||
ID, meta = self.IDsByState[nameAndState]
|
||||
if not internalName.startswith(self.namePrefix):
|
||||
internalName = self.namePrefix + internalName
|
||||
ID, meta = self.IDsByState[internalName + blockState]
|
||||
else: # (ID, meta)
|
||||
ID, meta = nameAndState
|
||||
|
||||
|
Reference in New Issue
Block a user