2 Defining cuboid models
mikeprimm edited this page 2013-11-26 08:14:32 -08:00

Cuboid models are the most simple custom models to define. They represent simple cases where a block consists of a full cube that has been 'sliced' or truncated on one or more of its axes. Examples among standard blocks include slabs (where their Y (vertical) axis has been clipped either above or below 0.5), snow (where Y is limited at different values for different depths), and pressure places (where all 3 axes are clipped).

Since a cuboid is still a six sided shape, textures are defined and applied in the same way as they are for simple solid blocks: the textures are simply clipped consistently with the limits for each axis. Each texture is treated as if it were applied to the full width and height of the corresponding unclipped face of the cube, so that only the portion of the texture matching the clipped range for the face is drawn.

To define a cuboid models, the 'boxblock:' line is used. The attributes for this line include:

  • id - the block ID that the model is to be used for. At least one id attribute is required, but as many as are needed can be used - allowing the same model to be used for multiple blocks. See Block ID Numbers for details on specifying block ID numbers.
  • data - this provides the specific metadata values that the model is to be applied to. The default, data=*, indicates all metadata values for each of the blocks IDs indicated by the id attributes. Otherwise, one or more data=number attributes can be used to select specific metadata values for the model.
  • xmin - this defines the minimum clipping value for the X axis of the block: when defined, the block's X dimension will start at an offset of the provided value on the X axis (versus the default value of 0.0).
  • xmax - this defines the maximum clipping value for the X axis of the block: when defined, the block's X dimension will end at an offset of the provided value on the X axis (versus the default value of 1.0).
  • ymin - this defines the minimum clipping value for the Y axis of the block: when defined, the block's Y dimension will start at an offset of the provided value on the Y axis (versus the default value of 0.0).
  • ymax - this defines the maximum clipping value for the Y axis of the block: when defined, the block's Y dimension will end at an offset of the provided value on the Y axis (versus the default value of 1.0).
  • zmin - this defines the minimum clipping value for the Z axis of the block: when defined, the block's Z dimension will start at an offset of the provided value on the Z axis (versus the default value of 0.0).
  • zmax - this defines the maximum clipping value for the Z axis of the block: when defined, the block's Z dimension will end at an offset of the provided value on the Z axis (versus the default value of 1.0).

For all the clipping values, the attributes are optional - the default values are consistent with the constraints for a full cube on the respective axis: 0.0 for minimum, 1.0 for maximum. Constraints are limited to values between 0.0 and 1.0, inclusively, and the minimum clipping value for a give axis must be less than or equal to the maximum clipping value for that axis.

Examples

The vanilla daylight sensor: a full width block limited to a height of 0.375 (6 out of 16 pixels)

 boxblock:id=151,data=*,ymax=0.375

The carpet blocks: a full width block limited to a height of 0.0625 (1 out of 16 pixels)

 boxblock:id=171,data=*,ymax=0.0625

Snow blocks: a full width block with different height limits for each metadata value

 boxblock:id=78,data=0,data=8,ymax=0.125
 boxblock:id=78,data=1,data=9,ymax=0.25
 boxblock:id=78,data=2,data=10,ymax=0.375
 boxblock:id=78,data=3,data=11,ymax=0.5
 boxblock:id=78,data=4,data=12,ymax=0.625
 boxblock:id=78,data=5,data=13,ymax=0.75
 boxblock:id=78,data=6,data=14,ymax=0.875

Pressure plates (4 different block IDs using the same shape): clipped on all three axes (between 0.0625 and 0.9275 horizontal, 0.0 and 0.0625 vertical)

 boxblock:id=72,id=70,id=147,id=148,data=*,xmin=0.0625,xmax=0.9275,ymax=0.0625,zmin=0.0625,zmax=0.9275

Button blocks (different block IDs, with different meta values for placement orientation): clipped on all three axes

 boxblock:id=77,id=143,data=1,data=9,xmax=0.125,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
 boxblock:id=77,id=143,data=2,data=10,xmin=0.875,ymin=0.375,ymax=0.625,zmin=0.3125,zmax=0.6875
 boxblock:id=77,id=143,data=3,data=11,zmax=0.125,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875
 boxblock:id=77,id=143,data=4,data=12,zmin=0.875,ymin=0.375,ymax=0.625,xmin=0.3125,xmax=0.6875