Skip to content

Commit 8c4eaf3

Browse files
committed
added new blocks from 1.6, 1.7 and 1.8
1 parent ab9482c commit 8c4eaf3

7 files changed

+73
-39
lines changed

colors.cpp

+24-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ uint8_t colors[256][8];
3535

3636
void loadColors()
3737
{
38-
// Colors are mostly the same as in Cartograph
3938
memset(colors, 0, sizeof colors);
4039
SETCOLOR(AIR, 255,255,255,0);
4140
SETCOLORNOISE(STONE, 128,128,128,255, 16);
42-
SETCOLORNOISE(GRASS, 100,150,60,255, 14);
41+
SETCOLORNOISE(GRASS, 102,142,62,255, 14);
4342
SETCOLORNOISE(DIRT, 134,96,67,255, 22);
4443
SETCOLORNOISE(COBBLESTONE, 115,115,115,255, 24);
4544
SETCOLORNOISE(WOOD, 157,128,79,255, 11);
@@ -65,6 +64,12 @@ void loadColors()
6564
SETCOLOR(BED, 175,116,116, 254); // Not fully opaque to prevent culling on this one
6665
SETCOLOR(POW_RAILROAD, 160,134,72,250);
6766
SETCOLOR(DET_RAILROAD, 120,114,92,250);
67+
SETCOLOR(29, 106,102,95,255);
68+
SETCOLOR(COBWEB, 220,220,220,190);
69+
SETCOLORNOISE(TALL_GRASS, 110,166,68,254, 12);
70+
SETCOLORNOISE(SHRUB, 123,79,25,254, 25);
71+
SETCOLOR(33, 106,102,95,255);
72+
SETCOLOR(34, 153,129,89,255);
6873
SETCOLOR(WOOL, 222,222,222,255); //Color(143,143,143,255);
6974
//SETCOLOR(36, 222,222,222,255);
7075
SETCOLOR(FLOWERR, 255,0,0,254); // Not fully opaque to prevent culling on this one
@@ -119,6 +124,21 @@ void loadColors()
119124
SETCOLORNOISE(CAKE, 228, 205, 206, 255, 7);
120125
SETCOLORNOISE(93, 151,147,147, 255, 2);
121126
SETCOLORNOISE(94, 161,147,147, 255, 2);
127+
SETCOLOR(95, 125,91,38,255);
128+
SETCOLORNOISE(TRAPDOOR, 126,93,45,240, 5);
129+
SETCOLORNOISE(97, 128,128,128,255, 16);
130+
SETCOLORNOISE(98, 122,122,122,255, 7);
131+
SETCOLORNOISE(99, 141,106,83,255, 0);
132+
SETCOLORNOISE(100, 182,37,36,255, 6);
133+
SETCOLORNOISE(IRON_BARS, 109,108,106,254, 6);
134+
SETCOLOR(102, 255,255,255,40);
135+
SETCOLORNOISE(103, 151,153,36,255, 10);
136+
SETCOLOR(PUMPKIN_STEM, 115,170,73,254);
137+
SETCOLOR(MELON_STEM, 115,170,73,254);
138+
SETCOLORNOISE(VINES, 51,130,36,180, 12);
139+
SETCOLOR(FENCE_GATE, 137,112,65,225);
140+
SETCOLOR(108, 170,86,62,255);
141+
SETCOLORNOISE(109, 122,122,122,255, 7);
122142
SETCOLORNOISE(SANDSTEP, 218, 210, 158, 254, 7); // Not fully opaque to prevent culling on this one
123143
SETCOLORNOISE(WOODSTEP, 157,128,79,254, 11); // Not fully opaque to prevent culling on this one
124144
SETCOLORNOISE(COBBLESTEP, 115,115,115,254, 26); // Not fully opaque to prevent culling on this one
@@ -285,10 +305,12 @@ bool loadBiomeColors(const char* path)
285305
g_GrasscolorDepth = pngGrass->getBytesPerPixel();
286306
g_FoliageDepth = pngLeaf->getBytesPerPixel();
287307
g_Grasscolor = pngGrass->getImageData();
308+
g_TallGrasscolor = new uint8_t[pngGrass->getBytesPerPixel() * 256 * 256];
288309
g_Leafcolor = pngLeaf->getImageData();
289310
// Adjust brightness to what colors.txt says
290311
const int maxG = pngGrass->getWidth() * pngGrass->getHeight() * g_GrasscolorDepth;
291312
for (int i = 0; i < maxG; ++i) {
313+
g_TallGrasscolor[i] = ((int)g_Grasscolor[i] * (int)colors[TALL_GRASS][BRIGHTNESS]) / 255;
292314
g_Grasscolor[i] = ((int)g_Grasscolor[i] * (int)colors[GRASS][BRIGHTNESS]) / 255;
293315
}
294316
const int maxT = pngLeaf->getWidth() * pngLeaf->getHeight() * g_FoliageDepth;

colors.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ bool loadBiomeColors(const char* path);
4545
#define BED 26
4646
#define POW_RAILROAD 27
4747
#define DET_RAILROAD 28
48+
#define COBWEB 30
49+
#define TALL_GRASS 31
50+
#define SHRUB 32
4851
#define WOOL 35
4952
#define FLOWERY 37
5053
#define FLOWERR 38
@@ -61,11 +64,17 @@ bool loadBiomeColors(const char* path);
6164
#define SNOW 78
6265
#define FENCE 85
6366
#define CAKE 92
67+
#define TRAPDOOR 96
68+
#define IRON_BARS 101
69+
#define PUMPKIN_STEM 104
70+
#define MELON_STEM 105
71+
#define VINES 106
72+
#define FENCE_GATE 107
73+
6474
#define SANDSTEP 233
6575
#define WOODSTEP 234
6676
#define COBBLESTEP 235
6777
#define PINELEAVES 236
6878
#define BIRCHLEAVES 237
69-
//#define VOIDBLOCK 255 // This will hopefully never be a valid block id in the near future :-)
7079

7180
#endif

draw_png.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,19 @@ void setPixel(const size_t x, const size_t y, const uint8_t color, const float f
637637
modColor(c, sub);
638638
if (g_BlendAll) {
639639
// Then check the block type, as some types will be drawn differently
640-
if (color == SNOW) {
640+
if (color == SNOW || color == TRAPDOOR) {
641641
setSnowBA(x, y, c);
642642
return;
643643
}
644644
if (color == TORCH || color == REDTORCH_ON || color == REDTORCH_OFF) {
645645
setTorchBA(x, y, c);
646646
return;
647647
}
648-
if (color == FLOWERR || color == FLOWERY || color == MUSHROOMB || color == MUSHROOMR) {
648+
if (color == FLOWERR || color == FLOWERY || color == MUSHROOMB || color == MUSHROOMR || color == MELON_STEM || color == PUMPKIN_STEM || color == SHRUB || color == COBWEB) {
649649
setFlowerBA(x, y, c);
650650
return;
651651
}
652-
if (color == FENCE) {
652+
if (color == FENCE || color == FENCE_GATE || color == VINES || color == IRON_BARS) {
653653
setFence(x, y, c);
654654
return;
655655
}
@@ -672,7 +672,7 @@ void setPixel(const size_t x, const size_t y, const uint8_t color, const float f
672672
setGrassBA(x, y, c, L, D, sub);
673673
return;
674674
}
675-
if (color == FIRE) {
675+
if (color == FIRE || color == TALL_GRASS) {
676676
setFire(x, y, c, L, D);
677677
return;
678678
}
@@ -682,19 +682,19 @@ void setPixel(const size_t x, const size_t y, const uint8_t color, const float f
682682
}
683683
} else {
684684
// Then check the block type, as some types will be drawn differently
685-
if (color == SNOW) {
685+
if (color == SNOW || color == TRAPDOOR) {
686686
setSnow(x, y, c);
687687
return;
688688
}
689689
if (color == TORCH || color == REDTORCH_ON || color == REDTORCH_OFF) {
690690
setTorch(x, y, c);
691691
return;
692692
}
693-
if (color == FLOWERR || color == FLOWERY || color == MUSHROOMB || color == MUSHROOMR) {
693+
if (color == FLOWERR || color == FLOWERY || color == MUSHROOMB || color == MUSHROOMR || color == MELON_STEM || color == PUMPKIN_STEM || color == SHRUB || color == COBWEB) {
694694
setFlower(x, y, c);
695695
return;
696696
}
697-
if (color == FENCE) {
697+
if (color == FENCE || color == FENCE_GATE || color == VINES || color == IRON_BARS) {
698698
setFence(x, y, c);
699699
return;
700700
}
@@ -717,7 +717,7 @@ void setPixel(const size_t x, const size_t y, const uint8_t color, const float f
717717
setGrass(x, y, c, L, D, sub);
718718
return;
719719
}
720-
if (color == FIRE) {
720+
if (color == FIRE || color == TALL_GRASS) {
721721
setFire(x, y, c, L, D);
722722
return;
723723
}
@@ -913,14 +913,13 @@ namespace
913913
// This basically just leaves out a few pixels
914914
// Top row
915915
uint8_t *pos = &PIXEL(x, y);
916-
for (size_t i = 0; i < 2; ++i, pos += CHANSPERPIXEL * 2) {
917-
blend(pos, color);
918-
}
916+
blend(pos, light);
917+
blend(pos + CHANSPERPIXEL*2, dark);
919918
// Second and third row
920919
for (size_t i = 1; i < 3; ++i) {
921920
pos = &PIXEL(x, y+i);
922921
blend(pos, dark);
923-
blend(pos+(CHANSPERPIXEL*i), dark);
922+
blend(pos+(CHANSPERPIXEL*i), color);
924923
blend(pos+(CHANSPERPIXEL*3), light);
925924
}
926925
// Last row

extractcolors.cpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ static const int special_sauce[256][3] = {
4545
{ 7, 8, 10 },
4646
{ 3, 11, 10 },
4747
{ 3, 12, 10 },
48-
{ -1, -1, 10 },
49-
{ -1, -1, 10 }, /* 30 */
50-
{ -1, -1, 10 },
51-
{ -1, -1, 10 },
52-
{ -1, -1, 10 },
53-
{ -1, -1, 10 },
48+
{ 12, 6, 10 },
49+
{ 11, 0, 10 }, /* 30 */
50+
{ 7, 2, 10 },
51+
{ 7, 3, 10 },
52+
{ 12, 6, 10 },
53+
{ 11, 6, 10 },
5454
{ 0, 4, 10 },
5555
{ -1, -1, 10 },
5656
{ 13, 0, 10 },
@@ -111,21 +111,21 @@ static const int special_sauce[256][3] = {
111111
{ 9, 7, 10 },
112112
{ 3, 8, 10 },
113113
{ 3, 9, 10 },
114-
{ -1, -1, 10 },
115-
{ -1, -1, 10 },
116-
{ -1, -1, 10 },
117-
{ -1, -1, 10 },
118-
{ -1, -1, 10 },
119-
{ -1, -1, 10 }, /* 100 */
120-
{ -1, -1, 10 },
121-
{ -1, -1, 10 },
122-
{ -1, -1, 10 },
123-
{ -1, -1, 10 },
124-
{ -1, -1, 10 },
125-
{ -1, -1, 10 },
126-
{ -1, -1, 10 },
127-
{ -1, -1, 10 },
128-
{ -1, -1, 10 },
114+
{ 11, 1, 10 },
115+
{ 4, 5, 10 },
116+
{ 1, 0, 10 },
117+
{ 6, 3, 10 },
118+
{ 14, 7, 10 },
119+
{ 13, 7, 10 }, /* 100 */
120+
{ 5, 5, 10 },
121+
{ 1, 3, 7 },
122+
{ 9, 8, 10 },
123+
{ 15, 6, 10 },
124+
{ 15, 7, 10 },
125+
{ 15, 8, 10 },
126+
{ 5, 1, 9 },
127+
{ 7, 0, 10 },
128+
{ 6, 3, 10 },
129129
{ -1, -1, 10 }, /* 110 */
130130
{ -1, -1, 10 },
131131
{ -1, -1, 10 },

globals.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bool g_Hell = false, g_ServerHell = false;
1818

1919
bool g_UseBiomes = false;
2020
uint64_t g_BiomeMapSize = 0;
21-
uint8_t *g_Grasscolor = NULL, *g_Leafcolor = NULL;
21+
uint8_t *g_Grasscolor = NULL, *g_Leafcolor = NULL, *g_TallGrasscolor = NULL;
2222
uint16_t *g_BiomeMap = NULL;
2323
int g_GrasscolorDepth = 0, g_FoliageDepth = 0;
2424

globals.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _GLOBALS_H_
22
#define _GLOBALS_H_
33

4-
#define VERSION "2.0g"
4+
#define VERSION "2.1"
55

66
#include <stdint.h>
77
#include <cstdlib>
@@ -43,7 +43,7 @@ extern bool g_Hell, g_ServerHell; // rendering the nether
4343
// For rendering biome colors properly, external png files are used
4444
extern bool g_UseBiomes;
4545
extern uint64_t g_BiomeMapSize;
46-
extern uint8_t *g_Grasscolor, *g_Leafcolor;
46+
extern uint8_t *g_Grasscolor, *g_Leafcolor, *g_TallGrasscolor;
4747
extern uint16_t *g_BiomeMap;
4848
extern int g_GrasscolorDepth, g_FoliageDepth;
4949

main.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ int main(int argc, char **argv)
523523
uint16_t &offset = BIOMEAT(x,z);
524524
memcpy(colors[GRASS], g_Grasscolor + offset * g_GrasscolorDepth, 3);
525525
memcpy(colors[LEAVES], g_Leafcolor + offset * g_FoliageDepth, 3);
526+
memcpy(colors[TALL_GRASS], g_TallGrasscolor + offset * g_GrasscolorDepth, 3);
527+
memcpy(colors[PUMPKIN_STEM], g_TallGrasscolor + offset * g_GrasscolorDepth, 3);
528+
memcpy(colors[MELON_STEM], g_TallGrasscolor + offset * g_GrasscolorDepth, 3);
529+
memcpy(colors[VINES], g_Grasscolor + offset * g_GrasscolorDepth, 3);
526530
// Leaves: This is just an approximation to get different leaf colors at all
527531
colors[PINELEAVES][PRED] = clamp(int32_t(colors[LEAVES][PRED]) - 17);
528532
colors[PINELEAVES][PGREEN] = clamp(int32_t(colors[LEAVES][PGREEN]) - 12);

0 commit comments

Comments
 (0)