generate method

  1. @override
Widget generate(
  1. Context context
)
override

Implementation

@override
Widget generate(Context context) {
  final s = Scoreboard(objective);

  return For.of([
    Score(Entity.PlayerName('#max'), objective).set(_diff),
    Group(
      path: targetFilePath,
      filename: targetFileName ?? 'random',
      generateIDs: targetFileName == null,
      children: [
        Comment('Random UUID Generator from ${context.file}'),
        AreaEffectCloud(Location.here(), tags: ['objd_random']),
        s[entity].setToWidget(
          Data.get(
            Entity(tags: ['objd_random'], limit: 1).sort(Sort.nearest),
            path: context.version > 15 ? 'UUID[0]' : 'UUIDMost',
            scale: (context.version > 15 ? 1000 : 1) * 0.0000000001,
          ),
        ),
        s[entity].modulo(
          s['#max'],
        ),
      ],
    ),
    if (from > 0) score.add(from),
    if (from < 0) score.subtract(-from),
  ]);
}