diff --git a/blockidentifier.cpp b/blockidentifier.cpp index 359dacdf..36cb60b6 100644 --- a/blockidentifier.cpp +++ b/blockidentifier.cpp @@ -42,13 +42,19 @@ bool BlockInfo::canProvidePower() { } void BlockInfo::setName(const QString & newname) { + // set name name = newname; + // precompute mob spawning conditions bedrock = this->name.contains("Bedrock"); hopper = this->name.contains("Hopper"); stairs = this->name.contains("Stairs"); halfslab = this->name.contains("Slab") && !this->name.contains("Double") && !this->name.contains("Full"); snow = this->name.contains("Snow"); + // precompute biome based colors + water = this->name.contains("Water"); + grass = this->name.compare("Grass", Qt::CaseInsensitive) == 0; + foliage = false; } const QString & BlockInfo::getName() { return name; } @@ -60,6 +66,9 @@ bool BlockInfo::isStairs() { return stairs; } bool BlockInfo::isHalfSlab() { return halfslab; } bool BlockInfo::isSnow() { return snow; } +bool BlockInfo::biomeWater() { return water; } +bool BlockInfo::biomeGrass() { return grass; } +bool BlockInfo::biomeFoliage() { return foliage; } BlockIdentifier::BlockIdentifier() { diff --git a/blockidentifier.h b/blockidentifier.h index bf87338f..ebf6b037 100644 --- a/blockidentifier.h +++ b/blockidentifier.h @@ -36,6 +36,11 @@ class BlockInfo { bool isHalfSlab(); bool isSnow(); + // special blocks with Biome based Grass, Foliage and Water colors + bool biomeWater(); + bool biomeGrass(); + bool biomeFoliage(); + void setName(const QString &newname); const QString &getName(); @@ -58,6 +63,9 @@ class BlockInfo { bool stairs; bool halfslab; bool snow; + bool water; + bool grass; + bool foliage; }; class BlockIdentifier {