Another Huge Commit my bad - shredder

Restored Java's Debug Screen using partial unused code and ported code, avaliable in options menu as a style

Slight Water texture is now overlayed when in water

Vignette function has been fixed and can now be toggled in options

World Generation now includes Tall Grass and Ferns both

Broken Frame Chart Graph found in the source has now been fixed and enabled when debug screen is turned on

Pie Chart works now and will appear when debug screen is opened

Most changes have not been tested on anything besides windows, will test it
This commit is contained in:
Shredder
2026-05-04 01:28:27 +05:00
parent 31d80aedf8
commit e346df682c
22 changed files with 247 additions and 76 deletions

View File

@@ -1735,13 +1735,13 @@ void Level::extinguishFire(int x, int y, int z, int face) {
setTile(x, y, z, 0);
}
}
// String gatherStats() {
// return "All: " + this.entities.size();
// }
//
// String gatherChunkSourceStats() {
// return chunkSource.gatherStats();
// }
std::string Level::gatherStats() {
return "All: " + std::to_string(entities.size());
}
std::string Level::gatherChunkSourceStats() {
return _chunkSource->gatherStats();
}
//
TileEntity* Level::getTileEntity(int x, int y, int z) {
LevelChunk* lc = getChunk(x >> 4, z >> 4);

View File

@@ -202,6 +202,9 @@ public:
bool checkAndHandleWater(const AABB& box, const Material* material, Entity* e);
void extinguishFire(int x, int y, int z, int face);
std::string Level::gatherStats();
std::string Level::gatherChunkSourceStats();
//void addEntities(const EntityList& list);
//void removeEntities(const EntityList& list);
//void ensureAdded(Entity* entity);

View File

@@ -193,7 +193,8 @@ public:
}
std::string gatherStats() {
return "ChunkCache: 1024";
// return "ChunkCache: 1024";
return ("ChunkCache: " + std::to_string(CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH));
}
void saveAll(bool onlyUnsaved) {

View File

@@ -133,22 +133,29 @@ Dimension* Dimension::getNew( int id )
return NULL;
}
std::string Dimension::getDimension(){
int currentID = this->id;
if (currentID == Dimension::NORMAL) return "Overworld";
if (currentID == Dimension::NORMAL_DAYCYCLE) return "Overworld";
return "Unknown";
}
//
// DimensionFactory
//
#include "../storage/LevelData.h"
Dimension* DimensionFactory::createDefaultDimension(LevelData* data )
{
int dimensionId = Dimension::NORMAL;
Dimension* DimensionFactory::createDefaultDimension(LevelData* data )
{
int dimensionId = Dimension::NORMAL;
switch(data->getGameType()) {
case GameType::Survival: dimensionId = Dimension::NORMAL_DAYCYCLE;
break;
case GameType::Creative:
default:
dimensionId = Dimension::NORMAL;
break;
}
switch(data->getGameType()) {
case GameType::Survival: dimensionId = Dimension::NORMAL_DAYCYCLE;
break;
case GameType::Creative:
default:
dimensionId = Dimension::NORMAL;
break;
}
return Dimension::getNew(dimensionId);
}

View File

@@ -49,7 +49,7 @@ public:
bool hasCeiling;
float brightnessRamp[16];//Level::MAX_BRIGHTNESS + 1];
int id;
std::string getDimension();
// shredder added
int FogType; // lets us choose between what fog we want ig
protected:

View File

@@ -11,6 +11,7 @@
#include "../tile/Tile.h"
#include "../tile/HeavyTile.h"
#include "../../../util/Random.h"
#include "../../level/tile/TallGrass.h"
const float RandomLevelSource::SNOW_CUTOFF = 0.5f;
const float RandomLevelSource::SNOW_SCALE = 0.3f;
@@ -225,7 +226,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
int zo = zt * 16;
Biome* biome = level->getBiomeSource()->getBiome(xo + 16, zo + 16);
// Biome* biome = Biome::forest;
// Biome* biome = Biome::forest;
random.setSeed(level->getSeed());
int xScale = random.nextInt() / 2 * 2 + 1;
@@ -419,17 +420,46 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) {
FlowerFeature feature(Tile::mushroom2->id);
feature.place(level, &random, x, y, z);
}
int grassCount = 1;
for (int i = 0; i < grassCount; i++) {
int x = xo + random.nextInt(16) + 8;
int y = random.nextInt(Level::genDepth);
int z = zo + random.nextInt(16) + 8;
Feature* grassFeature = biome->getGrassFeature(&random);
if (grassFeature) {
grassFeature->place(level, &random, x, y, z);
delete grassFeature;
}
}
// normally unused in mcpe but how its supposed to do it
//int grassCount = 1;
//for (int i = 0; i < grassCount; i++) {
//int x = xo + random.nextInt(16) + 8;
//int y = random.nextInt(Level::genDepth);
//int z = zo + random.nextInt(16) + 8;
//Feature* grassFeature = biome->getGrassFeature(&random);
//if (grassFeature) {
//grassFeature->place(level, &random, x, y, z);
//delete grassFeature;
//}
//}
// reworked code from above to generate ferns and shrubs to just like in beta java
int grassCount = 0;
if (biome == Biome::forest) { grassCount = 2; }
else if (biome == Biome::rainForest) { grassCount = 10; }
else if (biome == Biome::seasonalForest) { grassCount = 2; }
else if (biome == Biome::taiga) { grassCount = 1; }
else if (biome == Biome::plains) { grassCount = 10; }
for (int i = 0; i < grassCount; i++) {
int grassMetadata = TallGrass::TALL_GRASS;
if (biome == Biome::rainForest && random.nextInt(3) != 0) {
grassMetadata = TallGrass::FERN;
}
int x = xo + random.nextInt(16) + 8;
int z = zo + random.nextInt(16) + 8;
int y = level->getHeightmap(x, z);
TallgrassFeature grassFeature(Tile::tallgrass->id, grassMetadata);
grassFeature.place(level, &random, x, y, z);
}
for (int i = 0; i < 10; i++) {
int x = xo + random.nextInt(16) + 8;
int y = random.nextInt(128);

View File

@@ -10,5 +10,6 @@
#include "OreFeature.h"
#include "ReedsFeature.h"
#include "SpringFeature.h"
#include "TallgrassFeature.h"
#endif /*FEATURE_INCLUDE__H__*/

View File

@@ -33,15 +33,21 @@ int TallGrass::getColor() {
}
int TallGrass::getColor( int auxData ) {
if(auxData == DEAD_SHRUB) return 0xffffffff;
if(auxData == DEAD_SHRUB);
if (!FoliageColor::useTint && auxData == DEAD_SHRUB){
return 0xffffff;
}
return FoliageColor::getDefaultColor();
}
int TallGrass::getColor( LevelSource* level, int x, int y, int z ) {
int d = level->getData(x, y, z);
if (d == DEAD_SHRUB) return 0xffffff;
if (d == DEAD_SHRUB); //return 0xffffff; // i removed this to make it accurate to beta 1.6.6 instead of early java release versions
float temp = level->getBiomeSource()->temperatures[0]; // shredder added
float rain = level->getBiomeSource()->downfalls[0]; // shredder added
if (!GrassColor::useTint && d == DEAD_SHRUB){
return 0xffffff;
}
if (GrassColor::useTint){
return GrassColor::get(temp, rain);
}