public static class ItemBookCode.Data
extends java.lang.Object
| Constructor and Description |
|---|
Data() |
| Modifier and Type | Method and Description |
|---|---|
void |
addOrSelectProgram(java.util.List<java.lang.String> code)
Add a new program to the book.
|
void |
addPage()
Add a new, blank page to the book.
|
void |
getExtendedProgram(int page,
java.util.List<java.lang.String> program,
java.util.List<java.lang.String> leadingCode,
java.util.List<java.lang.String> trailingCode)
Get the leading and trailing code lines of a program spanning the specified
page, taking into account the
#BWTM preprocessor marco. |
java.util.List<java.lang.String> |
getPage(int index)
Get the code on the specified page.
|
int |
getPageCount()
Get the number of pages stored in the book.
|
java.util.List<java.lang.String> |
getProgram()
Get the complete program of the selected page, taking into account the
#BWTM preprocessor macro allowing programs to span multiple pages. |
int |
getSelectedPage()
Get the page currently selected in the book.
|
static ItemBookCode.Data |
loadFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
Load code book data from the specified NBT tag.
|
static ItemBookCode.Data |
loadFromStack(net.minecraft.item.ItemStack stack)
Load code book data from the specified item stack.
|
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
Load data from the specified NBT tag.
|
void |
removePage(int index)
Remove a page from the book.
|
static void |
saveToStack(net.minecraft.item.ItemStack stack,
ItemBookCode.Data data)
Save the specified code book data to the specified item stack.
|
void |
setPage(int page,
java.util.List<java.lang.String> code)
Overwrite a page at the specified index.
|
void |
setSelectedPage(int index)
Set which page is currently selected.
|
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
Store the data to the specified NBT tag.
|
public int getSelectedPage()
public void setSelectedPage(int index)
index - the new selected index.public int getPageCount()
public java.util.List<java.lang.String> getPage(int index)
index - the index of the page to get the code of.public void addPage()
public void addOrSelectProgram(java.util.List<java.lang.String> code)
Depending on the size of the program, this will generate multiple pages
and automatically insert #BWTM preprocessor macros as
necessary (when they're not already there).
If the provided program is already present in the code book letter by letter, then instead of adding the provided code, the already present program will be selected instead.
code - the code to add or select.public void setPage(int page,
java.util.List<java.lang.String> code)
page - the index of the page to overwrite.code - the code of the page.public void removePage(int index)
index - the index of the page to remove.public java.util.List<java.lang.String> getProgram()
#BWTM preprocessor macro allowing programs to span multiple pages.public void getExtendedProgram(int page,
java.util.List<java.lang.String> program,
java.util.List<java.lang.String> leadingCode,
java.util.List<java.lang.String> trailingCode)
#BWTM preprocessor marco. This
assumes that the specified page does have the #BWTM
preprocessor macro. I.e. the next page will always be added to
the trailingPages.page - the page to extend from.program - the code on the page to extend from.leadingCode - the list to place code from previous pages into.trailingCode - the list to place code from next pages into.public void readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
nbt - the tag to load the data from.public void writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
nbt - the tag to save the data to.public static ItemBookCode.Data loadFromNBT(@Nullable net.minecraft.nbt.NBTTagCompound nbt)
nbt - the tag to load the data from.public static ItemBookCode.Data loadFromStack(net.minecraft.item.ItemStack stack)
stack - the item stack to load the data from.public static void saveToStack(net.minecraft.item.ItemStack stack,
ItemBookCode.Data data)
stack - the item stack to save the data to.data - the data to save to the item stack.