-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
205 additions
and
0 deletions.
There are no files selected for viewing
205 changes: 205 additions & 0 deletions
205
...orm/src/main/java/me/devnatan/inventoryframework/context/PublicSlotComponentRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<CONTEXT, BUILDER, ITEM> { | ||
|
||
/** | ||
* Creates a new item builder without a specified slot. | ||
* <p> | ||
* This function is for creating items whose slot is set dynamically during item rendering. | ||
* <pre>{@code | ||
* unsetSlot().onRender(render -> { | ||
* render.setItem(...); | ||
* render.setSlot(...); | ||
* }); | ||
* }</pre> | ||
* | ||
* <p><b><i> 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. </i></b> | ||
* | ||
* @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); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> void slotComponent(int slot, B builder); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> 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); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> 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); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> 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(); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> 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. | ||
* | ||
* <pre>{@code | ||
* availableSlot((index, builder) -> builder.withItem(...)); | ||
* }</pre> | ||
* | ||
* @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<Integer, BUILDER> 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. | ||
* | ||
* <pre>{@code | ||
* layoutSlot('F', (index, builder) -> builder.withItem(...)); | ||
* }</pre> | ||
* | ||
* @param character The layout character target. | ||
*/ | ||
void layoutSlot(char character, BiConsumer<Integer, BUILDER> factory); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
<B extends PlatformComponentBuilder<B, CONTEXT>> void layoutSlotComponent(char character, B builder); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
BUILDER resultSlot(); | ||
|
||
/** | ||
* <p><b><i> 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. </i></b> | ||
*/ | ||
@ApiStatus.Experimental | ||
BUILDER resultSlot(ITEM item); | ||
} |