Fix Block type exception on unsynced Specialize<T>()

This commit is contained in:
NGnius (Graham) 2020-06-02 20:38:35 -04:00
parent 5660bfc28d
commit 6a137472c1

View file

@ -104,11 +104,21 @@ namespace GamecraftModdingAPI.Blocks
public bool BlockExists(EGID id) public bool BlockExists(EGID id)
{ {
if (!Synced)
{
Sync();
Synced = true;
}
return entitiesDB.Exists<DBEntityStruct>(id); return entitiesDB.Exists<DBEntityStruct>(id);
} }
public bool GetBlockInfoExists<T>(EGID blockID) where T : struct, IEntityComponent public bool GetBlockInfoExists<T>(EGID blockID) where T : struct, IEntityComponent
{ {
if (!Synced)
{
Sync();
Synced = true;
}
return entitiesDB.Exists<T>(blockID); return entitiesDB.Exists<T>(blockID);
} }