Package com.ardorcraft.util
Class BlockUtil
java.lang.Object
com.ardorcraft.util.BlockUtil
Main class to use for setting up properties for all block types.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetBlockTextureCoord
(int blockId, BlockSide blockSide) Get start coordinates for a specific side of a block.getBlockType
(int blockId) getGeometryProducer
(int blockId) boolean
getIsCollidable
(int blockId) boolean
getIsPickable
(int blockId) boolean
getIsSemiTransparent
(int blockId) float
Get offset to fix the artifact issue of texture bleeding.float
Get offset to fix the artifact issue of texture bleeding.float
Get the height of each tile in the texture atlas.float
Get the width of each tile in the texture atlas.boolean
isLocalLight
(int block) void
setBlockMapping
(int blockId, int x, int y) Setup texture tiles to use for this blockvoid
setBlockMapping
(int blockId, int xTop, int yTop, int xSide, int ySide, int xBottom, int yBottom) Setup texture tiles to use for this blockvoid
setBlockMapping
(int blockId, int xTop, int yTop, int xFront, int yFront, int xBack, int yBack, int xLeft, int yLeft, int xRight, int yRight, int xBottom, int yBottom) Setup texture tiles to use for this blockvoid
setBlockMapping
(int blockId, BlockSide side, int x, int y) Setup texture tiles to use for this blockvoid
setBlockType
(int blockId, BlockType type) Set if this block is see-through or not (if not, then hidden surface removal can be done)void
setGeometryProducer
(int blockId, GeometryProducer handler) Set the geometry producer to use for this block id.void
setIsCollidable
(int blockId, boolean value) Set if the block should be collidable.void
setIsLocalLightSource
(int blockId, boolean value) Set if this block should emit lightvoid
setIsPickable
(int blockId, boolean value) Set if the block should be pickable.void
setIsSemiTransparent
(int blockId, boolean value) Set if the block is semi-transparent like water and should not generate sides when next to itself.
-
Constructor Details
-
BlockUtil
public BlockUtil(int textureWidth, int textureHeight, int subTextureSize)
-
-
Method Details
-
setIsLocalLightSource
public void setIsLocalLightSource(int blockId, boolean value) Set if this block should emit light- Parameters:
blockId
- the identifier of the blockvalue
- the value of the block
-
setBlockMapping
public void setBlockMapping(int blockId, int x, int y) Setup texture tiles to use for this block- Parameters:
blockId
- the identifier of the blockx
- the x valuey
- the y value
-
setBlockMapping
public void setBlockMapping(int blockId, int xTop, int yTop, int xSide, int ySide, int xBottom, int yBottom) Setup texture tiles to use for this block- Parameters:
blockId
- the identifier of the blockxTop
- the x top valueyTop
- the y top valuexSide
- the x side valueySide
- the y side valuexBottom
- the x bottom valueyBottom
- the y bottom value
-
setBlockMapping
public void setBlockMapping(int blockId, int xTop, int yTop, int xFront, int yFront, int xBack, int yBack, int xLeft, int yLeft, int xRight, int yRight, int xBottom, int yBottom) Setup texture tiles to use for this block- Parameters:
blockId
- the identifier of the blockxTop
- the x top valueyTop
- the y top valuexFront
- the x front valueyFront
- the y front valuexBack
- the x back valueyBack
- the y back valuexLeft
- the x left valueyLeft
- the y left valuexRight
- the x right valueyRight
- the y right valuexBottom
- the x bottom valueyBottom
- the y bottom value
-
setBlockMapping
Setup texture tiles to use for this block- Parameters:
blockId
- the identifier of the blockside
- the side of the blockx
- the x valuey
- the y value
-
setBlockType
Set if this block is see-through or not (if not, then hidden surface removal can be done)- Parameters:
blockId
- the identifier of the blocktype
- the type of the block
-
getBlockType
-
isLocalLight
public boolean isLocalLight(int block) -
getBlockTextureCoord
Get start coordinates for a specific side of a block.- Parameters:
blockId
- the identifier of the blockblockSide
- the side of the block- Returns:
- the start coordinates for a specific side of a block
-
getOffsetWidth
public float getOffsetWidth()Get offset to fix the artifact issue of texture bleeding.- Returns:
- the offset width to fix the artifact issue of texture bleeding
-
getOffsetHeight
public float getOffsetHeight()Get offset to fix the artifact issue of texture bleeding.- Returns:
- the offset height to fix the artifact issue of texture bleeding
-
getTileWidth
public float getTileWidth()Get the width of each tile in the texture atlas.- Returns:
- the width of each tile in the texture atlas
-
getTileHeight
public float getTileHeight()Get the height of each tile in the texture atlas.- Returns:
- the height of each tile in the texture atlas
-
setGeometryProducer
Set the geometry producer to use for this block id.- Parameters:
blockId
- the identifier of the blockhandler
- the geometry producer to use for this identifier of block
-
getGeometryProducer
-
setIsCollidable
public void setIsCollidable(int blockId, boolean value) Set if the block should be collidable.- Parameters:
blockId
- the identifier of the blockvalue
-true
if the block should be collidable
-
getIsCollidable
public boolean getIsCollidable(int blockId) -
setIsPickable
public void setIsPickable(int blockId, boolean value) Set if the block should be pickable.- Parameters:
blockId
- the identifier of the blockvalue
-true
if the block should be pickable
-
getIsPickable
public boolean getIsPickable(int blockId) -
setIsSemiTransparent
public void setIsSemiTransparent(int blockId, boolean value) Set if the block is semi-transparent like water and should not generate sides when next to itself.- Parameters:
blockId
- the identifier of the blockvalue
-true
if the block is semi-transparent like water and should not generate sides when next to itself
-
getIsSemiTransparent
public boolean getIsSemiTransparent(int blockId)
-