diff --git a/inventory-framework-platform/src/main/java/me/devnatan/inventoryframework/context/PublicSlotComponentRenderer.java b/inventory-framework-platform/src/main/java/me/devnatan/inventoryframework/context/PublicSlotComponentRenderer.java new file mode 100644 index 000000000..9e00c8e88 --- /dev/null +++ b/inventory-framework-platform/src/main/java/me/devnatan/inventoryframework/context/PublicSlotComponentRenderer.java @@ -0,0 +1,205 @@ +package me.devnatan.inventoryframework.context; + +import me.devnatan.inventoryframework.component.PlatformComponentBuilder; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiConsumer; + +public interface PublicSlotComponentRenderer { + + /** + * Creates a new item builder without a specified slot. + *

+ * This function is for creating items whose slot is set dynamically during item rendering. + *

{@code
+	 * unsetSlot().onRender(render -> {
+	 *     render.setItem(...);
+	 *     render.setSlot(...);
+	 * });
+	 * }
+ * + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + * + * @return An item builder to configure the item. + */ + @ApiStatus.Experimental + BUILDER unsetSlot(); + + /** + * Adds an item to a specific slot in the context container. + * + * @param slot The slot in which the item will be positioned. + * @return An item builder to configure the item. + */ + BUILDER slot(int slot); + + /** + * Adds an item to a specific slot in the context container. + * + * @param slot The slot in which the item will be positioned. + * @return An item builder to configure the item. + */ + BUILDER slot(int slot, ITEM item); + + /** + * Adds an item at the specific column and ROW (X, Y) in that context's container. + * + * @param row The row (Y) in which the item will be positioned. + * @param column The column (X) in which the item will be positioned. + * @return An item builder to configure the item. + */ + BUILDER slot(int row, int column); + + /** + * Adds an item at the specific column and ROW (X, Y) in that context's container. + * + * @param row The row (Y) in which the item will be positioned. + * @param column The column (X) in which the item will be positioned. + * @param item The item to set in the specified row and column. + * @return An item builder to configure the item. + */ + BUILDER slot(int row, int column, ITEM item); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void slotComponent(int slot, B builder); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void slotComponent(int row, int column, B builder); + + /** + * Sets an item in the first slot of this context's container. + * + * @return An item builder to configure the item. + */ + BUILDER firstSlot(); + + /** + * Sets an item in the first slot of this context's container. + * + * @param item The item that'll be set. + * @return An item builder to configure the item. + */ + BUILDER firstSlot(ITEM item); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void firstSlotComponent(B builder); + + /** + * Sets an item in the last slot of this context's container. + * + * @return An item builder to configure the item. + */ + BUILDER lastSlot(); + + /** + * Sets an item in the last slot of this context's container. + * + * @param item The item that'll be set. + * @return An item builder to configure the item. + */ + BUILDER lastSlot(ITEM item); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void lastSlotComponent(B builder); + + /** + * Adds an item in the next available slot of this context's container. + * + * @return An item builder to configure the item. + */ + BUILDER availableSlot(); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void availableSlot(B builder); + + /** + * Adds an item in the next available slot of this context's container. + * + * @param item The item that'll be added. + * @return An item builder to configure the item. + */ + BUILDER availableSlot(ITEM item); + + /** + * Adds an item in the next available slot of this context's container. + * + *

{@code
+	 * availableSlot((index, builder) -> builder.withItem(...));
+	 * }
+ * + * @param factory A factory to create the item builder to configure the item. + * The first parameter is the iteration index of the available slot. + */ + void availableSlot(@NotNull BiConsumer factory); + + /** + * Defines the item that will represent a character provided in the context layout. + * + * @param character The layout character target. + * @return An item builder to configure the item. + */ + BUILDER layoutSlot(char character); + + /** + * Defines the item that will represent a character provided in the context layout. + * + * @param character The layout character target. + * @param item The item that'll represent the layout character. + * @return An item builder to configure the item. + */ + BUILDER layoutSlot(char character, ITEM item); + + /** + * Defines the item that will represent a character provided in the context layout. + * + *
{@code
+	 * layoutSlot('F', (index, builder) -> builder.withItem(...));
+	 * }
+ * + * @param character The layout character target. + */ + void layoutSlot(char character, BiConsumer factory); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + > void layoutSlotComponent(char character, B builder); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + BUILDER resultSlot(); + + /** + *

This API is experimental and is not subject to the general compatibility guarantees + * such API may be changed or may be removed completely in any further release. + */ + @ApiStatus.Experimental + BUILDER resultSlot(ITEM item); +} \ No newline at end of file