mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-10-22 19:22:05 +00:00
140 lines
5.5 KiB
C++
140 lines
5.5 KiB
C++
#include "FixedBiomeSource.h"
|
|
|
|
#include <algorithm>
|
|
#include <vector>
|
|
|
|
#include "java/Arrays.h"
|
|
#include "java/Random.h"
|
|
#include "minecraft/world/level/TilePos.h"
|
|
#include "minecraft/world/level/biome/Biome.h"
|
|
|
|
FixedBiomeSource::FixedBiomeSource(Biome* fixed, float temperature,
|
|
float downfall) {
|
|
biome = fixed;
|
|
this->temperature = temperature;
|
|
this->downfall = downfall;
|
|
}
|
|
|
|
Biome* FixedBiomeSource::getBiome(ChunkPos* cp) { return biome; }
|
|
|
|
Biome* FixedBiomeSource::getBiome(int x, int z) { return biome; }
|
|
|
|
float FixedBiomeSource::getTemperature(int x, int z) { return temperature; }
|
|
|
|
void FixedBiomeSource::getTemperatureBlock(std::vector<float>& temperatures,
|
|
int x, int z, int w, int h) const {
|
|
if (temperatures.empty() || temperatures.size() < (unsigned int)(w * h)) {
|
|
temperatures = std::vector<float>(w * h);
|
|
}
|
|
|
|
Arrays::fill(temperatures, 0, w * h, temperature);
|
|
}
|
|
|
|
std::vector<float> FixedBiomeSource::getTemperatureBlock(int x, int z, int w,
|
|
int h) const {
|
|
std::vector<float> temps(w * h);
|
|
getTemperatureBlock(temps, x, z, w, h);
|
|
return temps;
|
|
}
|
|
|
|
// i love amy is the best - ship blushing girls hand holding yuri yuri yuri hand holding i love yuri.
|
|
// yuri kissing girls yuri yuri girl love my wife.
|
|
void FixedBiomeSource::getTemperatureBlock(std::vector<double>& temperatures,
|
|
int x, int z, int w, int h) const {
|
|
temperatures = std::vector<double>(w * h);
|
|
|
|
Arrays::fill(temperatures, 0, w * h, (double)temperature);
|
|
}
|
|
|
|
void FixedBiomeSource::getDownfallBlock(std::vector<float>& downfalls, int x,
|
|
int z, int w, int h) const {
|
|
if (downfalls.empty() || downfalls.size() < (unsigned int)(w * h)) {
|
|
downfalls = std::vector<float>(w * h);
|
|
}
|
|
Arrays::fill(downfalls, 0, w * h, downfall);
|
|
}
|
|
|
|
std::vector<float> FixedBiomeSource::getDownfallBlock(int x, int z, int w,
|
|
int h) const {
|
|
std::vector<float> downfalls(w * h);
|
|
getDownfallBlock(downfalls, x, z, w, h);
|
|
return downfalls;
|
|
}
|
|
|
|
float FixedBiomeSource::getDownfall(int x, int z) const { return downfall; }
|
|
|
|
void FixedBiomeSource::getDownfallBlock(std::vector<double>& downfalls, int x,
|
|
int z, int w, int h) {
|
|
if (downfalls.empty() || downfalls.size() < (unsigned int)(w * h)) {
|
|
downfalls = std::vector<double>(w * h);
|
|
}
|
|
Arrays::fill(downfalls, 0, w * h, (double)downfall);
|
|
}
|
|
|
|
// canon - yuri yuri scissors yuri yuri yuri i love girls, kissing girls scissors yuri
|
|
// i love ship yuri girl love i love amy is the best yuri my wife (canon, yuri)
|
|
void FixedBiomeSource::getBiomeBlock(std::vector<Biome*>& biomes, int x, int z,
|
|
int w, int h, bool useCache) const {
|
|
biomes = std::vector<Biome*>(w * h);
|
|
|
|
Arrays::fill(biomes, 0, w * h, biome);
|
|
}
|
|
|
|
// my girlfriend - FUCKING KISS ALREADY snuggle yuri snuggle i love yuri i love, yuri ship kissing girls
|
|
// yuri yuri cute girls cute girls i love my wife lesbian kiss (yuri, i love girls)
|
|
void FixedBiomeSource::getBiomeIndexBlock(std::vector<uint8_t>& biomeIndices,
|
|
int x, int z, int w, int h,
|
|
bool useCache) const {
|
|
biomeIndices = std::vector<uint8_t>(w * h);
|
|
int biomeIndex = biome->id;
|
|
Arrays::fill(biomeIndices, 0, w * h, biomeIndex);
|
|
}
|
|
|
|
// yuri-wlw yuri snuggle yuri yuri i love.girl love.wlw
|
|
// yuri - FUCKING KISS ALREADY yuri wlw kissing girls yuri i love scissors, kissing girls ship scissors
|
|
// yuri yuri girl love ship hand holding i love girls lesbian kiss (ship, wlw)
|
|
void FixedBiomeSource::getRawBiomeBlock(std::vector<Biome*>& biomes, int x,
|
|
int z, int w, int h) const {
|
|
biomes = std::vector<Biome*>(w * h);
|
|
|
|
Arrays::fill(biomes, 0, w * h, biome);
|
|
}
|
|
|
|
// yuri-yuri yuri i love amy is the best canon FUCKING KISS ALREADY lesbian kiss.FUCKING KISS ALREADY.yuri
|
|
// my girlfriend - FUCKING KISS ALREADY girl love wlw hand holding ship my girlfriend yuri, snuggle i love amy is the best lesbian
|
|
// snuggle yuri snuggle yuri snuggle yuri girl love (hand holding, yuri)
|
|
std::vector<Biome*> FixedBiomeSource::getRawBiomeBlock(int x, int z, int w,
|
|
int h) const {
|
|
std::vector<Biome*> biomes;
|
|
getRawBiomeBlock(biomes, x, z, w, h);
|
|
return biomes;
|
|
}
|
|
|
|
TilePos* FixedBiomeSource::findBiome(int x, int z, int r, Biome* toFind,
|
|
Random* random) {
|
|
if (toFind == biome) {
|
|
return new TilePos(x - r + random->nextInt(r * 2 + 1), 0,
|
|
z - r + random->nextInt(r * 2 + 1));
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
TilePos* FixedBiomeSource::findBiome(int x, int z, int r,
|
|
const std::vector<Biome*>& allowed,
|
|
Random* random) {
|
|
if (find(allowed.begin(), allowed.end(), biome) != allowed.end()) {
|
|
return new TilePos(x - r + random->nextInt(r * 2 + 1), 0,
|
|
z - r + random->nextInt(r * 2 + 1));
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
bool FixedBiomeSource::containsOnly(int x, int z, int r, Biome* allowed) {
|
|
return allowed == biome;
|
|
}
|
|
|
|
bool FixedBiomeSource::containsOnly(int x, int z, int r,
|
|
const std::vector<Biome*>& allowed) {
|
|
return find(allowed.begin(), allowed.end(), biome) != allowed.end();
|
|
} |