Package alexiil.mc.lib.multipart.api
Interface MultipartHolder
public interface MultipartHolder
Wrapper interface for an
AbstractPart in a MultipartContainer.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequiredPart(AbstractPart other) Makes thisAbstractPartdepend on another part.collectDrops(PlayerEntity player) Collects all items that can drop from the part.voiddropItems(PlayerEntity player) Drops items at the position of theAbstractPart(by default).default voidenqueueFirstTickTask(Runnable runnable) IfMultipartContainer.hasTicked()returns true then this will just call the runnable directly, and return.getPart()longbooleanvoidremove()Removes thisgetPart()from the container.voidremove(MultipartHolder.PartRemoval... options) Callsremove(), but also performs some actions before removing the part depending on what values are passed in.voidremoveRequiredPart(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_IDif 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 thisAbstractPartdepend 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 aRunnableto be run on the firstPartTickEvent
-