public interface TextBuffer extends ManagedEnvironment, Persistable
final ItemStack stack = li.cil.oc.api.Items.get("screen1").createItemStack(1); final TextBuffer buffer = (TextBuffer) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
Modifier and Type | Interface and Description |
---|---|
static class |
TextBuffer.ColorDepth
Used when setting a buffer's maximum color depth.
|
Modifier and Type | Method and Description |
---|---|
void |
clipboard(java.lang.String value,
net.minecraft.entity.player.EntityPlayer player)
Signals a clipboard paste event for the buffer.
|
void |
copy(int column,
int row,
int width,
int height,
int horizontalTranslation,
int verticalTranslation)
Copy a portion of the text buffer.
|
void |
fill(int column,
int row,
int width,
int height,
char value)
Fill a portion of the text buffer.
|
char |
get(int column,
int row)
Get the character in the text buffer at the specified location.
|
double |
getAspectRatio()
Get the aspect ratio of the buffer.
|
int |
getBackgroundColor()
The active background color.
|
int |
getBackgroundColor(int column,
int row)
Get the background color of the text buffer at the specified location.
|
TextBuffer.ColorDepth |
getColorDepth()
Get the active color depth of this buffer.
|
double |
getEnergyCostPerTick()
Get the energy cost per tick.
|
int |
getForegroundColor()
The active foreground color.
|
int |
getForegroundColor(int column,
int row)
Get the foreground color of the text buffer at the specified location.
|
int |
getHeight()
Get the current vertical resolution.
|
TextBuffer.ColorDepth |
getMaximumColorDepth()
Get the maximum color depth supported.
|
int |
getMaximumHeight()
Get the maximum vertical size of the buffer.
|
int |
getMaximumWidth()
Get the maximum horizontal size of the buffer.
|
int |
getPaletteColor(int index)
Get the color in the active color palette at the specified index.
|
boolean |
getPowerState()
Get the current power state.
|
int |
getViewportHeight()
Get the current vertical viewport resolution.
|
int |
getViewportWidth()
Get the current horizontal viewport resolution.
|
int |
getWidth()
Get the current horizontal resolution.
|
boolean |
isBackgroundFromPalette()
true if the background color is from the color palette, meaning
the value returned from
getBackgroundColor() is the color
palette index. |
boolean |
isBackgroundFromPalette(int column,
int row)
Whether the background color of the text buffer at the specified
location if from the color palette.
|
boolean |
isForegroundFromPalette()
true if the foreground color is from the color palette, meaning
the value returned from
getForegroundColor() is the color
palette index. |
boolean |
isForegroundFromPalette(int column,
int row)
Whether the foreground color of the text buffer at the specified
location if from the color palette.
|
boolean |
isRenderingEnabled()
Gets whether the contents of the buffer should currently be rendered.
|
void |
keyDown(char character,
int code,
net.minecraft.entity.player.EntityPlayer player)
Signals a key down event for the buffer.
|
void |
keyUp(char character,
int code,
net.minecraft.entity.player.EntityPlayer player)
Signals a key up event for the buffer.
|
void |
mouseDown(double x,
double y,
int button,
net.minecraft.entity.player.EntityPlayer player)
Signals a mouse button down event for the buffer.
|
void |
mouseDrag(double x,
double y,
int button,
net.minecraft.entity.player.EntityPlayer player)
Signals a mouse drag event for the buffer.
|
void |
mouseScroll(double x,
double y,
int delta,
net.minecraft.entity.player.EntityPlayer player)
Signals a mouse wheel scroll event for the buffer.
|
void |
mouseUp(double x,
double y,
int button,
net.minecraft.entity.player.EntityPlayer player)
Signals a mouse button release event for the buffer.
|
void |
rawSetBackground(int column,
int row,
int[][] color)
Overwrites a portion of the background color information in raw mode.
|
void |
rawSetForeground(int column,
int row,
int[][] color)
Overwrites a portion of the foreground color information in raw mode.
|
void |
rawSetText(int column,
int row,
char[][] text)
Overwrites a portion of the text in raw mode.
|
int |
renderHeight()
The natural height of the rendered text.
|
boolean |
renderText()
Renders the text displayed on the buffer.
|
int |
renderWidth()
The natural width of the rendered text.
|
void |
set(int column,
int row,
java.lang.String value,
boolean vertical)
Write a string into the text buffer.
|
void |
setAspectRatio(double width,
double height)
Set the 'aspect ratio' of the buffer.
|
void |
setBackgroundColor(int color)
Set the active background color, not using a palette.
|
void |
setBackgroundColor(int color,
boolean isFromPalette)
Set the active background color.
|
boolean |
setColorDepth(TextBuffer.ColorDepth depth)
Set the active color depth for this buffer.
|
void |
setEnergyCostPerTick(double value)
Controls how much energy the buffer will consume per tick.
|
void |
setForegroundColor(int color)
Set the active foreground color, not using a palette.
|
void |
setForegroundColor(int color,
boolean isFromPalette)
Set the active foreground color.
|
void |
setMaximumColorDepth(TextBuffer.ColorDepth depth)
Sets the maximum color depth supported by this buffer.
|
void |
setMaximumResolution(int width,
int height)
Sets the maximum resolution supported by this buffer.
|
void |
setPaletteColor(int index,
int color)
Set the color of the active color palette at the specified index.
|
void |
setPowerState(boolean value)
Set whether the buffer is powered on.
|
void |
setRenderingEnabled(boolean enabled)
Set whether the contents of the buffer should currently be rendered.
|
boolean |
setResolution(int width,
int height)
Set the buffer's active resolution.
|
boolean |
setViewport(int width,
int height)
Set the buffer's active viewport resolution.
|
canUpdate, update
node, onConnect, onDisconnect, onMessage
load, save
void setEnergyCostPerTick(double value)
value
- the base energy cost per tick.getEnergyCostPerTick()
double getEnergyCostPerTick()
setEnergyCostPerTick(double)
void setPowerState(boolean value)
value
- whether the buffer should be on or not.getPowerState()
boolean getPowerState()
setPowerState(boolean)
void setMaximumResolution(int width, int height)
width
- the maximum horizontal resolution, in characters.height
- the maximum vertical resolution, in characters.int getMaximumWidth()
int getMaximumHeight()
void setAspectRatio(double width, double height)
width
- the horizontal size of the physical representation.height
- the vertical size of the physical representation.double getAspectRatio()
setAspectRatio(double, double)
boolean setResolution(int width, int height)
width
- the horizontal resolution.height
- the vertical resolution.int getWidth()
setResolution(int, int)
int getHeight()
setResolution(int, int)
boolean setViewport(int width, int height)
width
- the horizontal resolution.height
- the vertical resolution.setResolution(int, int)
int getViewportWidth()
setViewport(int, int)
int getViewportHeight()
setViewport(int, int)
void setMaximumColorDepth(TextBuffer.ColorDepth depth)
depth
- the maximum color depth of the buffer.TextBuffer.ColorDepth getMaximumColorDepth()
boolean setColorDepth(TextBuffer.ColorDepth depth)
depth
- the new color depth.TextBuffer.ColorDepth getColorDepth()
void setPaletteColor(int index, int color)
index
- the index at which to set the color.color
- the color to set for the specified index.int getPaletteColor(int index)
index
- the index at which to get the color.void setForegroundColor(int color)
color
- the new foreground color.setForegroundColor(int, boolean)
void setForegroundColor(int color, boolean isFromPalette)
color
- the color or palette index.isFromPalette
- trueif color specifies a palette index.int getForegroundColor()
boolean isForegroundFromPalette()
getForegroundColor()
is the color
palette index.void setBackgroundColor(int color)
color
- the new background color.setBackgroundColor(int, boolean)
void setBackgroundColor(int color, boolean isFromPalette)
color
- the color or palette index.isFromPalette
- trueif color specifies a palette index.int getBackgroundColor()
boolean isBackgroundFromPalette()
getBackgroundColor()
is the color
palette index.void copy(int column, int row, int width, int height, int horizontalTranslation, int verticalTranslation)
column
- the starting horizontal index of the area to copy.row
- the starting vertical index of the area to copy.width
- the width of the area to copy.height
- the height of the area to copy.horizontalTranslation
- the horizontal offset, relative to the starting column to copy the are to.verticalTranslation
- the vertical offset, relative to the starting row to copy the are to.void fill(int column, int row, int width, int height, char value)
column
- the starting horizontal index of the area to fill.row
- the starting vertical index of the area to fill.width
- the width of the area to fill.height
- the height of the area to fill.value
- the character to fill the area with.void set(int column, int row, java.lang.String value, boolean vertical)
column
- the starting horizontal index to write at.row
- the starting vertical index to write at.value
- the string to write.vertical
- true if the string should be written vertically instead of horizontally.char get(int column, int row)
column
- the horizontal index.row
- the vertical index.int getForegroundColor(int column, int row)
column
- the horizontal index.row
- the vertical index.boolean isForegroundFromPalette(int column, int row)
column
- the horizontal index.row
- the vertical index.int getBackgroundColor(int column, int row)
column
- the horizontal index.row
- the vertical index.boolean isBackgroundFromPalette(int column, int row)
column
- the horizontal index.row
- the vertical index.void rawSetText(int column, int row, char[][] text)
column
- the horizontal index.row
- the vertical index.text
- the text to write.void rawSetForeground(int column, int row, int[][] color)
column
- the horizontal index.row
- the vertical index.color
- the foreground color data to write.void rawSetBackground(int column, int row, int[][] color)
column
- the horizontal index.row
- the vertical index.color
- the background color data to write.boolean renderText()
int renderWidth()
int renderHeight()
void setRenderingEnabled(boolean enabled)
enabled
- whether the text buffer should be rendered.boolean isRenderingEnabled()
setRenderingEnabled(boolean)
void keyDown(char character, int code, net.minecraft.entity.player.EntityPlayer player)
character
- the character of the pressed key.code
- the key code of the pressed key.player
- the player that pressed the key. Pass null on the client side.void keyUp(char character, int code, net.minecraft.entity.player.EntityPlayer player)
character
- the character of the released key.code
- the key code of the released key.player
- the player that released the key. Pass null on the client side.void clipboard(java.lang.String value, net.minecraft.entity.player.EntityPlayer player)
value
- the text that was pasted.player
- the player that pasted the text. Pass null on the client side.void mouseDown(double x, double y, int button, net.minecraft.entity.player.EntityPlayer player)
x
- the horizontal coordinate of the mouse, in characters.y
- the vertical coordinate of the mouse, in characters.button
- the button of the mouse that was pressed.player
- the player that pressed the mouse button. Pass null on the client side.void mouseDrag(double x, double y, int button, net.minecraft.entity.player.EntityPlayer player)
x
- the horizontal coordinate of the mouse, in characters.y
- the vertical coordinate of the mouse, in characters.button
- the button of the mouse that is pressed.player
- the player that moved the mouse. Pass null on the client side.void mouseUp(double x, double y, int button, net.minecraft.entity.player.EntityPlayer player)
x
- the horizontal coordinate of the mouse, in characters.y
- the vertical coordinate of the mouse, in characters.button
- the button of the mouse that was released.player
- the player that released the mouse button. Pass null on the client side.void mouseScroll(double x, double y, int delta, net.minecraft.entity.player.EntityPlayer player)
x
- the horizontal coordinate of the mouse, in characters.y
- the vertical coordinate of the mouse, in characters.delta
- indicates the direction of the mouse scroll.player
- the player that scrolled the mouse wheel. Pass null on the client side.