mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 05:33:40 +00:00
31 lines
868 B
C++
31 lines
868 B
C++
#include "RailTile.h"
|
|
|
|
#include <string>
|
|
|
|
#include "minecraft/world/IconRegister.h"
|
|
#include "minecraft/world/level/tile/BaseRailTile.h"
|
|
#include "minecraft/world/level/tile/Tile.h"
|
|
|
|
RailTile::RailTile(int id) : BaseRailTile(id, false) {}
|
|
|
|
Icon* RailTile::getTexture(int face, int data) {
|
|
if (data >= 6) {
|
|
return iconTurn;
|
|
} else {
|
|
return icon;
|
|
}
|
|
}
|
|
|
|
void RailTile::registerIcons(IconRegister* iconRegister) {
|
|
BaseRailTile::registerIcons(iconRegister);
|
|
iconTurn = iconRegister->registerIcon(getIconName() + "_turned");
|
|
}
|
|
|
|
void RailTile::updateState(Level* level, int x, int y, int z, int data, int dir,
|
|
int type) {
|
|
if (type > 0 && Tile::tiles[type]->isSignalSource()) {
|
|
if (Rail(level, x, y, z).countPotentialConnections() == 3) {
|
|
updateDir(level, x, y, z, false);
|
|
}
|
|
}
|
|
} |