com.cliffblaster.game.level.tile
Class Tile

java.lang.Object
  extended by com.cliffblaster.game.level.tile.Tile
Direct Known Subclasses:
ConveyorTile, DirtTile, DislodgerTile, DynamiteTile, GlassTile, GrassTile, LeavesTile, LiquidTile, PlainDuotextureTile, PlantTile, RandomizedDuotextureTile, RandomTextureTile, SedimentTile, SlabTile, SpongeTile, TrampolineTile

public class Tile
extends java.lang.Object

Base tile class, creates all the tiles and stores tile information

Author:
Vulpovile

Field Summary
protected static int BACK
          Face values for rendering
static Tile bookshelf
           
static Tile bookshelf_empty
           
protected static int BOTTOM
          Face values for rendering
static Tile bricks
           
static boolean[] canTick
           
static Tile canvas_black
           
static Tile canvas_blue
           
static Tile canvas_cyan
           
static Tile canvas_green
           
static Tile canvas_grey
           
static Tile canvas_indigo
           
static Tile canvas_lightblue
           
static Tile canvas_lime
           
static Tile canvas_magenta
           
static Tile canvas_orange
           
static Tile canvas_pink
           
static Tile canvas_red
           
static Tile canvas_turquoise
           
static Tile canvas_violet
           
static Tile canvas_white
           
static Tile canvas_yellow
           
static Tile coalblock
           
static Tile coalore
           
static Tile conveyor
           
static Tile dandelion
           
static Tile dirt
           
static Tile dislodgerblock
           
static Tile dynamite
           
static Tile elevator
           
protected static int FRONT
          Face values for rendering
static Tile glass
           
static Tile goldblock
           
static Tile goldore
           
static Tile grass
           
static Tile gravel
           
 int id
           
static Tile ironblock
           
static Tile ironore
           
static byte IS_LIQUID
           
static Tile lava
           
static byte LAVA
           
static Tile leaves
           
protected static int LEFT
          Face values for rendering
 byte liquidType
           
static Tile log
           
static byte MOVING
           
static Tile obsidian
           
static Tile plant
           
protected static int RIGHT
          Face values for rendering
static Tile rose
           
static Tile sand
           
static Tile siding
           
static Tile sponge
           
static byte STILL
           
static Tile stilllava
           
static Tile stillwater
           
static Tile stone
           
static Tile stonebrick
           
 int texCoord
           
static Tile[] tiles
           
protected static int TOP
          Face values for rendering
static Tile trampoline
           
static Tile water
           
static byte WATER
           
static Tile woodplank
           
 
Constructor Summary
protected Tile(int id)
          Create a tile specifying the ID and using the default texture coordinate
protected Tile(int id, int texCoord)
          Create a tile specifying the ID and texture coordinate on the tiles.png file
 
Method Summary
 boolean blocksLight()
          Tells whether the tile blocks light
 boolean canExplode()
           
protected  boolean canRenderFace(com.cliffblaster.game.level.Level level, int x, int y, int z, int layer)
          Determines whether the face can be rendered
 void entityHit(com.cliffblaster.game.level.Level level, int x, int y, int z, com.cliffblaster.game.entity.Entity entity, int direction)
          Function called when entity hits the tile
 void flow(com.cliffblaster.game.level.Level level, int x, int y, int z)
           
 long getFlowDivider()
           
 java.lang.String getStepSound()
           
 int getTextureFromFace(int face)
          Gets the texture for the face
 int getTextureFromFace(int face, com.cliffblaster.game.level.Level level, float x, float y, float z)
          Gets the texture for the face and level
 AABB getTileAABB(com.cliffblaster.game.level.Level level, int x, int y, int z)
          Gets the AABB of the tile
 AABB getTileRenderAABB(com.cliffblaster.game.level.Level level, int x, int y, int z)
          Gets the AABB of the tile
 java.lang.String getTitle()
           
 boolean glows()
           
 boolean isMechanical()
           
 boolean isOpaque()
           
 boolean mayPick()
           
 void onDestroy(com.cliffblaster.game.level.Level level, com.cliffblaster.game.entity.Player player, int x, int y, int z)
           
 void onExplode(com.cliffblaster.game.level.Level level, int x, int y, int z, float distance)
           
 void onNeighbourNotify(com.cliffblaster.game.level.Level level, int x, int y, int z, int notifierId)
          Tile notify
 void onNeighbourNotify(com.cliffblaster.game.level.Level level, int x, int y, int z, int ntx, int nty, int ntz, int notifierId)
          Tile notify
 void onPlace(com.cliffblaster.game.level.Level level, int x, int y, int z)
           
 void onRemove(com.cliffblaster.game.level.Level level, int x, int y, int z)
           
 void render(com.cliffblaster.game.level.Level level, int x, int y, int z, int layer)
          Render function, renders tile with location to render, the layer, and on what level.
