Package space.maxus.flare.ui.compose
Class FunctionComposable<P>
java.lang.Object
space.maxus.flare.ui.compose.FunctionComposable<P>
- All Implemented Interfaces:
ReactivityProvider,Composable,ComposableLike
public abstract class FunctionComposable<P>
extends Object
implements Composable, ReactivityProvider
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidactivate()voidclick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called each time this item is clicked, no matter if it is a right click, left click, middle click, etc.abstract @NotNull Composablecompose()@Nullable ComposablevoidhandleClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) booleanhandleLeftClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) booleanhandleRightClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) booleanhandleShiftFrom(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) booleanhandleShiftInto(@NotNull org.bukkit.inventory.ItemStack stack, @NotNull org.bukkit.event.inventory.InventoryClickEvent e) voidinjectRoot(Frame root) Injects frame into this component, the frame can then be retrieved fromComposable.root()@NotNull PackedComposableinside(@NotNull ComposableSpace space) Fits this composable inside the provided space, essentially returning a pair of this component and the space in the form of aPackedComposable.booleanleftClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called when this component is left clicked inside interfacevoidMarks this component dirty, meaning its area will be redrawn next tick.org.bukkit.inventory.ItemStackRenders this component at the provided slot.booleanrightClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called when this component is right clicked inside interfaceroot()Returns the frame this component belongs tofinal booleanshiftFrom(@NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called when this component is shift clicked inside interfacebooleanshiftInto(@NotNull org.bukkit.inventory.ItemStack stack, @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Called when this component is attempted to put items into by shift click.<V> ReactiveState<V>useState(V initial) Constructs a new ReactiveState<V> ReactiveState<V>useUnboundState(V initial) Constructs a new ReactiveState that is **explicitly** not bound to this objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface space.maxus.flare.ui.Composable
asComposable, bind, context, contextOrNull, destroy, drag, into, restore, viewerMethods inherited from interface space.maxus.flare.react.ReactivityProvider
useBoundState, useMemo
-
Field Details
-
props
-
-
Constructor Details
-
FunctionComposable
-
-
Method Details
-
activate
public final void activate() -
compose
-
root
Description copied from interface:ComposableReturns the frame this component belongs to- Specified by:
rootin interfaceComposable- Returns:
- The frame this component belongs to
-
injectRoot
Description copied from interface:ComposableInjects frame into this component, the frame can then be retrieved fromComposable.root()- Specified by:
injectRootin interfaceComposable- Parameters:
root- Frame to be injected
-
renderAt
Description copied from interface:ComposableRenders this component at the provided slot.- Specified by:
renderAtin interfaceComposable- Parameters:
slot- Slot to render at- Returns:
- The rendered item stack
-
markDirty
public void markDirty()Description copied from interface:ComposableMarks this component dirty, meaning its area will be redrawn next tick.- Specified by:
markDirtyin interfaceComposable
-
inside
Description copied from interface:ComposableFits this composable inside the provided space, essentially returning a pair of this component and the space in the form of aPackedComposable.- Specified by:
insidein interfaceComposable- Specified by:
insidein interfaceComposableLike- Parameters:
space- Space to fit inside- Returns:
- A pair of this component and the space in the form of a
PackedComposable
-
handleShiftFrom
public boolean handleShiftFrom(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) -
handleShiftInto
public boolean handleShiftInto(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) -
handleLeftClick
public boolean handleLeftClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) -
handleRightClick
public boolean handleRightClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) -
handleClick
public void handleClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) -
shiftFrom
public final boolean shiftFrom(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled when this component is shift clicked inside interface- Specified by:
shiftFromin interfaceComposable- Parameters:
e- The click event- Returns:
- True if the event should be cancelled, false otherwise
-
shiftInto
public boolean shiftInto(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled when this component is attempted to put items into by shift click. This means that a player clicked on an item inside their inventory, and Flare attempts to fit item inside this composable.- Specified by:
shiftIntoin interfaceComposable- Parameters:
stack- Stack that is attempted to be moved.e- The click event- Returns:
- True if the event should be cancelled, false otherwise
-
leftClick
public boolean leftClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled when this component is left clicked inside interface- Specified by:
leftClickin interfaceComposable- Parameters:
e- The click event- Returns:
- True if the event should be cancelled, false otherwise
-
rightClick
public boolean rightClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled when this component is right clicked inside interface- Specified by:
rightClickin interfaceComposable- Parameters:
e- The click event- Returns:
- True if the event should be cancelled, false otherwise
-
click
public void click(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e) Description copied from interface:ComposableCalled each time this item is clicked, no matter if it is a right click, left click, middle click, etc.- Specified by:
clickin interfaceComposable- Parameters:
e- The click event
-
useState
Description copied from interface:ReactivityProviderConstructs a new ReactiveState- Specified by:
useStatein interfaceReactivityProvider- Type Parameters:
V- Type of the value inside state- Parameters:
initial- Initial value of the state- Returns:
- A new ReactiveState
-
useUnboundState
Description copied from interface:ReactivityProviderConstructs a new ReactiveState that is **explicitly** not bound to this object- Specified by:
useUnboundStatein interfaceReactivityProvider- Type Parameters:
V- Type of the value inside state- Parameters:
initial- Initial value of the state- Returns:
- A new ReactiveState
-
getComposed
-