generate method

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

Implementation

@override
Widget generate(Context context) {
  var gen = particle.toString();

  if (context.version >= 18 &&
      ["minecraft:barrier", "minecraft:light"].contains(particle.type)) {
    gen = "${Particles.block_marker} ${particle.type}";
  }

  if (texture != null) gen += ' $texture';
  if (location != null) gen += ' $location';
  if (delta != null) {
    if (location == null) {
      throw ('If you decide to use the full particle command add a delta, location, speed and count property!');
    }
    gen += ' $delta $speed $count ';
    gen += force ? 'force' : 'normal';
    if (player != null) gen += ' $player';
  }
  return Command('particle $gen');
}