{
if (block.TypeData.length == 56)
{
UUID sourceAvatar = new UUID(block.TypeData, 0);
UUID targetObject = new UUID(block.TypeData, 16);
Vector3d targetPos = new Vector3d(block.TypeData, 32);
onViewerEffect.raiseEvent(new ViewerEffectEventArgs(type, sourceAvatar, targetObject, targetPos, block.Duration, block.ID));
}
else
{
JLogger.warn("Received a " + type.toString() +
" ViewerEffect with an incorrect TypeData size of " +
block.TypeData.length + " bytes");
}
}
break;
case LookAt:
if (onViewerEffectLookAt != null)
{
if (block.TypeData.length == 57)
{
UUID sourceAvatar = new UUID(block.TypeData, 0);
UUID targetObject = new UUID(block.TypeData, 16);
Vector3d targetPos = new Vector3d(block.TypeData, 32);
LookAtType lookAt = LookAtType.get(block.TypeData[56]);
onViewerEffectLookAt.raiseEvent(new ViewerEffectLookAtEventArgs(sourceAvatar, targetObject, targetPos, lookAt,
block.Duration, block.ID));
}
else
{
JLogger.warn("Received a LookAt ViewerEffect with an incorrect TypeData size of " +
block.TypeData.length + " bytes");
}
}
break;
case PointAt:
if (onViewerEffectPointAt != null)
{
if (block.TypeData.length == 57)
{
UUID sourceAvatar = new UUID(block.TypeData, 0);
UUID targetObject = new UUID(block.TypeData, 16);
Vector3d targetPos = new Vector3d(block.TypeData, 32);
PointAtType pointAt = PointAtType.get(block.TypeData[56]);
onViewerEffectPointAt.raiseEvent(new ViewerEffectPointAtEventArgs(e.getSimulator(), sourceAvatar, targetObject, targetPos,
pointAt, block.Duration, block.ID));
}