2018-12-28 02:55:51 +00:00
|
|
|
package net.shadowfacts.simplemultipart.container;
|
2018-12-25 15:25:51 +00:00
|
|
|
|
2018-12-28 02:55:51 +00:00
|
|
|
import net.shadowfacts.simplemultipart.multipart.MultipartView;
|
2018-12-25 15:25:51 +00:00
|
|
|
import net.shadowfacts.simplemultipart.multipart.MultipartState;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
/**
|
2018-12-28 18:10:59 +00:00
|
|
|
* An interface for an object that contains multiparts.
|
|
|
|
* Usually a {@link net.minecraft.block.entity.BlockEntity}; default implementation is {@link AbstractContainerBlockEntity}.
|
|
|
|
*
|
2018-12-25 15:25:51 +00:00
|
|
|
* @author shadowfacts
|
2018-12-28 18:10:59 +00:00
|
|
|
* @since 0.1.0
|
2018-12-25 15:25:51 +00:00
|
|
|
*/
|
|
|
|
public interface MultipartContainer {
|
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Retrieves all the multiparts held by this container.
|
|
|
|
*
|
|
|
|
* @see MultipartView
|
|
|
|
* @return All multiparts held by this container.
|
|
|
|
*/
|
2018-12-25 15:25:51 +00:00
|
|
|
Set<MultipartView> getParts();
|
|
|
|
|
2018-12-28 18:13:51 +00:00
|
|
|
/**
|
|
|
|
* @return If this container has any parts in it.
|
|
|
|
*/
|
|
|
|
boolean hasParts();
|
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Determines whether the given multipart state can be inserted into this container.
|
|
|
|
* Checks that the bounding box of the new part does not intersect with any existing ones.
|
|
|
|
*
|
|
|
|
* @param state The new multipart state.
|
|
|
|
* @return If the part can be inserted.
|
|
|
|
*/
|
2018-12-25 15:25:51 +00:00
|
|
|
boolean canInsert(MultipartState state);
|
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Performs the insertion of the given multipart into this container.
|
|
|
|
*
|
|
|
|
* @param state The new multipart state.
|
|
|
|
*/
|
2018-12-25 15:25:51 +00:00
|
|
|
void insert(MultipartState state);
|
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Removes the given multipart from this container.
|
|
|
|
*
|
|
|
|
* @see MultipartView
|
|
|
|
* @param view The part to remove
|
|
|
|
*/
|
2018-12-25 18:29:54 +00:00
|
|
|
void remove(MultipartView view);
|
2018-12-25 15:25:51 +00:00
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Breaks the given multipart. Removes it from this container and drops the part as an item.
|
|
|
|
*
|
|
|
|
* @param view The part to break.
|
|
|
|
* @return If the part has been successfully broken.
|
|
|
|
*/
|
2018-12-25 18:29:54 +00:00
|
|
|
boolean breakPart(MultipartView view);
|
2018-12-25 15:25:51 +00:00
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Indicates that something about a multipart in this container has changed and it should be saved to disk.
|
|
|
|
* Does not trigger a network update.
|
|
|
|
*/
|
2018-12-25 15:30:46 +00:00
|
|
|
void schedulePartSave();
|
|
|
|
|
2018-12-25 15:25:51 +00:00
|
|
|
}
|