-
Notifications
You must be signed in to change notification settings - Fork 18
Styles
There are two types of styling possible - chessboards and chess sets.
All board styles are stored as files in plugins/ChessCraft/board_styles under your Bukkit folder. There is one file per style. It is a YAML file and must have a .yml extension.
Some configuration items define the materials used in creating chessboards (and pieces). There are a couple of ways to specify these:
- As simple integers, e.g. '5' is wood, '24' is sandstone, '49' is obsidian... plain integers must be quoted, or the style will not load!
- As Bukkit material names, e.g. wood, sandstone...
- As item id plus data byte, e.g. 35:0, wool:white, wool:red...
This is the default style, Standard.yml:
# Chess board style definition
# NOTE: all materials must be quoted, even if they're just integers, or
# you will get a java.lang.ClassCastException when the style is loaded.
# width/length of the board squares, in blocks
square_size: 5
# width in blocks of the frame surrounding the board
frame_width: 3
# height of the board - number of squares of clear air between board and enclosure roof
height: 6
# material/data for the white squares
white_square: '24'
# material/data for the black squares
black_square: '49'
# material/data for the frame
frame: '5'
# material/data for the enclosure (if you don't use glass, then you better have lit = true!)
enclosure: '20'
# is the board lit up?
lit: true
# style of chess set to use (see ../piece_styles/*.yml)
# the style chosen must fit within the square_size specified above
piece_style: Standard
The configurable items are as follows:
- square_size: an integer, at least 3. This is the number of blocks on a side of one board square, e.g. 5 will give you 5x5 squares for an overall board dimension of 40x40 blocks.
- frame_width: an integer, at least 2. This is the width of the frame that surrounds the board.
- height: an integer, at least 3. This is the amount of clear air above the board, and also determines the height of the enclosure walls and ceiling.
- white_square and black_square: either integers or Bukkit material names. These are the materials for the white and black squares on the board, respectively (24/49 = sandstone/obsidian).
- frame: either an integer or Bukkit material name. This is the material used for the board frame (5 = wood).
- panel: either an integer or Bukkit material name. This is the material used for the control panel body (default if omitted is the whatever is used for the frame).
- enclosure: either an integer or Bukkit material name. This is the material used for the board enclosure (walls & roof - 20 = glass)
- lit: either true or false. If true, the board will automatically light up when it is dark (which could be all the time for an underground board) by replacing some blocks with glowstone.
- piece_style: the name of the chess set style that will be used on this board - see Chess Set Styles below.
- highlight_style: the highlighting style used on this board. May be one of None, Corners, Edges, Checkered/Chequered or Line (default if omitted is Corners)
- highlight: either an integer or Bukkit material name. This is the material used to draw highlights if highlight_style is not None. Defaults to glowstone.
- highlight_white_square and highlight_black_square: either integers or Bukkit material names. These are the materials used to highlight white squares and black squares, respectively. Default to whatever highlight is if omitted.
You can have an open chessboard by using 'air' for your enclosure. But be aware that although creatures do not spawn on the board by default, there is nothing to stop them wandering onto the board!
If you use a non-transparent material for the enclosure, then you really should set lit to true, or it will be pitch black inside!
Chess set styles are stored as files in plugins/ChessCraft/piece_styles under your Bukkit folder. Again, there is one file per set style. It is a YAML file and must have a .yml extension.
Chess set styles use the same material specifications as boards do (see Material specifications above).
Here is the default set style, Standard.yml:
# Name for this set - should match the filename
name: Standard
# List of materials used in the set
# Can be specified as plain integer (e.g. '0' - air), material name (e.g. iron_block)
# or material plus data (e.g. 35:0, wool:white)
# If you use plain integers, they must be quoted, or the set will not load!
# If you use material names, they must match the org.bukkit.Material definitions exactly
# - see http://jd.bukkit.org/apidocs/org/bukkit/Material.html
materials:
black:
O: air
X: gold_block
white:
O: air
X: iron_block
# Piece definitions
# This is a list of list of strings such that:
# - definition[0] is the lowest layer on the Y-axis
# - definition[0][0] is the northmost row on the lowest layer
# - each string runs from west to east and consists of materials defined above
#
pieces:
P: [ [ OXO, XXX, OXO ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ] ]
N: [ [ XXX, XXX, XXX ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ], [ OXO, OXO, OOO ], [ OOO, OXO, OOO ] ]
B: [ [ XXX, XXX, XXX ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ] ]
R: [ [ XXX, XXX, XXX ], [ XXX, XXX, XXX ], [ OXO, XXX, OXO ], [ XXX, XXX, XXX ], [ XOX, OOO, XOX ] ]
Q: [ [ XXX, XXX, XXX ], [ OXO, XXX, OXO ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ] ]
K: [ [ XXX, XXX, XXX ], [ OXO, XXX, OXO ], [ OXO, XXX, OXO ], [ OXO, XXX, OXO ], [ XXX, XXX, XXX ], [ XOX, OOO, XOX ] ]
The sections are as follows:
- A name section. The name should match the filename.
- A materials section. This defines the materials used for the white and black pieces, mapping a material specification to a character.
- A pieces section. This defines the actual piece shapes and is described in more detail below. There is one entry for each chess piece: P (pawn), N (knight), B (bishop), R (rook), Q (queen) and K (king). All of these must be present.
Look at the simplest definition from the list above (the pawn):
P: [ [ OXO, XXX, OXO ], [ OXO, XXX, OXO ], [ OOO, OXO, OOO ] ]
-----layer 1----- -----layer 2----- -----layer 3-----
This is a list of list of strings.
The outer elements define each layer of the piece, moving upwards from the bottom layer. So in the above example:
- There are 3 outer elements, so the piece will be 3 blocks tall.
- The first outer element is [ OXO, XXX, OXO ]. This is the bottom layer of the pawn, and itself contains 3 elements.
- These 3 elements represent a row of 3 blocks each: the first element OXO is the northmost row, the second XXX is the row to the south of that, and the third element OXO is the southmost
- Each of these rows is a string of 3 characters, which have been defined in the materials section. These define blocks, moving west to east. So OXO is air, then a gold or iron block depending on whether the piece is white or black, then air again.
In this way, a 3-dimensional piece can be built up. In this case the piece is 3x3x3. All the pieces in this set have a base size of 3x3, but their heights differ - e.g., the king and queen are 6 layers tall.
To use a set style with a board style, the largest piece in the set must be no taller than the board's height, and its base must be at least 1 square narrower than the board's square_size.