protected  void renderBackFace(com.cliffblaster.game.level.Level level, int face, float x, float y, float z)
          Renders the backside of the face
protected  void renderFace(com.cliffblaster.game.level.Level level, int face, float x, float y, float z)
          Renders the given face
 void renderUnbound(com.cliffblaster.game.level.Level level, float x, float y, float z)
           
protected  void setShape(float sx, float sy, float sz, float ex, float ey, float ez)
           
protected  Tile setStepSound(java.lang.String sound)
          Set the step sound for the tile
protected  void setTick(boolean ticks)
          Marks the tile as tickable
protected  Tile setTitle(java.lang.String string)
          Sets a tooltip title for the block
 void tick(com.cliffblaster.game.level.Level level, int x, int y, int z)
          Tile tick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tiles

public static Tile[] tiles

canTick

public static boolean[] canTick

IS_LIQUID

public static final byte IS_LIQUID
See Also:
Constant Field Values

WATER

public static final byte WATER
See Also:
Constant Field Values

LAVA

public static final byte LAVA
See Also:
Constant Field Values

STILL

public static final byte STILL
See Also:
Constant Field Values

MOVING

public static final byte MOVING
See Also:
Constant Field Values

stone

public static final Tile stone

grass

public static final Tile grass

dirt

public static final Tile dirt

stonebrick

public static final Tile stonebrick

woodplank

public static final Tile woodplank

trampoline

public static final Tile trampoline

elevator

public static final Tile elevator

plant

public static final Tile plant

glass

public static final Tile glass

water

public static final Tile water

stillwater

public static final Tile stillwater

lava

public static final Tile lava

stilllava

public static final Tile stilllava

log

public static final Tile log

leaves

public static final Tile leaves

sponge

public static final Tile sponge

rose

public static final Tile rose

dandelion

public static final Tile dandelion

sand

public static final Tile sand

gravel

public static final Tile gravel

siding

public static final Tile siding

dynamite

public static final Tile dynamite

conveyor

public static final Tile conveyor

coalore

public static final Tile coalore

ironore

public static final Tile ironore

goldore

public static final Tile goldore

coalblock

public static final Tile coalblock

ironblock

public static final Tile ironblock

goldblock

public static final Tile goldblock

dislodgerblock

public static final Tile dislodgerblock

bricks

public static final Tile bricks

canvas_white

public static final Tile canvas_white

canvas_black

public static final Tile canvas_black

canvas_grey

public static final Tile canvas_grey

canvas_red

public static final Tile canvas_red

canvas_orange

public static final Tile canvas_orange

canvas_yellow

public static final Tile canvas_yellow

canvas_green

public static final Tile canvas_green

canvas_lime

public static final Tile canvas_lime

canvas_turquoise

public static final Tile canvas_turquoise

canvas_cyan

public static final Tile canvas_cyan

canvas_lightblue

public static final Tile canvas_lightblue

canvas_blue

public static final Tile canvas_blue

canvas_indigo

public static final Tile canvas_indigo

canvas_violet

public static final Tile canvas_violet

canvas_pink

public static final Tile canvas_pink

canvas_magenta

public static final Tile canvas_magenta

bookshelf_empty

public static final Tile bookshelf_empty

bookshelf

public static final Tile bookshelf

obsidian

public static final Tile obsidian

liquidType

public byte liquidType

id

public final int id

texCoord

public final int texCoord

TOP

protected static final int TOP
Face values for rendering

See Also:
Constant Field Values

BOTTOM

protected static final int BOTTOM
Face values for rendering

See Also:
Constant Field Values

FRONT

protected static final int FRONT
Face values for rendering

See Also:
Constant Field Values

BACK

protected static final int BACK
Face values for rendering

See Also:
Constant Field Values

RIGHT

protected static final int RIGHT
Face values for rendering

See Also:
Constant Field Values

LEFT

protected static final int LEFT
Face values for rendering

See Also:
Constant Field Values
Constructor Detail

Tile

protected Tile(int id,
               int texCoord)
Create a tile specifying the ID and texture coordinate on the tiles.png file

Parameters:
id -
texCoord -

Tile

protected Tile(int id)
Create a tile specifying the ID and using the default texture coordinate

Parameters:
id -
Method Detail

setTitle

