fix: tu31 tutorial world crashes

This commit is contained in:
Fireblade
2026-05-02 21:30:34 -04:00
parent 02f1be3bb7
commit 229d22ab7b
10 changed files with 58 additions and 24 deletions
+7 -4
View File
@@ -502,6 +502,9 @@ int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, shared_ptr<L
bool PistonBaseTile::isPushable(int block, Level *level, int cx, int cy, int cz, bool allowDestroyable)
{
Tile *tile = Tile::tiles[block];
if (tile == nullptr) return false; // tu31 tutorial world fix
// special case for obsidian
if (block == Tile::obsidian_Id)
{
@@ -518,17 +521,17 @@ bool PistonBaseTile::isPushable(int block, Level *level, int cx, int cy, int cz,
}
else
{
if (Tile::tiles[block]->getDestroySpeed(level, cx, cy, cz) == Tile::INDESTRUCTIBLE_DESTROY_TIME)
if (tile->getDestroySpeed(level, cx, cy, cz) == Tile::INDESTRUCTIBLE_DESTROY_TIME)
{
return false;
}
if (Tile::tiles[block]->getPistonPushReaction() == Material::PUSH_BLOCK)
if (tile->getPistonPushReaction() == Material::PUSH_BLOCK)
{
return false;
}
if (Tile::tiles[block]->getPistonPushReaction() == Material::PUSH_DESTROY)
if (tile->getPistonPushReaction() == Material::PUSH_DESTROY)
{
if(!allowDestroyable)
{
@@ -538,7 +541,7 @@ bool PistonBaseTile::isPushable(int block, Level *level, int cx, int cy, int cz,
}
}
if( Tile::tiles[block]->isEntityTile() ) // 4J - java uses instanceof EntityTile here
if( tile->isEntityTile() ) // 4J - java uses instanceof EntityTile here
{
// may not push tile entities
return false;