Apel is a library that brings particle animations to the table with flexible behaviour and a clean developer interface. It promises also lots of predefined shapes & paths to help the developer on their particle scene
Other
2
stars
1
forks
source link
Allow `#amount(int)` in ParticleCuboid.Builder #47
Cuboid no longer has a constructor with special handling for amount, and it can't easily be made clear on the builders that #amount(int) isn't intended for cuboid configuration. Therefore, take advantage of the builder's ability to perform logic before construction and see if the user set an integer amount. If so, convert to Vector3i as used by Cuboid.
Updates documentation to encourage the use of the Vector3i approach.
Other options:
Throw IllegalStateException if amount isn't set via the Vector3i overload. This is a reasonable choice.
Remove final to allow overload in the Cuboid builder. This is possible, but is poor inheritance design, as ParticleObject must maintain its own invariants.
Create a record class to encapsulate Cuboid amounts. This is a good long-term solution because the current breakdown across Vector3i is not intuitive.
Fixes #46
Cuboid no longer has a constructor with special handling for
amount
, and it can't easily be made clear on the builders that#amount(int)
isn't intended for cuboid configuration. Therefore, take advantage of the builder's ability to perform logic before construction and see if the user set an integer amount. If so, convert toVector3i
as used by Cuboid.Updates documentation to encourage the use of the
Vector3i
approach.Other options:
Vector3i
overload. This is a reasonable choice.final
to allow overload in the Cuboid builder. This is possible, but is poor inheritance design, as ParticleObject must maintain its own invariants.Vector3i
is not intuitive.