Package alexiil.mc.lib.multipart.api
Interface MultipartHolder
public interface MultipartHolder
Wrapper interface for an
AbstractPart
in a MultipartContainer
.-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequiredPart
(AbstractPart other) Makes thisAbstractPart
depend on another part.collectDrops
(PlayerEntity player) Collects all items that can drop from the part.void
dropItems
(PlayerEntity player) Drops items at the position of theAbstractPart
(by default).default void
enqueueFirstTickTask
(Runnable runnable) IfMultipartContainer.hasTicked()
returns true then this will just call the runnable directly, and return.getPart()
long
boolean
void
remove()
Removes thisgetPart()
from the container.void
remove
(MultipartHolder.PartRemoval... options) Callsremove()
, but also performs some actions before removing the part depending on what values are passed in.void
removeRequiredPart
(AbstractPart other) Removes the requirement this has for the given part.
-
Field Details
-
NOT_ADDED_UNIQUE_ID
static final long NOT_ADDED_UNIQUE_ID- See Also:
-
-
Method Details
-
getContainer
MultipartContainer getContainer() -
getPart
AbstractPart getPart() -
remove
void remove()Removes thisgetPart()
from the container. -
remove
Callsremove()
, but also performs some actions before removing the part depending on what values are passed in. -
dropItems
Drops items at the position of theAbstractPart
(by default).- Parameters:
player
- The player entity, or null if no player is present.
-
collectDrops
Collects all items that can drop from the part.- Parameters:
player
- The player, or null if no player is present.
-
getUniqueId
long getUniqueId()- Returns:
- The (container-only) unique ID for this part holder, or
NOT_ADDED_UNIQUE_ID
if this hasn't been added to it's container.
-
isPresent
boolean isPresent()- Returns:
- True if this holder is contained in it's
getContainer()
, false otherwise.
-
addRequiredPart
Makes thisAbstractPart
depend on another part. -
removeRequiredPart
Removes the requirement this has for the given part. (This invertsaddRequiredPart(AbstractPart)
-
enqueueFirstTickTask
IfMultipartContainer.hasTicked()
returns true then this will just call the runnable directly, and return. Otherwise this will add an event listener for thePartTickEvent
, and remove it when it is first ran. Enqueue's aRunnable
to be run on the firstPartTickEvent
-