4jcraft/Minecraft.World/Blocks/SandStoneTile.cpp
MatthewBeshay dfb0e3b03e refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
2026-03-30 16:25:52 +11:00

45 lines
1.5 KiB
C++

#include "../Platform/stdafx.h"
#include "../Headers/net.minecraft.h"
#include "../Headers/net.minecraft.world.level.material.h"
#include "../Headers/net.minecraft.world.h"
#include "SandStoneTile.h"
const std::wstring SandStoneTile::TEXTURE_TOP = L"sandstone_top";
const std::wstring SandStoneTile::TEXTURE_BOTTOM = L"sandstone_bottom";
const std::wstring SandStoneTile::TEXTURE_NAMES[] = {
L"sandstone_side", L"sandstone_carved", L"sandstone_smooth"};
int SandStoneTile::SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES] = {
IDS_TILE_SANDSTONE, IDS_TILE_SANDSTONE_CHISELED, IDS_TILE_SANDSTONE_SMOOTH};
SandStoneTile::SandStoneTile(int id) : Tile(id, Material::stone) {
icons = nullptr;
iconTop = nullptr;
iconBottom = nullptr;
}
Icon* SandStoneTile::getTexture(int face, int data) {
if (face == Facing::UP ||
(face == Facing::DOWN &&
(data == TYPE_HEIROGLYPHS || data == TYPE_SMOOTHSIDE))) {
return iconTop;
}
if (face == Facing::DOWN) {
return iconBottom;
}
if (data < 0 || data >= SANDSTONE_TILE_TEXTURE_COUNT) data = 0;
return icons[data];
}
int SandStoneTile::getSpawnResourcesAuxValue(int data) { return data; }
void SandStoneTile::registerIcons(IconRegister* iconRegister) {
icons = new Icon*[SANDSTONE_TILE_TEXTURE_COUNT];
for (int i = 0; i < SANDSTONE_TILE_TEXTURE_COUNT; i++) {
icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
}
iconTop = iconRegister->registerIcon(TEXTURE_TOP);
iconBottom = iconRegister->registerIcon(TEXTURE_BOTTOM);
}