Skip to content

Commit

Permalink
Fixed: TileEntity.copyWithOffset adjusts mob position data for mob sp…
Browse files Browse the repository at this point in the history
…awner blocks
  • Loading branch information
codewarrior0 committed Jan 9, 2013
1 parent a840df7 commit 6ed8c45
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions entity.py
Expand Up @@ -96,6 +96,22 @@ def copyWithOffset(cls, tileEntity, copyOffset):
eTag['x'] = nbt.TAG_Int(tileEntity['x'].value + copyOffset[0])
eTag['y'] = nbt.TAG_Int(tileEntity['y'].value + copyOffset[1])
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":
command = eTag['Command'].value

Expand Down

0 comments on commit 6ed8c45

Please sign in to comment.