CavEX/source/block/block_ore.c
2022-12-03 13:15:27 +01:00

150 lines
3.7 KiB
C

#include "blocks.h"
static enum block_material getMaterial(struct block_info* this) {
return MATERIAL_STONE;
}
static bool getBoundingBox(struct block_info* this, bool entity,
struct AABB* x) {
aabb_setsize(x, 1.0F, 1.0F, 1.0F);
return true;
}
static struct face_occlusion*
getSideMask(struct block_info* this, enum side side, struct block_info* it) {
return face_occlusion_full();
}
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(this->block->type) {
case 14: // gold
return TEXTURE_INDEX(0, 2);
case 15: // iron
return TEXTURE_INDEX(1, 2);
case 16: // coal
return TEXTURE_INDEX(2, 2);
case 21: // lapis
return TEXTURE_INDEX(0, 10);
case 56: // diamond
return TEXTURE_INDEX(2, 3);
case 73: // redstone
case 74: return TEXTURE_INDEX(3, 3);
default: return TEXTURE_INDEX(1, 0);
}
}
static uint32_t getBaseColor(struct block_info* this, enum side side) {
return 0xFFFFFF;
}
struct block block_coalore = {
.name = "Coal ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};
struct block block_ironore = {
.name = "Iron ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};
struct block block_goldore = {
.name = "Gold ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};
struct block block_diamondore = {
.name = "Diamond ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};
struct block block_redstoneore = {
.name = "Redstone ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};
struct block block_lapisore = {
.name = "Lapis lazuli ore",
.getRenderType = getRenderType,
.getSideMask = getSideMask,
.getBoundingBox = getBoundingBox,
.getMaterial = getMaterial,
.getTextureIndex = getTextureIndex,
.transparent = false,
.getBaseColor = getBaseColor,
.renderBlock = render_block_full,
.renderBlockAlways = NULL,
.luminance = 0,
.double_sided = false,
.can_see_through = false,
.ignore_lighting = false,
.flammable = false,
};