-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #2099
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
projects/common-api/src/main/java/dan200/computercraft/api/media/PrintoutContents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-FileCopyrightText: 2025 The CC: Tweaked Developers | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package dan200.computercraft.api.media; | ||
|
||
import dan200.computercraft.impl.ComputerCraftAPIService; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* The contents of a page (or book) created by a ComputerCraft printer. | ||
* | ||
* @since 1.115 | ||
*/ | ||
@Nullable | ||
public interface PrintoutContents { | ||
/** | ||
* Get the (possibly empty) title for this printout. | ||
* | ||
* @return The title of this printout. | ||
*/ | ||
String getTitle(); | ||
|
||
/** | ||
* Get the text contents of this printout, as a sequence of lines. | ||
* <p> | ||
* The lines in the printout may include blank lines at the end of the document, as well as trailing spaces on each | ||
* line. | ||
* | ||
* @return The text contents of this printout. | ||
*/ | ||
Stream<String> getTextLines(); | ||
|
||
/** | ||
* Get the printout contents for a particular stack. | ||
* | ||
* @param stack The stack to get the contents for. | ||
* @return The printout contents, or {@code null} if this is not a printout item. | ||
*/ | ||
static @Nullable PrintoutContents get(ItemStack stack) { | ||
return ComputerCraftAPIService.get().getPrintoutContents(stack); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters