diff --git a/data/images/environment/foliagecolor.png b/data/images/environment/foliagecolor.png new file mode 100644 index 0000000..81673ca Binary files /dev/null and b/data/images/environment/foliagecolor.png differ diff --git a/data/images/environment/grasscolor.png b/data/images/environment/grasscolor.png new file mode 100644 index 0000000..a6d9c20 Binary files /dev/null and b/data/images/environment/grasscolor.png differ diff --git a/data/lang/en_US.lang b/data/lang/en_US.lang index 4bb15e2..97ceaa2 100755 --- a/data/lang/en_US.lang +++ b/data/lang/en_US.lang @@ -153,6 +153,7 @@ options.group.tweaks=Tweaks options.allowSprint=Allow sprint options.barOnTop=HUD above inventory options.rpiCursor=Show Raspberry PI cursor +options.foliageTint=Tint Grass and Leaves options.autoJump=Auto Jump options.thirdperson=Third Person options.servervisible=Server Visible diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index 341bea9..1127246 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -90,6 +90,7 @@ #include "../network/command/CommandServer.h" #include "gamemode/CreatorMode.h" +#include "../world/level/GrassColor.h" static void checkGlError(const char* tag) { #ifdef GLDEBUG while (1) { @@ -1132,6 +1133,24 @@ void Minecraft::init() gameRenderer = new GameRenderer(this); particleEngine = new ParticleEngine(level, textures); + // 4j's code for reference +// FoliageColor::init(textures->loadTexturePixels(L"misc/foliagecolor.png")); + + + // my code + TextureId foliageId = (textures->loadTexture("environment/foliagecolor.png")); // loading the uh png for foliage color + int* foliagePixels = textures->loadTexturePixels(foliageId, "environment/foliagecolor.png"); + // now i can finally initialize foliage color, probably not the best way to handle this but i cant be arsed rn + FoliageColor::init(foliagePixels); + + TextureId grassId = (textures->loadTexture("environment/grasscolor.png")); // loading the uh png for foliage color + int* grassPixels = textures->loadTexturePixels(grassId, "environment/grasscolor.png"); + GrassColor::init(grassPixels); + + bool tint = options.getBooleanValue(OPTIONS_FOLIAGE_TINT); // finally, toggleable foliage color + FoliageColor::setUseTint(tint); + GrassColor::setUseTint(tint); + // Platform specific initialization here font = new Font(&options, "font/default8.png", textures); diff --git a/src/client/Options.cpp b/src/client/Options.cpp index 2cacca0..68d6bae 100755 --- a/src/client/Options.cpp +++ b/src/client/Options.cpp @@ -60,6 +60,8 @@ OptionBool useTouchscreen("useTouchscreen", true); OptionBool serverVisible("servervisible", true); +OptionBool foliageTint("foliagetint", false); + OptionInt keyForward("key.forward", Keyboard::KEY_W); OptionInt keyLeft("key.left", Keyboard::KEY_A); OptionInt keyBack("key.back", Keyboard::KEY_S); @@ -136,6 +138,8 @@ void Options::initTable() { m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen; + + m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible; m_options[OPTIONS_KEY_FORWARD] = &keyForward; @@ -160,6 +164,7 @@ void Options::initTable() { m_options[OPTIONS_BAR_ON_TOP] = &barOnTop; m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint; m_options[OPTIONS_RPI_CURSOR] = &rpiCursor; + m_options[OPTIONS_FOLIAGE_TINT] = &foliageTint; m_options[OPTIONS_AUTOJUMP] = &autoJump; m_options[OPTIONS_LAST_IP] = &lastIp; diff --git a/src/client/Options.h b/src/client/Options.h index f5a4393..96d6f3b 100755 --- a/src/client/Options.h +++ b/src/client/Options.h @@ -84,6 +84,7 @@ enum OptionId { OPTIONS_LAST_IP, OPTIONS_RPI_CURSOR, + OPTIONS_FOLIAGE_TINT, // Should be last! OPTIONS_COUNT }; diff --git a/src/client/gui/screens/OptionsScreen.cpp b/src/client/gui/screens/OptionsScreen.cpp index 11b87c1..02a7a62 100755 --- a/src/client/gui/screens/OptionsScreen.cpp +++ b/src/client/gui/screens/OptionsScreen.cpp @@ -225,7 +225,8 @@ void OptionsScreen::generateOptionScreens() { optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft) .addOptionItem(OPTIONS_BAR_ON_TOP, minecraft) - .addOptionItem(OPTIONS_RPI_CURSOR, minecraft); + .addOptionItem(OPTIONS_RPI_CURSOR, minecraft) + .addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft); } void OptionsScreen::mouseClicked(int x, int y, int buttonNum) { diff --git a/src/client/renderer/Chunk.cpp b/src/client/renderer/Chunk.cpp index 13ac27c..2d28324 100755 --- a/src/client/renderer/Chunk.cpp +++ b/src/client/renderer/Chunk.cpp @@ -7,6 +7,10 @@ #include "../../world/level/Region.h" #include "../../world/level/chunk/LevelChunk.h" #include "../../util/Mth.h" + +#include "../../world/level/biome/BiomeSource.h" + +#include "../../world/level/Level.h" //#include "../../platform/time.h" /*static*/ int Chunk::updates = 0; @@ -260,3 +264,6 @@ void Chunk::resetUpdates() updates = 0; //swRebuild.reset(); } +BiomeSource* Region::getBiomeSource() { + return level->getBiomeSource(); +} \ No newline at end of file diff --git a/src/client/renderer/LevelRenderer.cpp b/src/client/renderer/LevelRenderer.cpp index 3520732..73670cd 100755 --- a/src/client/renderer/LevelRenderer.cpp +++ b/src/client/renderer/LevelRenderer.cpp @@ -25,6 +25,8 @@ #include "../../client/player/LocalPlayer.h" +#include "../../world/level/GrassColor.h" + #ifdef GFX_SMALLER_CHUNKS /* static */ const int LevelRenderer::CHUNK_SIZE = 8; #else @@ -143,6 +145,10 @@ void LevelRenderer::setLevel( Level* level ) level->addListener(this); allChanged(); } + if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) { + mc->useAmbientOcclusion = !mc->useAmbientOcclusion; + allChanged(); + } } void LevelRenderer::allChanged() @@ -155,6 +161,11 @@ void LevelRenderer::allChanged() Tile::leaves_carried->setFancy(fancy); lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE); + bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT); + FoliageColor::setUseTint(tint); + GrassColor::setUseTint(tint); + + int dist = (512 >> 3) << (3 - lastViewDistance); if (lastViewDistance <= 2 && mc->isPowerVR()) dist = (int)((float)dist * 0.8f); diff --git a/src/client/renderer/Textures.cpp b/src/client/renderer/Textures.cpp index 9fce411..b4b1676 100755 --- a/src/client/renderer/Textures.cpp +++ b/src/client/renderer/Textures.cpp @@ -249,6 +249,37 @@ int Textures::crispBlend( int c0, int c1 ) return (a << 24) | (r << 16) | (g << 8) | b; } +// shredder here, moved the code from minecraft.cpp bcus that isnt the right place +// had to implement this because i couldn't find a similar function in the code to do this +int* Textures::loadTexturePixels(TextureId texId, const std::string& resourceName){ + + const TextureData* texture = getTemporaryTextureData(texId); // storing raw pixels + + int size = texture->w * texture->h; // gets the size of our funny lil guy + int* pixels = new int[size]; // memory leaks be galore + unsigned char* raw = texture->data; // storing raw data into our beloved variable + for (int i = 0; i < (texture->w * texture->h); i++){ + // my head hurts i hate working with this + + + // uh since each pixel stores r g b a, aka the color channels which are each one byte, we multiply them by 4 to move from one pixel to another + + int r = raw[i * 4 + 0]; // gets us the first channel aka red + int g = raw[i * 4 + 1]; // gets us the second channel green + int b = raw[i * 4 + 2]; // gets us the third channel blue + int a = raw[i * 4 + 3]; // gets us the alpha channel + + // woohoo pixels uh should have been seperated into their colors now hopefully + + // r g b a + // ugh we now got to turn it into the AA RR GGBB format aak 0xAARRGGBB + // b gets 0 - 7 (8 bits), g gets 7 - 15 (8 bits), r gets 16 - 23 (8 bits), alpha gets the last ones 24 - 31 (8 bits), + pixels[i] = (a << 24) | (r << 16) | (g << 8) | (b); // shuld combine them into one 32 bit int unless i did something dumb + } + return pixels; // your meal has been prepared john colors +} + + ///*public*/ int loadHttpTexture(std::string url, std::string backup) { // HttpTexture texture = httpTextures.get(url); // if (texture != NULL) { diff --git a/src/client/renderer/Textures.h b/src/client/renderer/Textures.h index f5e2113..f4ab36e 100755 --- a/src/client/renderer/Textures.h +++ b/src/client/renderer/Textures.h @@ -44,6 +44,8 @@ public: TextureId assignTexture(const std::string& resourceName, const TextureData& img); const TextureData* getTemporaryTextureData(TextureId id); + int* loadTexturePixels(TextureId texId, const std::string& resourceName); + void tick(bool uploadToGraphicsCard); void clear(); diff --git a/src/world/level/FoliageColor.cpp b/src/world/level/FoliageColor.cpp new file mode 100644 index 0000000..018cd1f --- /dev/null +++ b/src/world/level/FoliageColor.cpp @@ -0,0 +1,13 @@ +#include "FoliageColor.h" + +// TODO: Probably move all the stuff from the header into here so it's a bit cleaner +bool FoliageColor::useTint = true; + +int FoliageColor::get(float temp, float rain) { + rain *= temp; + int x = (int) ((1 - temp) * 255); + int y = (int) ((1 - rain) * 255); + return pixels[y << 8 | x]; +} + +int* FoliageColor::pixels = nullptr; \ No newline at end of file diff --git a/src/world/level/FoliageColor.h b/src/world/level/FoliageColor.h index 6d7d024..98d77b7 100755 --- a/src/world/level/FoliageColor.h +++ b/src/world/level/FoliageColor.h @@ -6,31 +6,49 @@ class FoliageColor { public: -// static void init(int[] pixels) { -// FoliageColor::pixels = pixels; -// } -// -// static int get(float temp, float rain) { -// rain *= temp; -// int x = (int) ((1 - temp) * 255); -// int y = (int) ((1 - rain) * 255); -// return pixels[y << 8 | x]; -// } + static bool useTint; - static int getEvergreenColor() { - return 0x619961; - } + static void setUseTint(bool value) { + useTint = value; + } + /* + Shredder here, Ive converted the unused commented out code into their correct syntax, though if i did something incorrectly feel free to take reference from the + commented out code + */ - static int getBirchColor() { - return 0x80a755; - } + // static void init(int[] pixels) { + // FoliageColor::pixels = pixels; + // } + // + // static int get(float temp, float rain) { + // rain *= temp; + // int x = (int) ((1 - temp) * 255); + // int y = (int) ((1 - rain) * 255); + // return pixels[y << 8 | x]; + // } - static int getDefaultColor() { - return 0x48b518; - } + + static void init(int* p) { + pixels = p; + } + + static int get(float temp, float rain); + + static int getEvergreenColor() { + return 0x619961; + } + + static int getBirchColor() { + return 0x80a755; + } + + static int getDefaultColor() { + return 0xFFFFFF; + } private: - //static int pixels[256*256]; + // static int pixels[256*256]; + static int* pixels; }; #endif /*NET_MINECRAFT_WORLD_LEVEL__FoliageColor_H__*/ diff --git a/src/world/level/GrassColor.cpp b/src/world/level/GrassColor.cpp new file mode 100644 index 0000000..eb05bd4 --- /dev/null +++ b/src/world/level/GrassColor.cpp @@ -0,0 +1,13 @@ +#include "GrassColor.h" + +// TODO: Probably move all the stuff from the header into here so it's a bit cleaner +bool GrassColor::useTint = true; + +int GrassColor::get(float temp, float rain) { + rain *= temp; + int x = (int) ((1 - temp) * 255); + int y = (int) ((1 - rain) * 255); + return pixels[y << 8 | x]; +} + +int* GrassColor::pixels = nullptr; \ No newline at end of file diff --git a/src/world/level/GrassColor.h b/src/world/level/GrassColor.h new file mode 100644 index 0000000..08903c7 --- /dev/null +++ b/src/world/level/GrassColor.h @@ -0,0 +1,42 @@ +#ifndef NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__ +#define NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__ + +//package net.minecraft.world.level; + +class GrassColor +{ +public: + static bool useTint; + + static void setUseTint(bool value) { + useTint = value; + } +/* +Shredder here, Ive converted the unused commented out code into their correct syntax, though if i did something incorrectly feel free to take reference from the +commented out code +*/ + +// static void init(int[] pixels) { +// GrassColor::pixels = pixels; +// } +// +// static int get(float temp, float rain) { +// rain *= temp; +// int x = (int) ((1 - temp) * 255); +// int y = (int) ((1 - rain) * 255); +// return pixels[y << 8 | x]; +// } + + + static void init(int* p) { + pixels = p; + } + + static int get(float temp, float rain); + +private: + // static int pixels[256*256]; + static int* pixels; +}; + +#endif /*NET_MINECRAFT_WORLD_LEVEL__GrassColor_H__*/ diff --git a/src/world/level/LevelSource.h b/src/world/level/LevelSource.h index 5dc5896..a130ec1 100755 --- a/src/world/level/LevelSource.h +++ b/src/world/level/LevelSource.h @@ -3,8 +3,9 @@ //package net.minecraft.world.level; -/* + class BiomeSource; +/* class TileEntity; */ class Material; @@ -29,7 +30,7 @@ public: virtual bool isSolidRenderTile(int x, int i, int z) = 0; virtual bool isSolidBlockingTile(int x, int i, int z) = 0; - //virtual BiomeSource* getBiomeSource() = 0; + virtual BiomeSource* getBiomeSource() = 0; virtual Biome* getBiome(int x, int z) = 0; }; diff --git a/src/world/level/Region.h b/src/world/level/Region.h index b4c3e58..d699099 100755 --- a/src/world/level/Region.h +++ b/src/world/level/Region.h @@ -5,6 +5,7 @@ #include "LevelSource.h" + class Level; class Material; class LevelChunk; @@ -27,6 +28,7 @@ public: int getData(int x, int y, int z); const Material* getMaterial(int x, int y, int z); Biome* getBiome(int x, int z); + BiomeSource* getBiomeSource() override; private: int xc1, zc1; LevelChunk*** chunks; diff --git a/src/world/level/biome/Biome.cpp b/src/world/level/biome/Biome.cpp index 7ccbdfe..609ed52 100755 --- a/src/world/level/biome/Biome.cpp +++ b/src/world/level/biome/Biome.cpp @@ -149,13 +149,7 @@ Feature* Biome::getGrassFeature( Random* random ) { return new TallgrassFeature(Tile::tallgrass->id, TallGrass::TALL_GRASS); } -Feature* Biome::getBasicTreeFeature( Random* random ) -{ - if (random->nextInt(10) == 0) { - return new BasicTree(false); - } - -} + Biome* Biome::getBiome( float temperature, float downfall ) diff --git a/src/world/level/biome/Biome.h b/src/world/level/biome/Biome.h index 23fd495..48a49d5 100755 --- a/src/world/level/biome/Biome.h +++ b/src/world/level/biome/Biome.h @@ -71,7 +71,6 @@ public: virtual Feature* getTreeFeature(Random* random); virtual Feature* getGrassFeature(Random* random); - virtual Feature* getBasicTreeFeature(Random* random); static Biome* getBiome(float temperature, float downfall); static Biome* _getBiome(float temperature, float downfall); diff --git a/src/world/level/biome/BiomeSource.cpp b/src/world/level/biome/BiomeSource.cpp index ab7c3a4..395b5a9 100755 --- a/src/world/level/biome/BiomeSource.cpp +++ b/src/world/level/biome/BiomeSource.cpp @@ -69,11 +69,11 @@ Biome* BiomeSource::getBiome( int x, int z ) return getBiomeBlock(x, z, 1, 1)[0]; } -//float BiomeSource::getTemperature( int x, int z ) -//{ -// temperatures = temperatureMap->getRegion(temperatures, x, z, 1, 1, tempScale, tempScale, 0.5f); -// return temperatures[0]; -//} +float BiomeSource::getTemperature( int x, int z ) +{ + temperatures = temperatureMap->getRegion(temperatures, x, z, 1, 1, tempScale, tempScale, 0.5f); + return temperatures[0]; +} Biome** BiomeSource::getBiomeBlock( int x, int z, int w, int h ) { @@ -123,7 +123,7 @@ Biome** BiomeSource::getBiomeBlock( Biome** biomes__, int x, int z, int w, int h return biomes; } -float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z, int w, int h ) +float* BiomeSource::getTemperatureBlock( float* temperatures__, int x, int z, int w, int h ) { //LOGI("gTempBlock: 1\n"); //const int size = w * h; @@ -164,8 +164,8 @@ float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z return temperatures; } -//float* BiomeSource::getDownfallBlock( /*float* downfalls__,*/ int x, int z, int w, int h ) -//{ +float* BiomeSource::getDownfallBlock( float* downfalls__, int x, int z, int w, int h ) +{ // //const int size = w * h; // //if (lenDownfalls < size) { // // delete[] downfalls; @@ -173,6 +173,6 @@ float* BiomeSource::getTemperatureBlock( /*float* temperatures__, */int x, int z // // lenDownfalls = size; // //} // -// downfalls = downfallMap->getRegion(downfalls, x, z, w, w, downfallScale, downfallScale, 0.5f); -// return downfalls; -//} + downfalls = downfallMap->getRegion(downfalls, x, z, w, w, downfallScale, downfallScale, 0.5f); + return downfalls; +} diff --git a/src/world/level/biome/BiomeSource.h b/src/world/level/biome/BiomeSource.h index fb540c1..25a3e5f 100755 --- a/src/world/level/biome/BiomeSource.h +++ b/src/world/level/biome/BiomeSource.h @@ -31,13 +31,13 @@ public: virtual Biome* getBiome(const ChunkPos& chunk); virtual Biome* getBiome(int x, int z); - //virtual float getTemperature(int x, int z); + virtual float getTemperature(int x, int z); // Note: The arrays returned here are temporary in the meaning that their // contents might change in the future. If you need to SAVE the // values, do a shallow copy to an array of your own. - virtual float* getTemperatureBlock(/*float* temperatures, */ int x, int z, int w, int h); - //virtual float* getDownfallBlock(/*float* downfalls, */int x, int z, int w, int h); + virtual float* getTemperatureBlock(float* temperatures, int x, int z, int w, int h); + virtual float* getDownfallBlock(float* downfalls, int x, int z, int w, int h); virtual Biome** getBiomeBlock(int x, int z, int w, int h); private: diff --git a/src/world/level/levelgen/CanyonFeature.cpp b/src/world/level/levelgen/CanyonFeature.cpp index f7d9ca3..095cd30 100755 --- a/src/world/level/levelgen/CanyonFeature.cpp +++ b/src/world/level/levelgen/CanyonFeature.cpp @@ -1,4 +1,4 @@ -#if 0 + #include "CanyonFeature.h" @@ -138,7 +138,7 @@ void CanyonFeature::addTunnel( int xOffs, int zOffs, unsigned char* blocks, floa } } -void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, char* blocks ) +void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks) { if (random.nextInt(15) != 0) return; @@ -151,6 +151,7 @@ void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, float thickness = (random.nextFloat() * 2 + random.nextFloat()) + 1; addTunnel(xOffs, zOffs, blocks, xCave, yCave, zCave, thickness, yRot, xRot, 0, 0, 5.0); + } /* //private @@ -165,4 +166,4 @@ void CanyonFeature::addFeature( Level level, int x, int z, int xOffs, int zOffs, for (int z = zOffs - r; z <= zOffs + r; z++) { random.setSeed((x * xScale + z * zScale) ^ level.seed);*/ -#endif + diff --git a/src/world/level/levelgen/CanyonFeature.h b/src/world/level/levelgen/CanyonFeature.h index bd60c71..a187681 100755 --- a/src/world/level/levelgen/CanyonFeature.h +++ b/src/world/level/levelgen/CanyonFeature.h @@ -1,7 +1,7 @@ #ifndef NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__ #define NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__ -#if 0 + //package net.minecraft.world.level.levelgen; @@ -12,8 +12,8 @@ class CanyonFeature: public LargeFeature { /*protected*/ void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale); /*protected*/ - void addFeature(Level level, int x, int z, int xOffs, int zOffs, char* blocks); + void addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks); }; -#endif + #endif /*NET_MINECRAFT_WORLD_LEVEL_LEVELGEN__CanyonFeature_H__*/ diff --git a/src/world/level/levelgen/RandomLevelSource.cpp b/src/world/level/levelgen/RandomLevelSource.cpp index 56f5b8b..99f8ce7 100755 --- a/src/world/level/levelgen/RandomLevelSource.cpp +++ b/src/world/level/levelgen/RandomLevelSource.cpp @@ -473,7 +473,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, &random); //LOGI("Reading temp: 1\n"); - float* temperatures = level->getBiomeSource()->getTemperatureBlock(/*NULL,*/ xo + 8, zo + 8, 16, 16); + float* temperatures = level->getBiomeSource()->getTemperatureBlock(NULL, xo + 8, zo + 8, 16, 16); for (int x = xo + 8; x < xo + 8 + 16; x++) for (int z = zo + 8; z < zo + 8 + 16; z++) { int xp = x - (xo + 8); diff --git a/src/world/level/tile/GrassTile.cpp b/src/world/level/tile/GrassTile.cpp index 7a293ea..1828966 100755 --- a/src/world/level/tile/GrassTile.cpp +++ b/src/world/level/tile/GrassTile.cpp @@ -1,6 +1,11 @@ #include "GrassTile.h" #include "../material/Material.h" #include "../../entity/item/ItemEntity.h" +#include "../GrassColor.h" +#include "../Level.h" +#include "../LevelSource.h" +#include "../biome/BiomeSource.h" +#include "../../../client/Minecraft.h" GrassTile::GrassTile(int id) : super(id, Material::dirt) @@ -24,11 +29,18 @@ int GrassTile::getTexture( int face, int data ) { } int GrassTile::getColor( LevelSource* level, int x, int y, int z ) { - //level.getBiomeSource().getBiomeBlock(x, z, 1, 1); - //float temp = level.getBiomeSource().temperatures[0]; - //float rain = level.getBiomeSource().downfalls[0]; - return 0x339933;//GrassColor.get(temp, rain); + if(!GrassColor::useTint){ + return 0x339933; + } + + level->getBiomeSource()->getBiomeBlock(x, z, 1, 1); + float temp = level->getBiomeSource()->temperatures[0]; + float rain = level->getBiomeSource()->downfalls[0]; + +// return 0x339933;//GrassColor.get(temp, rain); // we need to hook this up with OPTION_FOLIAGE_TINT + + return GrassColor::get(temp, rain); } void GrassTile::tick( Level* level, int x, int y, int z, Random* random ) { diff --git a/src/world/level/tile/GrassTile.h b/src/world/level/tile/GrassTile.h index bc62825..c97db84 100755 --- a/src/world/level/tile/GrassTile.h +++ b/src/world/level/tile/GrassTile.h @@ -14,6 +14,7 @@ class GrassTile: public Tile { typedef Tile super; public: + static const int MIN_BRIGHTNESS = 4; GrassTile(int id); diff --git a/src/world/level/tile/LeafTile.h b/src/world/level/tile/LeafTile.h index e1102ca..53d9884 100755 --- a/src/world/level/tile/LeafTile.h +++ b/src/world/level/tile/LeafTile.h @@ -9,6 +9,8 @@ #include "../../item/Item.h" #include "../../item/ItemInstance.h" #include "../FoliageColor.h" +#include "../LevelSource.h" +#include "../biome/BiomeSource.h" class Entity; @@ -54,8 +56,16 @@ public: if (data == BIRCH_LEAF) { return FoliageColor::getBirchColor(); } + if (!FoliageColor::useTint){ + return FoliageColor::getDefaultColor(); + } - return FoliageColor::getDefaultColor(); + // return FoliageColor::getDefaultColor(); we need to hook this up with OPTION_FOLIAGE_TINT + level->getBiomeSource()->getBiomeBlock(x, z, 1, 1); + float temperature = level->getBiomeSource()->temperatures[0]; + float rainfall = level->getBiomeSource()->downfalls[0]; + return FoliageColor::get(temperature, rainfall); + } void onRemove(Level* level, int x, int y, int z) {