private EntityNPCInterface getNearbyNPC() { List list = this.entity.worldObj.getEntitiesWithinAABBExcludingEntity( this.entity, this.entity.boundingBox.expand( (double) this.entity.ai.walkingRange, this.entity.ai.walkingRange > 7 ? 7.0D : (double) this.entity.ai.walkingRange, (double) this.entity.ai.walkingRange), this.selector); Iterator ita = list.iterator(); while (ita.hasNext()) { EntityNPCInterface npc = (EntityNPCInterface) ita.next(); if (!npc.ai.stopAndInteract || npc.isAttacking() || !npc.isEntityAlive() || this.entity.faction.isAggressiveToNpc(npc)) { ita.remove(); } } if (list.isEmpty()) { return null; } else { return (EntityNPCInterface) list.get(this.entity.getRNG().nextInt(list.size())); } }
public void onUpdate() { super.isDead = true; if (!super.worldObj.isRemote) { NBTTagCompound compound = new NBTTagCompound(); this.writeToNBT(compound); EntityCustomNpc npc = new EntityCustomNpc(super.worldObj); npc.readFromNBT(compound); ModelData data = npc.modelData; data.legs.setScale(1.1F, 0.7F, 0.9F); data.arms.setScale(0.9F, 0.7F); data.body.setScale(1.2F, 0.7F, 1.5F); data.head.setScale(0.85F, 0.85F); super.worldObj.spawnEntityInWorld(npc); } super.onUpdate(); }