fix: misc crashes

This commit is contained in:
Fireblade 2026-05-25 21:29:59 -04:00
parent e2b81cae79
commit 3409dfb821
3 changed files with 15 additions and 4 deletions

View file

@ -205,8 +205,19 @@ public:
wstring getString(const wstring &name)
{
if (tags.find(name) == tags.end()) return wstring( L"" );
return static_cast<StringTag *>(tags[name])->data;
auto it = tags.find(name);
if (it == tags.end())
return L"";
Tag* tag = it->second;
if (!tag || tag->getId() != Tag::TAG_STRING)
return L"";
StringTag* stringTag = static_cast<StringTag*>(tag);
return stringTag->data;
}
byteArray getByteArray(const wstring &name)

View file

@ -383,12 +383,13 @@ bool RedStoneDustTile::shouldConnectTo(LevelSource *level, int x, int y, int z,
int t = level->getTile(x, y, z);
if (t == Tile::redstone_wire_Id) return true;
if (t == 0) return false;
Tile *tile = Tile::tiles[t];
if (Tile::unpowered_repeater->isSameDiode(t))
{
int data = level->getData(x, y, z);
return direction == (data & DiodeTile::DIRECTION_MASK) || direction == Direction::DIRECTION_OPPOSITE[data & DiodeTile::DIRECTION_MASK];
}
else if (Tile::tiles[t]->isSignalSource() && direction != Direction::UNDEFINED) return true;
else if (tile != nullptr && tile->isSignalSource() && direction != Direction::UNDEFINED) return true;
return false;
}

View file

@ -48,7 +48,6 @@ void SlimeTile::fallOn(Level *level, int x, int y, int z,
entity->clearFallDamageQueue();
entity->fallDistance = 0.0f;
entity->onGround = false;
if (entity->isSneaking())
return;