mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 04:03:37 +00:00
43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
#include "SmoothStoneBrickTile.h"
|
|
|
|
#include "minecraft/world/IconRegister.h"
|
|
#include "minecraft/world/level/material/Material.h"
|
|
#include "minecraft/world/level/tile/Tile.h"
|
|
#include "strings.h"
|
|
|
|
class Icon;
|
|
|
|
const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = {
|
|
"", "mossy", "cracked", "carved"};
|
|
|
|
const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES
|
|
[SMOOTH_STONE_BRICK_NAMES_LENGTH] = {IDS_TILE_STONE_BRICK_SMOOTH,
|
|
IDS_TILE_STONE_BRICK_SMOOTH_MOSSY,
|
|
IDS_TILE_STONE_BRICK_SMOOTH_CRACKED,
|
|
IDS_TILE_STONE_BRICK_SMOOTH_CHISELED};
|
|
|
|
SmoothStoneBrickTile::SmoothStoneBrickTile(int id) : Tile(id, Material::stone) {
|
|
icons = nullptr;
|
|
}
|
|
|
|
Icon* SmoothStoneBrickTile::getTexture(int face, int data) {
|
|
if (data < 0 || data >= SMOOTH_STONE_BRICK_NAMES_LENGTH) data = 0;
|
|
return icons[data];
|
|
}
|
|
|
|
int SmoothStoneBrickTile::getSpawnResourcesAuxValue(int data) { return data; }
|
|
|
|
unsigned int SmoothStoneBrickTile::getDescriptionId(int iData /*= -1*/) {
|
|
if (iData < 0) iData = 0;
|
|
return SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES[iData];
|
|
}
|
|
|
|
void SmoothStoneBrickTile::registerIcons(IconRegister* iconRegister) {
|
|
icons = new Icon*[SMOOTH_STONE_BRICK_NAMES_LENGTH];
|
|
|
|
for (int i = 0; i < SMOOTH_STONE_BRICK_NAMES_LENGTH; i++) {
|
|
std::string name = getIconName();
|
|
if (!TEXTURE_NAMES[i].empty()) name += "_" + TEXTURE_NAMES[i];
|
|
icons[i] = iconRegister->registerIcon(name);
|
|
}
|
|
} |