Fixed: TileEntity.copyWithOffset adjusts mob position data for mob spawner blocks
This commit is contained in:
parent
a840df700a
commit
6ed8c45e4b
16
entity.py
16
entity.py
@ -96,6 +96,22 @@ class TileEntity(object):
|
|||||||
eTag['x'] = nbt.TAG_Int(tileEntity['x'].value + copyOffset[0])
|
eTag['x'] = nbt.TAG_Int(tileEntity['x'].value + copyOffset[0])
|
||||||
eTag['y'] = nbt.TAG_Int(tileEntity['y'].value + copyOffset[1])
|
eTag['y'] = nbt.TAG_Int(tileEntity['y'].value + copyOffset[1])
|
||||||
eTag['z'] = nbt.TAG_Int(tileEntity['z'].value + copyOffset[2])
|
eTag['z'] = nbt.TAG_Int(tileEntity['z'].value + copyOffset[2])
|
||||||
|
if eTag['id'].value == 'MobSpawner':
|
||||||
|
mobs = []
|
||||||
|
mob = eTag.get('SpawnData')
|
||||||
|
if mob:
|
||||||
|
mobs.append(mob)
|
||||||
|
potentials = eTag.get('SpawnPotentials')
|
||||||
|
if potentials:
|
||||||
|
mobs.extend(potentials)
|
||||||
|
|
||||||
|
for mob in mobs:
|
||||||
|
if "Pos" in mob:
|
||||||
|
pos = Entity.pos(mob)
|
||||||
|
pos = [p + o for p, o in zip(pos, copyOffset)]
|
||||||
|
|
||||||
|
Entity.setpos(mob, pos)
|
||||||
|
|
||||||
if eTag['id'].value == "Control":
|
if eTag['id'].value == "Control":
|
||||||
command = eTag['Command'].value
|
command = eTag['Command'].value
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user