mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-26 21:26:38 +01:00
Patch Notes: Blocks + Colored shulker boxes + Concrete powder + Concrete + Glazed terracotta Items + Shulker shell + Iron nugget UI Changes + Added Custom Controls to Keyboard & Mouse, as well as Controller + Added Custom SuperFlat + Added Edit Server Menu + Added Firework Crafting Feature Changes + Host Options + Added Pick Block + Added off-hand slot for maps and arrows. Bug Fixes & changes + TU47: Banner hitbox wrong (and inventory model fixed) + TU47/48: Ice not melting properly + TU48: Dead bushes not dropping sticks + TU48: Guardians and polar bears not dropping cooked fish when on fire + TU48: Bonus chest missing saplings and seeds + TU48: Frosted ice obtainable + TU48: Hoppers not collecting items + TU48: Wither skeletons spawning in 2-high gaps + TU48: End crystals exploding with “TNT Explodes” off + TU48: Tamed ocelots staying hostile + TU48: Signs not placing on tall grass + TU51: Skeleton hitbox wrong + TU53: Fall damage in shallow water + TU53: Squids not spawning in man-made pools + Elytra has been improved to be more accurate to the source material + Removed Spectral Arrow from crafting + Fixed several broken item descriptions + You can no longer cook Pufferfish or Clownfish + Fixed scaling issue with paperdoll and chat + Iron and gold armor can now be smelted into nuggets. + More items can now be used as fuel in a furnace. + Using a firework rocket while gliding with elytra will now give the player a boost. + Changed the color of dyes, wool, carpets, and banners. + Reordered all colored blocks and items in the Creative inventory. Banners now have the same order of colors as all other colored blocks and items. + Fishing rods can now hook on entities without causing knockback or pseudo-damage. + Fixed banner crafting + Fixed Map colors for certain blocks + Fixed Path block height + Fixed String block issues + Fixed Item frame culling. + Fixed Tutorial world NBT/Block State issues + Fixed World Slider + Fixed Enderman AI + Fixed Player animation bug + HUD Flash text changes + Generation accuracy changes + Many other small accuracy changes and fixes
162 lines
5.5 KiB
C++
162 lines
5.5 KiB
C++
#include "stdafx.h"
|
|
#include "OceanMonumentFeature.h"
|
|
#include "OceanMonumentPieces.h"
|
|
#include "net.minecraft.world.level.h"
|
|
#include "net.minecraft.world.level.biome.h"
|
|
#include "Mth.h"
|
|
#include "LevelData.h"
|
|
|
|
|
|
void OceanMonumentFeature::_init()
|
|
{
|
|
spacing = 32;
|
|
separation = 5;
|
|
monumentEnemies.push_back(new Biome::MobSpawnerData(eTYPE_GUARDIAN, 1, 2, 4));
|
|
}
|
|
std::vector<Biome::MobSpawnerData*>* OceanMonumentFeature::getMonumentEnemies()
|
|
{
|
|
return &monumentEnemies;
|
|
}
|
|
|
|
OceanMonumentFeature::OceanMonumentFeature() : StructureFeature() { _init(); }
|
|
OceanMonumentFeature::OceanMonumentFeature(std::unordered_map<std::wstring, std::wstring> options) : StructureFeature()
|
|
{
|
|
_init();
|
|
for (auto& option : options)
|
|
{
|
|
if (option.first.compare(L"spacing") == 0)
|
|
spacing = Mth::getInt(option.second, spacing, 1);
|
|
else if (option.first.compare(L"separation") == 0)
|
|
separation = Mth::getInt(option.second, separation, 1);
|
|
}
|
|
if (separation >= spacing)
|
|
separation = spacing - 1;
|
|
if (separation < 1)
|
|
separation = 1;
|
|
}
|
|
OceanMonumentFeature::~OceanMonumentFeature() {}
|
|
|
|
std::wstring OceanMonumentFeature::getFeatureName() { return L"Monument"; }
|
|
|
|
void OceanMonumentFeature::prescanNearby(int scanRadiusInGridCells)
|
|
{
|
|
if (this->level == nullptr || this->level->getLevelData() == nullptr) return;
|
|
|
|
int candidates = 0;
|
|
int validated = 0;
|
|
int halfSizeChunks = this->level->getLevelData()->getXZSize() / 2;
|
|
int halfSizeBlocks = (this->level->getLevelData()->getXZSize() * 16) / 2;
|
|
app.DebugPrintf("Ocean Monument pre-scan (HalfSize: %d chunks / %d blocks)\n", halfSizeChunks, halfSizeBlocks);
|
|
|
|
for (int gz = -scanRadiusInGridCells; gz <= scanRadiusInGridCells; gz++)
|
|
{
|
|
for (int gx = -scanRadiusInGridCells; gx <= scanRadiusInGridCells; gx++)
|
|
{
|
|
candidates++;
|
|
int64_t chunkSeed = (int64_t)gx * 341873128712LL
|
|
+ (int64_t)gz * 132897987541LL
|
|
+ this->level->getSeed()
|
|
+ 10387313LL;
|
|
Random r(chunkSeed);
|
|
|
|
int cx = gx * this->spacing;
|
|
int cz = gz * this->spacing;
|
|
cx += (r.nextInt(this->spacing - this->separation) + r.nextInt(this->spacing - this->separation)) / 2;
|
|
cz += (r.nextInt(this->spacing - this->separation) + r.nextInt(this->spacing - this->separation)) / 2;
|
|
|
|
int blockX = cx * 16 + 8;
|
|
int blockZ = cz * 16 + 8;
|
|
|
|
if (Mth::abs(blockX) > halfSizeBlocks || Mth::abs(blockZ) > halfSizeBlocks)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (this->isFeatureChunk(cx, cz))
|
|
{
|
|
validated++;
|
|
}
|
|
}
|
|
}
|
|
|
|
app.DebugPrintf(" Pre-scan done: %d grid slots checked, %d validated monuments found. \n", candidates, validated);
|
|
}
|
|
|
|
bool OceanMonumentFeature::isFeatureChunk(int x, int z, bool bIsSuperflat)
|
|
{
|
|
if (this->level == nullptr || this->level->getBiomeSource() == nullptr) return false;
|
|
|
|
int i = x;
|
|
int j = z;
|
|
|
|
if (x < 0) x -= this->spacing - 1;
|
|
if (z < 0) z -= this->spacing - 1;
|
|
|
|
int k = x / this->spacing;
|
|
int l = z / this->spacing;
|
|
|
|
int64_t chunkSeed = (int64_t)k * 341873128712LL + (int64_t)l * 132897987541LL + this->level->getSeed() + 10387313LL;
|
|
Random random(chunkSeed);
|
|
|
|
k *= this->spacing;
|
|
l *= this->spacing;
|
|
|
|
k += (random.nextInt(this->spacing - this->separation) + random.nextInt(this->spacing - this->separation)) / 2;
|
|
l += (random.nextInt(this->spacing - this->separation) + random.nextInt(this->spacing - this->separation)) / 2;
|
|
|
|
if (i == k && j == l)
|
|
{
|
|
Biome* centerBiome = this->level->getBiomeSource()->getBiome(i * 16 + 8, j * 16 + 8);
|
|
|
|
if (centerBiome == Biome::deepOcean)
|
|
{
|
|
std::vector<Biome*> surrounding;
|
|
surrounding.reserve(5);
|
|
surrounding.push_back(Biome::ocean);
|
|
surrounding.push_back(Biome::deepOcean);
|
|
surrounding.push_back(Biome::river);
|
|
surrounding.push_back(Biome::frozenOcean);
|
|
surrounding.push_back(Biome::frozenRiver);
|
|
|
|
if (this->level->getBiomeSource()->containsOnly(i * 16 + 8, j * 16 + 8, 29, surrounding))
|
|
{
|
|
app.DebugPrintf("Placed Ocean Monument in valid biome at (%d, %d), (%d, %d)\n",
|
|
i, j, i * 16 + 8, j * 16 + 8);
|
|
app.AddTerrainFeaturePosition(eTerrainFeature_OceanMonument, i, j);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
StructureStart* OceanMonumentFeature::createStructureStart(int x, int z)
|
|
{
|
|
if (this->level == nullptr) return nullptr;
|
|
return new MonumentStart(level, random, x, z);
|
|
}
|
|
|
|
OceanMonumentFeature::MonumentStart::MonumentStart() {}
|
|
|
|
OceanMonumentFeature::MonumentStart::MonumentStart(Level* level, Random* random, int chunkX, int chunkZ)
|
|
: StructureStart(chunkX, chunkZ)
|
|
{
|
|
random->setSeed(level->getSeed());
|
|
int64_t i = random->nextLong();
|
|
int64_t j = random->nextLong();
|
|
int64_t k = (int64_t)chunkX * i;
|
|
int64_t l = (int64_t)chunkZ * j;
|
|
random->setSeed(k ^ l ^ level->getSeed());
|
|
|
|
int startX = chunkX * 16 + 8 - 29;
|
|
int startZ = chunkZ * 16 + 8 - 29;
|
|
|
|
int facing = random->nextInt(4) + 2;
|
|
|
|
OceanMonumentPieces::MonumentBuilding* building =
|
|
new OceanMonumentPieces::MonumentBuilding(random, startX, startZ, facing);
|
|
pieces.push_back(building);
|
|
|
|
calculateBoundingBox();
|
|
} |