feat: blockstates

actually this time but might need to make a couple of fixes
This commit is contained in:
Fireblade
2026-05-04 21:26:13 -04:00
parent 0ee913e6e2
commit b750c4bbf4
28 changed files with 564 additions and 12 deletions
+27
View File
@@ -12,6 +12,33 @@ ComparatorTile::ComparatorTile(int id, bool on) : DiodeTile(id, on)
_isEntityTile = true;
}
void ComparatorTile::createBlockStateDefinition()
{
if (!m_blockStateDefinition)
m_blockStateDefinition = new BlockStateDefinition(this);
}
int ComparatorTile::defaultBlockState()
{
return 0;
}
int ComparatorTile::convertBlockStateToLegacyData(BlockState *state)
{
if (!state) return 0;
return state->value & (DirectionalTile::DIRECTION_MASK | BIT_OUTPUT_SUBTRACT | BIT_IS_LIT);
}
Tile::BlockState ComparatorTile::getBlockState(int data)
{
return Tile::BlockState(data & (DirectionalTile::DIRECTION_MASK | BIT_OUTPUT_SUBTRACT | BIT_IS_LIT));
}
Tile::BlockState ComparatorTile::getBlockState(LevelSource *level, int x, int y, int z)
{
return Tile::BlockState(level->getData(x, y, z) & (DirectionalTile::DIRECTION_MASK | BIT_OUTPUT_SUBTRACT | BIT_IS_LIT));
}
int ComparatorTile::getResource(int data, Random *random, int playerBonusLevel)
{
return Item::comparator_Id;