Fix mob spawns renderer for numpy 1.10
This commit is contained in:
parent
e9b4041560
commit
ca801027c3
@ -38,8 +38,17 @@ class MobSpawnsBlockMesh(ChunkMeshBase):
|
|||||||
blockLight = section.BlockLight
|
blockLight = section.BlockLight
|
||||||
skyLight = section.SkyLight
|
skyLight = section.SkyLight
|
||||||
blocks = section.Blocks
|
blocks = section.Blocks
|
||||||
normalCube = blocktypes.normalCube[blocks]
|
|
||||||
materialLiquid = blocktypes.materialLiquid[blocks]
|
# This `!= 0` is weird. blocktypes.normalCube has dtype 'uint8'; numpy 1.10
|
||||||
|
# refuses to perform an `&` between a 'uint8' and a 'bool'; so we use `!= 0`
|
||||||
|
# to coerce the 'uint8' to a 'bool'
|
||||||
|
#
|
||||||
|
# If blocktypes.normalCube and other arrays on blocktypes were changed to
|
||||||
|
# 'bool', Cython will refuse to coerce the arrays to typed memoryviews,
|
||||||
|
# claiming the array format string '?' is not understood.
|
||||||
|
|
||||||
|
normalCube = blocktypes.normalCube[blocks] != 0
|
||||||
|
materialLiquid = blocktypes.materialLiquid[blocks] != 0
|
||||||
|
|
||||||
# A block can spawn monsters if:
|
# A block can spawn monsters if:
|
||||||
# the block is not a normal cube
|
# the block is not a normal cube
|
||||||
@ -69,12 +78,12 @@ class MobSpawnsBlockMesh(ChunkMeshBase):
|
|||||||
validBlocks = normalCube == 0 # block is not normal
|
validBlocks = normalCube == 0 # block is not normal
|
||||||
validBlocks &= materialLiquid == 0 # block is not liquid
|
validBlocks &= materialLiquid == 0 # block is not liquid
|
||||||
validBlocks[:-1] &= normalCube[1:] == 0 # block above is not normal
|
validBlocks[:-1] &= normalCube[1:] == 0 # block above is not normal
|
||||||
validBlocks[1:] &= validBelowBlocks[:-1] # block below has solid top surface
|
validBlocks[1:] &= validBelowBlocks[:-1] # block below has solid top surface
|
||||||
|
|
||||||
belowSection = chunk.getSection(cy-1)
|
belowSection = chunk.getSection(cy-1)
|
||||||
if belowSection:
|
if belowSection:
|
||||||
belowSectionBlocks = belowSection.Blocks[-1:]
|
belowSectionBlocks = belowSection.Blocks[-1:]
|
||||||
validBlocks[:1] &= blocktypes.normalCube[belowSectionBlocks]
|
validBlocks[:1] &= blocktypes.normalCube[belowSectionBlocks] != 0
|
||||||
else:
|
else:
|
||||||
validBlocks[:1] = 0
|
validBlocks[:1] = 0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user