Class CoordAdapter.CoordAdapterBuilder
java.lang.Object
com.fren_gor.ultimateAdvancementAPI.util.CoordAdapter.CoordAdapterBuilder
- Enclosing class:
CoordAdapter
A builder for
CoordAdapter
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(@NotNull AdvancementKey key, float x, float y) Adds the providedAdvancementKey
with its coordinates to the builder.build()
Builds theCoordAdapter
.offset
(@NotNull AdvancementKey key, @NotNull AdvancementKey keyOfParent, float offsetX, float offsetY) Adds the providedAdvancementKey
to the builder.
-
Constructor Details
-
CoordAdapterBuilder
public CoordAdapterBuilder()Creates a newCoordAdapterBuilder
.
-
-
Method Details
-
add
@NotNull public @NotNull CoordAdapter.CoordAdapterBuilder add(@NotNull @NotNull AdvancementKey key, float x, float y) Adds the providedAdvancementKey
with its coordinates to the builder.Note that the x-axis points to the right (as usual), whereas the y-axis points downward.
- Parameters:
key
- TheAdvancementKey
to add.x
- The x coordinate. Must be finite.y
- The y coordinate. Must be finite.- Returns:
- This builder.
-
offset
@NotNull public @NotNull CoordAdapter.CoordAdapterBuilder offset(@NotNull @NotNull AdvancementKey key, @NotNull @NotNull AdvancementKey keyOfParent, float offsetX, float offsetY) throws IllegalArgumentException Adds the providedAdvancementKey
to the builder.Its coordinates are based off the coordinates of the provided parent's
AdvancementKey
.In fact, they are calculated adding the offsets to the parent's coordinates.
Note that the x-axis points to the right (as usual), whereas the y-axis points downward. Thus, a positive
offsetY
moves the advancement downwards, while a negativeoffsetY
moves the advancement upwards.- Parameters:
key
- TheAdvancementKey
to add.keyOfParent
- The parent'sAdvancementKey
. Must be already added to the builder.offsetX
- The offset on the x-axis. Must be finite.offsetY
- The offset on the y-axis. Must be finite.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If either of the provided offsets is NaN or infinite.
-
build
Builds theCoordAdapter
.- Returns:
- The built
CoordAdapter
.
-