generate method

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

Implementation

@override
Widget generate(Context context) {
  Recipe.recipeId = id;
  if (id != null && recipes != null) {
    recipes = recipes!.map((rec) => rec.setid()).toList();
  }
  return Pack(
      name: name,
      load: File('load'),
      main: File(
        'main',
        child: For.of([
          /// Main File
          if (main != null) ...main!,
          Execute(
              as: Entity(type: Entities.armor_stand, tags: [name + 'Table']),
              at: Entity.Selected(),
              If: Condition(
                Entity.Player(distance: Range.to(6)),
              ),

              /// runs subfunctions
              children: [
                File.execute(
                  'checkarea',
                  child: CheckArea(
                    onDestroy,
                    displayName!,
                    useBarrel,
                    invisibleHitbox,
                  ),
                ),
                File.execute('crafting', create: false),
              ]),
        ]),
      ),
      files: [
        /// Crafting file
        File(
          'crafting',
          child: ChestFile(
            recipes != null,
            recipeSource,
            recipeResultSource,
            placeholder,
            guiModel,
            useBarrel,
          ),
        ),

        /// all Recipes
        if (recipes != null)
          File(
            'recipes/$name',
            child: For(
              to: recipes!.length - 1,
              create: (i) =>
                  recipes![i].getCommands(packid: name, useBarrel: useBarrel),
            ),
          ),

        /// all Recipe Results
        if (recipes != null)
          File(
            'recipes/res_$name',
            child: For(
              to: recipes!.length - 1,
              create: (i) => recipes![i].getResult(packid: name),
            ),
          ),
        File(
          'set',
          child: SetArmorstand(
            blockModel,
            displayName!,
            useBarrel,
            invisibleHitbox,
          ),
        ),
        if (giveCommandFunction)
          File(
            'getcommand',
            child: GetCommand(useBarrel),
          )
      ]);
}