Files
neoLegacy/Minecraft.World/TheEndDimension.cpp
T
Tranqlmao 9abd52985e TU53 + Bug Fixes (Many)
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
2026-11-24 13:44:06 -05:00

170 lines
4.1 KiB
C++

#include "stdafx.h"
#include "TheEndDimension.h"
#include "FixedBiomeSource.h"
#include "net.minecraft.world.level.levelgen.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.storage.h"
#include "EndDragonFight.h"
#include "../Minecraft.Client/Minecraft.h"
#include "../Minecraft.Client/Common/Colours/ColourTable.h"
void TheEndDimension::init()
{
dragonFight = nullptr;
biomeSource = new FixedBiomeSource(Biome::sky, 0.5f, 0);
id = 1;
hasCeiling = true;
}
ChunkSource *TheEndDimension::createRandomLevelSource() const
{
if (level != nullptr && level->getLevelData() != nullptr) setWorldSize(level->getLevelData()->getXZSize());
return new TheEndLevelRandomLevelSource(level, level->getSeed(), isModernEnd());
}
float TheEndDimension::getTimeOfDay(int64_t time, float a) const
{
return 0.0f;
}
float *TheEndDimension::getSunriseColor(float td, float a)
{
return nullptr;
}
Vec3 *TheEndDimension::getFogColor(float td, float a) const
{
int fogColor = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_End_Fog_Colour ); //0xa080a0;
float br = Mth::cos(td * PI * 2) * 2 + 0.5f;
if (br < 0.0f) br = 0.0f;
if (br > 1.0f) br = 1.0f;
float r = ((fogColor >> 16) & 0xff) / 255.0f;
float g = ((fogColor >> 8) & 0xff) / 255.0f;
float b = ((fogColor) & 0xff) / 255.0f;
r *= br * 0.0f + 0.15f;
g *= br * 0.0f + 0.15f;
b *= br * 0.0f + 0.15f;
return Vec3::newTemp(r, g, b);
}
bool TheEndDimension::hasGround()
{
return false;
}
bool TheEndDimension::mayRespawn() const
{
return false;
}
bool TheEndDimension::isNaturalDimension()
{
return false;
}
float TheEndDimension::getCloudHeight()
{
return 8;
}
bool TheEndDimension::isValidSpawn(int x, int z) const
{
int topTile = level->getTopTile(x, z);
if (topTile == 0) return false;
return Tile::tiles[topTile]->material->blocksMotion();
}
Pos *TheEndDimension::getSpawnPos()
{
if (isModernEnd()) return new Pos(60, 50, 60);
return new Pos(100, 50, 0);
}
bool TheEndDimension::isFoggyAt(int x, int z)
{
return true;
}
int TheEndDimension::getSpawnYPosition()
{
return 50;
}
const int TheEndDimension::AREA_CHUNK_X[TheEndDimension::AREA_MAX] = { 0, 0, 25, 0, -25 };
const int TheEndDimension::AREA_CHUNK_Z[TheEndDimension::AREA_MAX] = { 0, 25, 0, -25, 0 };
int TheEndDimension::AREA_COUNT = 2;
void TheEndDimension::setWorldSize(int overworldXZSize)
{
#ifdef _LARGE_WORLDS
if (overworldXZSize >= LEVEL_WIDTH_LARGE) AREA_COUNT = AREA_MAX;
else if (overworldXZSize >= LEVEL_WIDTH_MEDIUM) AREA_COUNT = 4;
else if (overworldXZSize >= LEVEL_WIDTH_SMALL) AREA_COUNT = 3;
else AREA_COUNT = 2;
#else
AREA_COUNT = 2;
#endif
}
bool TheEndDimension::isOuterAreaCentre(int chunkX, int chunkZ)
{
for (int i = 1; i < AREA_COUNT; i++)
{
if (chunkX == AREA_CHUNK_X[i] && chunkZ == AREA_CHUNK_Z[i]) return true;
}
return false;
}
int TheEndDimension::closestArea(int chunkX, int chunkZ)
{
int closest = 0;
int closestDistance = INT_MAX;
for (int i = 0; i < AREA_COUNT; i++)
{
int distance = max(abs(chunkX - AREA_CHUNK_X[i]), abs(chunkZ - AREA_CHUNK_Z[i]));
if (distance < closestDistance)
{
closest = i;
closestDistance = distance;
}
}
return closest;
}
bool TheEndDimension::isChunkInArea(int chunkX, int chunkZ)
{
int area = closestArea(chunkX, chunkZ);
int dx = chunkX - AREA_CHUNK_X[area];
int dz = chunkZ - AREA_CHUNK_Z[area];
return dx >= -AREA_HALF_CHUNKS - 1 && dx < AREA_HALF_CHUNKS && dz >= -AREA_HALF_CHUNKS - 1 && dz < AREA_HALF_CHUNKS;
}
bool TheEndDimension::isModernEnd() const
{
return level != nullptr && level->getLevelData() != nullptr && level->getLevelData()->isModernEnd();
}
int TheEndDimension::getXZSize()
{
return isModernEnd() ? END_LEVEL_MODERN_WIDTH : Dimension::getXZSize();
}
bool TheEndDimension::isOutsideWorldEdge(int x, int z)
{
if (!isModernEnd()) return Dimension::isOutsideWorldEdge(x, z);
setWorldSize(level->getLevelData()->getXZSize());
return !isChunkInArea(x >> 4, z >> 4) || Dimension::isOutsideWorldEdge(x, z);
}
EndDragonFight *TheEndDimension::getDragonFight()
{
if (dragonFight == nullptr) dragonFight = new EndDragonFight(level);
return dragonFight;
}