mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-08 23:20:06 +00:00
Flesh out the printer documentation slightly
This commit is contained in:
parent
4d1e689719
commit
b5923c4462
@ -75,8 +75,8 @@ minecraft {
|
|||||||
```
|
```
|
||||||
|
|
||||||
You should also be careful to only use classes within the `dan200.computercraft.api` package. Non-API classes are
|
You should also be careful to only use classes within the `dan200.computercraft.api` package. Non-API classes are
|
||||||
subject to change at any point. If you depend on functionality outside the API, file an issue, and we can look into
|
subject to change at any point. If you depend on functionality outside the API (or need to mixin to CC:T), please file
|
||||||
exposing more features.
|
an issue to let me know!
|
||||||
|
|
||||||
We bundle the API sources with the jar, so documentation should be easily viewable within your editor. Alternatively,
|
We bundle the API sources with the jar, so documentation should be easily viewable within your editor. Alternatively,
|
||||||
the generated documentation [can be browsed online](https://tweaked.cc/javadoc/).
|
the generated documentation [can be browsed online](https://tweaked.cc/javadoc/).
|
||||||
|
@ -15,14 +15,44 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The printer peripheral allows pages and books to be printed.
|
* The printer peripheral allows printing text onto pages. These pages can then be crafted together into printed pages
|
||||||
|
* or books.
|
||||||
* <p>
|
* <p>
|
||||||
* ## Recipe
|
* Printers require ink (one of the coloured dyes) and paper in order to function. Once loaded, a new page can be
|
||||||
|
* started with {@link #newPage()}. Then the printer can be used similarly to a normal terminal; {@linkplain
|
||||||
|
* #write(Coerced) text can be written}, and {@linkplain #setCursorPos(int, int) the cursor moved}. Once all text has
|
||||||
|
* been printed, {@link #endPage()} should be called to finally print the page.
|
||||||
|
* <p>
|
||||||
|
* ## Recipes
|
||||||
* <div class="recipe-container">
|
* <div class="recipe-container">
|
||||||
* <mc-recipe recipe="computercraft:printer"></mc-recipe>
|
* <mc-recipe recipe="computercraft:printer"></mc-recipe>
|
||||||
|
* <mc-recipe recipe="computercraft:printed_pages"></mc-recipe>
|
||||||
|
* <mc-recipe recipe="computercraft:printed_book"></mc-recipe>
|
||||||
* </div>
|
* </div>
|
||||||
*
|
*
|
||||||
|
* @cc.usage Print a page titled "Hello" with a small message on it.
|
||||||
|
*
|
||||||
|
* <pre>{@code
|
||||||
|
* local printer = peripheral.find("printer")
|
||||||
|
*
|
||||||
|
* -- Start a new page, or print an error.
|
||||||
|
* if not printer.newPage() then
|
||||||
|
* error("Cannot start a new page. Do you have ink and paper?")
|
||||||
|
* end
|
||||||
|
*
|
||||||
|
* -- Write to the page
|
||||||
|
* printer.setPageTitle("Hello")
|
||||||
|
* printer.write("This is my first page")
|
||||||
|
* printer.setCursorPos(1, 3)
|
||||||
|
* printer.write("This is two lines below.")
|
||||||
|
*
|
||||||
|
* -- And finally print the page!
|
||||||
|
* if not printer.endPage() then
|
||||||
|
* error("Cannot end the page. Is there enough space?")
|
||||||
|
* end
|
||||||
|
* }</pre>
|
||||||
* @cc.module printer
|
* @cc.module printer
|
||||||
|
* @cc.see cc.strings.wrap To wrap text before printing it.
|
||||||
*/
|
*/
|
||||||
public class PrinterPeripheral implements IPeripheral {
|
public class PrinterPeripheral implements IPeripheral {
|
||||||
private final PrinterBlockEntity printer;
|
private final PrinterBlockEntity printer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user