diff --git a/README.md b/README.md index 09f33d5d0..bebcba142 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,8 @@ minecraft { ``` 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 -exposing more features. +subject to change at any point. If you depend on functionality outside the API (or need to mixin to CC:T), please file +an issue to let me know! 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/). diff --git a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java index 4856e68af..60943702e 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/printer/PrinterPeripheral.java @@ -15,14 +15,44 @@ import javax.annotation.Nullable; 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. *

- * ## 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. + *

+ * ## Recipes *

* + * + * *
* + * @cc.usage Print a page titled "Hello" with a small message on it. + * + *
{@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
+ * }
* @cc.module printer + * @cc.see cc.strings.wrap To wrap text before printing it. */ public class PrinterPeripheral implements IPeripheral { private final PrinterBlockEntity printer;