getResult method

Widget getResult({
  1. String packid = 'tpcraft',
})

Implementation

Widget getResult({String packid = 'tpcraft'}) {
  final _resScore = Score.fromSelected(packid + 'Count');
  final _idScore = Score.fromSelected(packid + 'ID');
  Widget replace = ReplaceItem.block(Location.here(),
      slot: Slot.Container15, item: result);
  Widget? count;
  if (result.count != null) {
    count = For.of([
      Extend('load', child: Score.con(result.count!)),
      _resScore.multiplyByScore(Score.con(result.count!))
    ]);
  }
  return If(_idScore.matches(id!), then: [
    replace,
    if (count != null) count,
    if (exactResult != null && exactResult! > 0)
      If(_resScore.matchesRange(Range.from(exactResult! + 1)),
          then: [_resScore.set(exactResult!)])
  ]);
}