S - The reference of the component builder itself used as return type for method chaining.public interface ComponentBuilder<S extends ComponentBuilder<S,C>,C extends IFContext>
Component implementation.| Modifier and Type | Method and Description |
|---|---|
S |
cancelOnClick()
Determines whether an actor's click interaction event under this component should be canceled.
|
S |
closeOnClick()
Closes the current container when an actor interacts with this component.
|
S |
copy()
Returns a copy of this component builder.
|
S |
displayIf(java.util.function.BooleanSupplier displayCondition)
Only shows the component if a given condition is satisfied.
|
S |
displayIf(java.util.function.Predicate<C> displayCondition)
Only shows the component if a given condition is satisfied.
|
S |
hideIf(java.util.function.BooleanSupplier condition)
Hides the component if a given condition is satisfied.
|
S |
hideIf(java.util.function.Predicate<C> condition)
Hides the component if a given condition is satisfied.
|
S |
referencedBy(@NotNull Ref<Component> reference)
Assigns
a reference to this component. |
S |
updateOnClick()
Updates the current context when a player clicks on this component.
|
S |
updateOnStateChange(@NotNull State<?> state)
Listens for value updates in the specified state.
|
S |
updateOnStateChange(@NotNull State<?> state,
State<?>... states)
Listens for value updates in any of the specified states.
|
S |
watch(State<?>... states)
Deprecated.
Use
updateOnStateChange(State) instead. |
S |
withData(@NotNull java.lang.String key,
java.lang.Object value)
Adds a new user-defined property to this component.
|
S |
withExternallyManaged(boolean isExternallyManaged)
This is an internal inventory-framework API that should not be used from outside of
this library.
|
S referencedBy(@NotNull @NotNull Ref<Component> reference)
a reference to this component.reference - Component reference key.S withData(@NotNull @NotNull java.lang.String key, java.lang.Object value)
User-defined properties can be used to persist data that can be retrieved later even after several actions applied to that component.
An example of user-defined data persistence is for post-moving identification of a component inside the container, you can define a data in this item and as soon as the actor moves it the data will remain there, and you can use it any way you want.
key - The property key.value - The property value.S cancelOnClick()
This method is a shortcut to:
onClick(click -> click.setCancelled(!click.isCancelled());
S closeOnClick()
This function was created to support actions during closing to simplify code readability, it executes something and then closes or vice versa.
closeOnClick().onClick(click -> ...)
This method is a shortcut to:
onClick(IFContext::close);
@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="3.2.0") S watch(State<?>... states)
updateOnStateChange(State) instead.When any of the states provided as parameters are modified, the item generated from this builder will be updated.
states - The state to watch.S updateOnStateChange(@NotNull @NotNull State<?> state)
Everytime the value of the given state updates, this component will be updated as well.
state - The state to listen changes to.S updateOnStateChange(@NotNull @NotNull State<?> state, State<?>... states)
Everytime the value ANY of the given state updates, this component will be updated as well.
state - The state to listen changes to.states - Other states to listen changes to.S copy()
@ApiStatus.Internal S withExternallyManaged(boolean isExternallyManaged)
This is an internal inventory-framework API that should not be used from outside of this library. No compatibility guarantees are provided.
@ApiStatus.Experimental S updateOnClick()
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.
S displayIf(java.util.function.BooleanSupplier displayCondition)
displayCondition - Component display condition.hideIf(BooleanSupplier)S displayIf(java.util.function.Predicate<C> displayCondition)
displayCondition - Component display condition.hideIf(Predicate)S hideIf(java.util.function.BooleanSupplier condition)
condition - Condition to hide the component.displayIf(BooleanSupplier)S hideIf(java.util.function.Predicate<C> condition)
condition - Condition to hide the component.displayIf(Predicate)