CavEX/source/block/block_cactus.c
2022-12-04 19:38:37 +01:00

59 lines
1.5 KiB
C

#include "blocks.h"
static enum block_material getMaterial(struct block_info* this) {
return MATERIAL_ORGANIC;
}
static bool getBoundingBox(struct block_info* this, bool entity,
struct AABB* x) {
aabb_setsize(x, 0.875F, 1.0F, 0.875F);
return true;
}
static struct face_occlusion side_top_bottom = {
.mask = {0x00007FFE, 0x7FFE7FFE, 0x7FFE7FFE, 0x7FFE7FFE, 0x7FFE7FFE,
0x7FFE7FFE, 0x7FFE7FFE, 0x7FFE0000},
};
static struct face_occlusion*
getSideMask(struct block_info* this, enum side side, struct block_info* it) {
switch(side) {
case SIDE_TOP:
case SIDE_BOTTOM: return &side_top_bottom;
default: return face_occlusion_empty();
}
}
static enum block_render_type getRenderType(struct block_info* this) {
return RENDERTYPE_FULL;
}
static uint8_t getTextureIndex(struct block_info* this, enum side side) {
switch(side) {
case SIDE_TOP: return TEXTURE_INDEX(5, 4);
case SIDE_BOTTOM: return TEXTURE_INDEX(7, 4);
default: return TEXTURE_INDEX(6, 4);
}
}
static uint32_t getBaseColor(struct block_info* this, enum side side) {
return 0xFFFFFF;
}
struct block block_cactus = {
.name = "Cactus",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_cactus,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = true,
.ignore_lighting = false,
.flammable = false,
};