mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-04-04 06:23:33 +00:00
Added Foliage and Grass Color tinting, Started Basic Work on restoring ravines, New Option to Toggle Tinting.
This commit is contained in:
BIN
data/images/environment/foliagecolor.png
Normal file
BIN
data/images/environment/foliagecolor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
data/images/environment/grasscolor.png
Normal file
BIN
data/images/environment/grasscolor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -84,6 +84,7 @@ enum OptionId {
|
||||
OPTIONS_LAST_IP,
|
||||
|
||||
OPTIONS_RPI_CURSOR,
|
||||
OPTIONS_FOLIAGE_TINT,
|
||||
// Should be last!
|
||||
OPTIONS_COUNT
|
||||
};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
13
src/world/level/FoliageColor.cpp
Normal file
13
src/world/level/FoliageColor.cpp
Normal file
@@ -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;
|
||||
@@ -6,6 +6,16 @@
|
||||
class FoliageColor
|
||||
{
|
||||
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) {
|
||||
// FoliageColor::pixels = pixels;
|
||||
// }
|
||||
@@ -17,6 +27,13 @@ public:
|
||||
// return pixels[y << 8 | x];
|
||||
// }
|
||||
|
||||
|
||||
static void init(int* p) {
|
||||
pixels = p;
|
||||
}
|
||||
|
||||
static int get(float temp, float rain);
|
||||
|
||||
static int getEvergreenColor() {
|
||||
return 0x619961;
|
||||
}
|
||||
@@ -26,11 +43,12 @@ public:
|
||||
}
|
||||
|
||||
static int getDefaultColor() {
|
||||
return 0x48b518;
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
private:
|
||||
// static int pixels[256*256];
|
||||
static int* pixels;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_WORLD_LEVEL__FoliageColor_H__*/
|
||||
|
||||
13
src/world/level/GrassColor.cpp
Normal file
13
src/world/level/GrassColor.cpp
Normal file
@@ -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;
|
||||
42
src/world/level/GrassColor.h
Normal file
42
src/world/level/GrassColor.h
Normal file
@@ -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__*/
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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__*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -14,6 +14,7 @@ class GrassTile: public Tile
|
||||
{
|
||||
typedef Tile super;
|
||||
public:
|
||||
|
||||
static const int MIN_BRIGHTNESS = 4;
|
||||
|
||||
GrassTile(int id);
|
||||
|
||||
@@ -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,10 +56,18 @@ public:
|
||||
if (data == BIRCH_LEAF) {
|
||||
return FoliageColor::getBirchColor();
|
||||
}
|
||||
|
||||
if (!FoliageColor::useTint){
|
||||
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) {
|
||||
int r = 1;
|
||||
int r2 = r + 1;
|
||||
|
||||
Reference in New Issue
Block a user