generate method

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

Implementation

@override
Widget generate(Context context) {
  assert(id.isNotEmpty);
  assert(block.toString().isNotEmpty);

  final path = generatePack ? '' : 'objd_blocks/$id';

  final res = For.of([
    Execute.asat(Entity(tags: ['objd_$id']), children: [
      File.execute(
        '$path/block',
        child: _blockLogic(
          onbreak: File.execute(
            '$path/break',
            child: _break(),
          ),
        ),
      ),
    ]),
    Execute.asat(
      Entity(
        type: Entities.area_effect_cloud,
        tags: ['summon_$id'],
      ),
      children: [
        File.execute(
          '$path/set',
          child: _setblock(
            fireTimer: Timer(
              'fire_timer',
              path: path,
              ticks: 10.minutes,
              children: [
                Data.merge(
                  Entity.Self(),
                  nbt: {'Fire': 1300},
                )
              ],
            ),
          ),
        ),
      ],
    ),
  ]);

  if (generatePack) return Pack(name: id, main: File('main', child: res));

  return res;
}