protected Tile setTitle(java.lang.String string)
Sets a tooltip title for the block

Parameters:
string -
Returns:
self

setStepSound

protected Tile setStepSound(java.lang.String sound)
Set the step sound for the tile

Parameters:
sound - ID ending
Returns:
self

getTitle

public java.lang.String getTitle()
Returns:
Tooltip title for the tile

setTick

protected void setTick(boolean ticks)
Marks the tile as tickable

Parameters:
ticks -

canRenderFace

protected boolean canRenderFace(com.cliffblaster.game.level.Level level,
                                int x,
                                int y,
                                int z,
                                int layer)
Determines whether the face can be rendered

Parameters:
level -
x -
y -
z -
layer -
Returns:

render

public void render(com.cliffblaster.game.level.Level level,
                   int x,
                   int y,
                   int z,
                   int layer)
Render function, renders tile with location to render, the layer, and on what level.

Parameters:
level -
x -
y -
z -
layer -

renderUnbound

public void renderUnbound(com.cliffblaster.game.level.Level level,
                          float x,
                          float y,
                          float z)

getTileAABB

public AABB getTileAABB(com.cliffblaster.game.level.Level level,
                        int x,
                        int y,
                        int z)
Gets the AABB of the tile

Parameters:
level -
x -
y -
z -
Returns:
AABB

getTileRenderAABB

public AABB getTileRenderAABB(com.cliffblaster.game.level.Level level,
                              int x,
                              int y,
                              int z)
Gets the AABB of the tile

Parameters:
level -
x -
y -
z -
Returns:
AABB

mayPick

public boolean mayPick()

renderFace

protected void renderFace(com.cliffblaster.game.level.Level level,
                          int face,
                          float x,
                          float y,
                          float z)
Renders the given face

Parameters:
level -
face -
x -
y -
z -

renderBackFace

protected void renderBackFace(com.cliffblaster.game.level.Level level,
                              int face,
                              float x,
                              float y,
                              float z)
Renders the backside of the face

Parameters:
level -
face -
x -
y -
z -

entityHit

public void entityHit(com.cliffblaster.game.level.Level level,
                      int x,
                      int y,
                      int z,
                      com.cliffblaster.game.entity.Entity entity,
                      int direction)
Function called when entity hits the tile

Parameters:
level -
x -
y -
z -
entity -
direction - (AABB face)

getTextureFromFace

public int getTextureFromFace(int face)
Gets the texture for the face

Parameters:
face -
Returns:
texCoord

getTextureFromFace

public int getTextureFromFace(int face,
                              com.cliffblaster.game.level.Level level,
                              float x,
                              float y,
                              float z)
Gets the texture for the face and level

Parameters:
face -
Returns:

blocksLight

public boolean blocksLight()
Tells whether the tile blocks light

Returns:
blocksLight

isOpaque

public boolean isOpaque()

glows

public boolean glows()

setShape

protected void setShape(float sx,
                        float sy,
                        float sz,
                        float ex,
                        float ey,
                        float ez)

tick

public void tick(com.cliffblaster.game.level.Level level,
                 int x,
                 int y,
                 int z)
Tile tick

Parameters:
level -
x -
y -
z -

onNeighbourNotify

public void onNeighbourNotify(com.cliffblaster.game.level.Level level,
                              int x,
                              int y,
                              int z,
                              int notifierId)
Tile notify

Parameters:
level -
x -
y -
z -
notifierId -

onNeighbourNotify

public void onNeighbourNotify(com.cliffblaster.game.level.Level level,
                              int x,
                              int y,
                              int z,
                              int ntx,
                              int nty,
                              int ntz,
                              int notifierId)
Tile notify

Parameters:
level -
x -
y -
z -
notifierId -

onPlace

public void onPlace(com.cliffblaster.game.level.Level level,
                    int x,
                    int y,
                    int z)

onRemove

public void onRemove(com.cliffblaster.game.level.Level level,
                     int x,
                     int y,
                     int z)

flow

public void flow(com.cliffblaster.game.level.Level level,
                 int x,
                 int y,
                 int z)

getFlowDivider

public long getFlowDivider()

canExplode

public boolean canExplode()

onExplode

public void onExplode(com.cliffblaster.game.level.Level level,
                      int x,
                      int y,
                      int z,
                      float distance)

onDestroy

public void onDestroy(com.cliffblaster.game.level.Level level,
                      com.cliffblaster.game.entity.Player player,
                      int x,
                      int y,
                      int z)

isMechanical

public boolean isMechanical()

getStepSound

public java.lang.String getStepSound()