diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/LightningBolt.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/LightningBolt.cpp')
| -rw-r--r-- | Minecraft.World/LightningBolt.cpp | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/Minecraft.World/LightningBolt.cpp b/Minecraft.World/LightningBolt.cpp index 901bedf1..7f32c8ec 100644 --- a/Minecraft.World/LightningBolt.cpp +++ b/Minecraft.World/LightningBolt.cpp @@ -27,31 +27,28 @@ LightningBolt::LightningBolt(Level *level, double x, double y, double z) : flashes = 1; // 4J - added clientside check - if( !level->isClientSide ) + if( !level->isClientSide && level->getGameRules()->getBoolean(GameRules::RULE_DOFIRETICK)&&level->difficulty >= 2 && level->hasChunksAt( Mth::floor(x), Mth::floor(y), Mth::floor(z), 10)) { - if (level->difficulty >= 2 && level->hasChunksAt( Mth::floor(x), Mth::floor(y), Mth::floor(z), 10)) { + int xt = Mth::floor(x); + int yt = Mth::floor(y); + int zt = Mth::floor(z); + // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation + if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) { - int xt = Mth::floor(x); - int yt = Mth::floor(y); - int zt = Mth::floor(z); - // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation - if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) - { - if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTile(xt, yt, zt, Tile::fire_Id); - } + if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTileAndUpdate(xt, yt, zt, Tile::fire_Id); } + } - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) + { + int xt = Mth::floor(x) + random->nextInt(3) - 1; + int yt = Mth::floor(y) + random->nextInt(3) - 1; + int zt = Mth::floor(z) + random->nextInt(3) - 1; + // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation + if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) { - int xt = Mth::floor(x) + random->nextInt(3) - 1; - int yt = Mth::floor(y) + random->nextInt(3) - 1; - int zt = Mth::floor(z) + random->nextInt(3) - 1; - // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation - if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) - { - if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTile(xt, yt, zt, Tile::fire_Id); - } + if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTileAndUpdate(xt, yt, zt, Tile::fire_Id); } } } @@ -79,21 +76,18 @@ void LightningBolt::tick() { flashes--; life = 1; - // 4J - added clientside check - if( !level->isClientSide ) + + seed = random->nextLong(); + if (!level->isClientSide && level->getGameRules()->getBoolean(GameRules::RULE_DOFIRETICK) && level->hasChunksAt( (int) floor(x), (int) floor(y), (int) floor(z), 10)) { - seed = random->nextLong(); - if (level->hasChunksAt( (int) floor(x), (int) floor(y), (int) floor(z), 10)) + int xt = (int) floor(x); + int yt = (int) floor(y); + int zt = (int) floor(z); + + // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation + if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) { - int xt = (int) floor(x); - int yt = (int) floor(y); - int zt = (int) floor(z); - - // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation - if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) - { - if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTile(xt, yt, zt, Tile::fire_Id); - } + if (level->getTile(xt, yt, zt) == 0 && Tile::fire->mayPlace(level, xt, yt, zt)) level->setTileAndUpdate(xt, yt, zt, Tile::fire_Id); } } } @@ -101,10 +95,13 @@ void LightningBolt::tick() if (life >= 0) { - double r = 3; - // 4J - added clientside check - if( !level->isClientSide ) + if (level->isClientSide) + { + level->skyFlashTime = 2; + } + else { + double r = 3; vector<shared_ptr<Entity> > *entities = level->getEntities(shared_from_this(), AABB::newTemp(x - r, y - r, z - r, x + r, y + 6 + r, z + r)); AUTO_VAR(itEnd, entities->end()); for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) @@ -113,8 +110,6 @@ void LightningBolt::tick() e->thunderHit(this); } } - - level->lightningBoltTime = 2; } } |
