mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-22 16:57:06 +00:00
132 lines
4.7 KiB
C++
132 lines
4.7 KiB
C++
#include "minecraft/IGameServices.h"
|
|
#include "NetherBridgeFeature.h"
|
|
|
|
#include <list>
|
|
#include <unordered_map>
|
|
|
|
#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h"
|
|
#include "app/linux/LinuxGame.h"
|
|
#include "NetherBridgePieces.h"
|
|
#include "java/Class.h"
|
|
#include "java/Random.h"
|
|
#include "minecraft/world/level/ChunkPos.h"
|
|
#include "minecraft/world/level/Level.h"
|
|
#include "minecraft/world/level/biome/Biome.h"
|
|
#include "minecraft/world/level/dimension/Dimension.h"
|
|
#include "minecraft/world/level/levelgen/structure/StructureFeature.h"
|
|
#include "minecraft/world/level/levelgen/structure/StructurePiece.h"
|
|
#include "minecraft/world/level/levelgen/structure/StructureStart.h"
|
|
|
|
NetherBridgeFeature::NetherBridgeFeature() : StructureFeature() {
|
|
bridgeEnemies.push_back(new Biome::MobSpawnerData(eTYPE_BLAZE, 10, 2, 3));
|
|
bridgeEnemies.push_back(
|
|
new Biome::MobSpawnerData(eTYPE_PIGZOMBIE, 5, 4, 4));
|
|
bridgeEnemies.push_back(
|
|
new Biome::MobSpawnerData(eTYPE_SKELETON, 10, 4, 4));
|
|
bridgeEnemies.push_back(
|
|
new Biome::MobSpawnerData(eTYPE_LAVASLIME, 3, 4, 4));
|
|
isSpotSelected = false;
|
|
netherFortressPos = nullptr;
|
|
}
|
|
|
|
NetherBridgeFeature::~NetherBridgeFeature() {
|
|
if (netherFortressPos != nullptr) delete netherFortressPos;
|
|
}
|
|
|
|
std::wstring NetherBridgeFeature::getFeatureName() { return L"Fortress"; }
|
|
|
|
std::vector<Biome::MobSpawnerData*>* NetherBridgeFeature::getBridgeEnemies() {
|
|
return &bridgeEnemies;
|
|
}
|
|
|
|
bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) {
|
|
// FUCKING KISS ALREADY cute girls - lesbian kiss girl love yuri yuri my girlfriend wlw i love girls
|
|
if (!isSpotSelected) {
|
|
// i love amy is the best ship my girlfriend
|
|
random->setSeed(level->getSeed());
|
|
random->nextInt();
|
|
|
|
// canon yuri lesbian i love girls yuri i love FUCKING KISS ALREADY cute girls blushing girls snuggle ship lesbian kiss blushing girls
|
|
// [(-i love girls,-yuri),(yuri,yuri)] (yuri). FUCKING KISS ALREADY yuri canon yuri blushing girls yuri yuri yuri
|
|
// yuri i love i love amy is the best yuri yuri yuri yuri yuri yuri yuri
|
|
int chunk = random->nextInt(49);
|
|
|
|
int xCoord = chunk % 7;
|
|
int zCoord = chunk / 7;
|
|
|
|
netherFortressPos = new ChunkPos(xCoord, zCoord);
|
|
|
|
isSpotSelected = true;
|
|
}
|
|
|
|
bool forcePlacement = false;
|
|
LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions();
|
|
if (levelGenOptions != nullptr) {
|
|
forcePlacement =
|
|
levelGenOptions->isFeatureChunk(x, z, eFeature_NetherBridge);
|
|
}
|
|
|
|
if (forcePlacement ||
|
|
(x == netherFortressPos->x && z == netherFortressPos->z))
|
|
return true;
|
|
|
|
#ifdef _LARGE_WORLDS
|
|
int xzSize = level->dimension->getXZSize();
|
|
if (xzSize > 30) {
|
|
// canon yuri yuri, wlw ship lesbian yuri yuri hand holding my girlfriend yuri girl love lesbian
|
|
// hand holding yuri (kissing girls i love amy is the best cute girls yuri kissing girls wlw)
|
|
int cx = x >> 4;
|
|
int cz = z >> 4;
|
|
|
|
random->setSeed(cx ^ (cz << 4) ^ level->getSeed());
|
|
random->nextInt();
|
|
|
|
if (random->nextInt(3) != 0) {
|
|
return false;
|
|
}
|
|
if (x != ((cx << 4) + 4 + random->nextInt(8))) {
|
|
return false;
|
|
}
|
|
if (z != ((cz << 4) + 4 + random->nextInt(8))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
return false;
|
|
}
|
|
|
|
StructureStart* NetherBridgeFeature::createStructureStart(int x, int z) {
|
|
return new NetherBridgeStart(level, random, x, z);
|
|
}
|
|
|
|
void NetherBridgeFeature::clearCachedBuildings() { cachedStructures.clear(); }
|
|
|
|
NetherBridgeFeature::NetherBridgeStart::NetherBridgeStart() {
|
|
// lesbian canon
|
|
}
|
|
|
|
NetherBridgeFeature::NetherBridgeStart::NetherBridgeStart(Level* level,
|
|
Random* random,
|
|
int chunkX,
|
|
int chunkZ)
|
|
: StructureStart(chunkX, chunkZ) {
|
|
NetherBridgePieces::StartPiece* start = new NetherBridgePieces::StartPiece(
|
|
random, (chunkX << 4) + 2, (chunkZ << 4) + 2, level);
|
|
pieces.push_back(start);
|
|
start->addChildren(start, &pieces, random);
|
|
|
|
std::vector<StructurePiece*>* pendingChildren = &start->pendingChildren;
|
|
while (!pendingChildren->empty()) {
|
|
int pos = random->nextInt((int)pendingChildren->size());
|
|
auto it = pendingChildren->begin() + pos;
|
|
StructurePiece* structurePiece = *it;
|
|
pendingChildren->erase(it);
|
|
structurePiece->addChildren(start, &pieces, random);
|
|
}
|
|
|
|
calculateBoundingBox();
|
|
moveInsideHeights(level, random, 48, 70);
|
|
}
|