diff --git a/blockidentifier.cpp b/blockidentifier.cpp index 36cb60b6..6b13eb51 100644 --- a/blockidentifier.cpp +++ b/blockidentifier.cpp @@ -9,7 +9,7 @@ static BlockInfo unknownBlock; BlockInfo::BlockInfo() : transparent(false), liquid(false), rendernormal(true), - providepower(false), spawninside(false) {} + providepower(false), spawninside(false), grass(false), foliage(false) {} bool BlockInfo::isOpaque() { return !(this->transparent); @@ -51,10 +51,8 @@ void BlockInfo::setName(const QString & newname) { halfslab = this->name.contains("Slab") && !this->name.contains("Double") && !this->name.contains("Full"); snow = this->name.contains("Snow"); - // precompute biome based colors + // precompute biome based watercolormodifier water = this->name.contains("Water"); - grass = this->name.compare("Grass", Qt::CaseInsensitive) == 0; - foliage = false; } const QString & BlockInfo::getName() { return name; } @@ -70,6 +68,8 @@ bool BlockInfo::biomeWater() { return water; } bool BlockInfo::biomeGrass() { return grass; } bool BlockInfo::biomeFoliage() { return foliage; } +void BlockInfo::setBiomeGrass(bool value) { grass = value; } +void BlockInfo::setBiomeFoliage(bool value) { foliage = value; } BlockIdentifier::BlockIdentifier() { // clear cache pointers @@ -257,6 +257,13 @@ void BlockIdentifier::parseDefinition(JSONObject *b, BlockInfo *parent, 255*block->alpha ); } + // biome dependant color + if (b->has("biomeGrass")) + block->setBiomeGrass( b->at("biomeGrass")->asBool() ); + if (b->has("biomeFoliage")) + block->setBiomeFoliage( b->at("biomeFoliage")->asBool() ); + + // variant reduction mask if (b->has("mask")) block->mask = b->at("mask")->asNumber(); else if (b->has("variants")) diff --git a/blockidentifier.h b/blockidentifier.h index ebf6b037..3ac9ac55 100644 --- a/blockidentifier.h +++ b/blockidentifier.h @@ -11,17 +11,12 @@ class JSONArray; class JSONObject; -// bit masks for the flags -#define BlockTransparent 1 -#define BlockSolid 2 -#define BlockLiquid 4 - -// mobs can't spawn on transparent, but need 2 blocks of transparent, -// non solid, non liquid above class BlockInfo { public: BlockInfo(); + + // special block attribute used during mob spawning detection bool isOpaque(); bool isLiquid(); bool doesBlockHaveSolidTopSurface(int data); @@ -29,7 +24,7 @@ class BlockInfo { bool renderAsNormalBlock(); bool canProvidePower(); - // special blocks used during mob spawning detection + // special block type used during mob spawning detection bool isBedrock(); bool isHopper(); bool isStairs(); @@ -42,6 +37,8 @@ class BlockInfo { bool biomeFoliage(); void setName(const QString &newname); + void setBiomeGrass(bool value); + void setBiomeFoliage(bool value); const QString &getName(); int id; diff --git a/definitions/readme.txt b/definitions/readme.txt index 17a30548..25131329 100755 --- a/definitions/readme.txt +++ b/definitions/readme.txt @@ -57,9 +57,30 @@ deobfuscated 1.8.x code is not available. -Other special attribute value pairs in this file: +Other attribute value pairs in this file: -"mask": number +"id": integer_number + +Numerical code used in the savegame for this block + + +"name": "Name of Block" + +String representation of this Block, shown in status bar when hovering mouse over + + +"color": "#ffffff" + +Color usedd for rendering this block + + +"alpha": float_number + +In case the block is transparent (e.g. water) this defines the amount it coveres +the block below. 0.0 is completely transparent. 1.0 is the default, a opaque block. + + +"mask": integer_number In case a block has variants a mask can be given to blend out bits in the data field that are not used to define the block itself. These bits are mostely used @@ -68,5 +89,16 @@ to define block orientation. if a block has some variants defined, "mask": 15 is predefined +"biomeGrass": boolean + +When color of block is changing based on Biome and is based on the Grass Colorizer, +this flag has to be set true. Defaults to false. + + +"biomeFoliage": boolean + +When color of block is changing based on Biome and is based on the Foliage Colorizer, +this flag has to be set true. Defaults to false. + [EtlamGit] \ No newline at end of file diff --git a/definitions/vanilla_ids.json b/definitions/vanilla_ids.json index b7fd11e3..0f5e5d98 100755 --- a/definitions/vanilla_ids.json +++ b/definitions/vanilla_ids.json @@ -1,7 +1,7 @@ { "name": "Vanilla", "type": "block", - "version": "1.11.16w39a", + "version": "1.11.16w40a", "data": [ { "id": 0, @@ -51,7 +51,8 @@ { "id": 2, "name": "Grass", - "color": "#78bf64" + "color": "#939393", + "biomeGrass": true }, { "id": 3, @@ -358,12 +359,14 @@ { "data": 1, "name": "Tall Grass", - "color": "#83bf54" + "color": "#909090", + "biomeGrass": true }, { "data": 2, "name": "Fern", - "color": "#8fbb64" + "color": "#828282", + "biomeGrass": true } ] }, @@ -942,9 +945,10 @@ { "id": 83, "name": "Sugar Cane", - "color": "#aadb74", + "color": "#97c06b", "spawninside": true, - "transparent": true + "transparent": true, + "biomeGrass": true }, { "id": 84, @@ -2200,12 +2204,14 @@ { "data": 2, "name": "Double Tallgrass", - "color": "#5e8328" + "color": "#969696", + "biomeGrass": true }, { "data": 3, "name": "Large Fern", - "color": "#617b2d" + "color": "#828282", + "biomeGrass": true }, { "data": 4,