diff --git a/source/block/block_cobweb.c b/source/block/block_cobweb.c new file mode 100644 index 0000000..22208f5 --- /dev/null +++ b/source/block/block_cobweb.c @@ -0,0 +1,47 @@ +#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 !entity; +} + +static struct face_occlusion* +getSideMask(struct block_info* this, enum side side, struct block_info* it) { + return face_occlusion_empty(); +} + +static enum block_render_type getRenderType(struct block_info* this) { + return RENDERTYPE_CROSS; +} + +static uint8_t getTextureIndex(struct block_info* this, enum side side) { + return TEXTURE_INDEX(11, 0); +} + +static uint32_t getBaseColor(struct block_info* this, enum side side) { + return 0xFFFFFF; +} + +struct block block_cobweb = { + .name = "Cobweb", + .getRenderType = getRenderType, + .getSideMask = getSideMask, + .getBoundingBox = getBoundingBox, + .getMaterial = getMaterial, + .getTextureIndex = getTextureIndex, + .transparent = false, + .getBaseColor = getBaseColor, + .renderBlock = render_block_cross, + .renderBlockAlways = NULL, + .luminance = 0, + .double_sided = true, + .can_see_through = true, + .render_block_data.cross_random_displacement = false, + .ignore_lighting = false, + .flammable = false, +}; diff --git a/source/block/blocks.c b/source/block/blocks.c index f3a052f..00cd124 100755 --- a/source/block/blocks.c +++ b/source/block/blocks.c @@ -38,7 +38,7 @@ void blocks_init() { blocks[27] = &block_powered_rail; blocks[28] = &block_detector_rail; // sticky piston - // cobweb + blocks[30] = &block_cobweb; blocks[31] = &block_tallgrass; blocks[32] = &block_deadbush; // piston diff --git a/source/block/blocks.h b/source/block/blocks.h index 69dcb1c..2019842 100755 --- a/source/block/blocks.h +++ b/source/block/blocks.h @@ -172,6 +172,7 @@ extern struct block block_noteblock; extern struct block block_sponge; extern struct block block_dispenser; extern struct block block_tnt; +extern struct block block_cobweb; extern struct block* blocks[256];