From f5afc92cddc1764ecfd16a712bc891114ca0839e Mon Sep 17 00:00:00 2001 From: Fireblade <3+fireblade@noreply.neolegacy.dev> Date: Sat, 18 Jul 2026 20:52:23 -0400 Subject: [PATCH] chore: port rest of magma block stuff --- Minecraft.Client/ClientConnection.cpp | 9 ++++ .../Common/UI/IUIScene_CreativeMenu.cpp | 2 +- Minecraft.Client/ServerPlayer.cpp | 4 ++ .../Windows64Media/loc/stringsGeneric.xml | 9 ++++ Minecraft.World/ChatPacket.h | 2 + Minecraft.World/DamageSource.cpp | 1 + Minecraft.World/DamageSource.h | 1 + Minecraft.World/HellRandomLevelSource.cpp | 2 +- Minecraft.World/LivingEntity.cpp | 4 +- Minecraft.World/MagmaTile.cpp | 46 ++++++++++++++++++- Minecraft.World/MagmaTile.h | 5 ++ Minecraft.World/Tile.cpp | 4 +- Minecraft.World/Tile.h | 2 +- 13 files changed, 83 insertions(+), 8 deletions(-) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 66faf03f..6717114c 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -1795,6 +1795,15 @@ void ClientConnection::handleChat(shared_ptr packet) replacePlayer = true; replaceEntitySource = true; break; + case ChatPacket::e_ChatDeathHotFloor: + message=app.GetString(IDS_DEATH_HOT_FLOOR); + replacePlayer = true; + break; + case ChatPacket::e_ChatDeathHotFloorPlayer: + message=app.GetString(IDS_DEATH_HOT_FLOOR_PLAYER); + replacePlayer = true; + replaceEntitySource = true; + break; case ChatPacket::e_ChatDeathFellAccidentLadder: diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 6a0e6015..ebd0c149 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -170,7 +170,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::red_nether_brick_Id) ITEM(Tile::end_stone_Id) ITEM(Tile::end_bricks_Id) - ITEM(Tile::magma_Id) + ITEM(Tile::magma_block_Id) ITEM(Tile::nether_wart_block_Id) ITEM(Tile::bone_block_Id) ITEM_AUX(Tile::quartz_block_Id,QuartzBlockTile::TYPE_CHISELED) diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 17bcd7c8..f8c7ac9c 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -143,6 +143,10 @@ static std::wstring FormatDeathMessage(const shared_ptr& packet) message = app.GetString(IDS_DEATH_FELL_ASSIST_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathFellFinishItem: message = app.GetString(IDS_DEATH_FELL_FINISH_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; + case ChatPacket::e_ChatDeathHotFloor: + message = app.GetString(IDS_DEATH_HOT_FLOOR); replacePlayer = true; break; + case ChatPacket::e_ChatDeathHotFloorPlayer: + message = app.GetString(IDS_DEATH_HOT_FLOOR_PLAYER); replacePlayer = true; replaceEntitySource = true; break; default: message = app.GetString(IDS_DEATH_GENERIC); replacePlayer = true; break; } diff --git a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml index 3b73cd5e..8ff84656 100644 --- a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml +++ b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml @@ -6792,6 +6792,11 @@ Would you like to install the mash-up pack or texture pack now? {*PLAYER*} burned to death + + {*PLAYER*} discovered the floor was lava + + + {*PLAYER*} tried to swim in lava @@ -6904,6 +6909,10 @@ Would you like to install the mash-up pack or texture pack now? {*PLAYER*} was burnt to a crisp whilst fighting {*SOURCE*} + + {*PLAYER*} walked into the danger zone due to {*SOURCE*} + + {*PLAYER*} tried to swim in lava to escape {*SOURCE*} diff --git a/Minecraft.World/ChatPacket.h b/Minecraft.World/ChatPacket.h index f763d55a..605038a1 100644 --- a/Minecraft.World/ChatPacket.h +++ b/Minecraft.World/ChatPacket.h @@ -72,6 +72,8 @@ public: e_ChatDeathFireballItem, e_ChatDeathThrownItem, e_ChatDeathIndirectMagicItem, + e_ChatDeathHotFloor, + e_ChatDeathHotFloorPlayer, e_ChatPlayerEnteredEnd, e_ChatPlayerLeftEnd, diff --git a/Minecraft.World/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index 2770c42f..198d9efb 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/DamageSource.cpp @@ -23,6 +23,7 @@ DamageSource *DamageSource::wither = (new DamageSource(ChatPacket::e_ChatDeathWi DamageSource *DamageSource::anvil = (new DamageSource(ChatPacket::e_ChatDeathAnvil)); DamageSource *DamageSource::fallingBlock = (new DamageSource(ChatPacket::e_ChatDeathFallingBlock)); DamageSource *DamageSource::flyIntoWall = new DamageSource(ChatPacket::e_ChatDeathFlyIntoWall); +DamageSource *DamageSource::hotFloor = (new DamageSource(ChatPacket::e_ChatDeathHotFloor, ChatPacket::e_ChatDeathHotFloorPlayer))->setIsFire(); DamageSource *DamageSource::mobAttack(shared_ptr mob) { diff --git a/Minecraft.World/DamageSource.h b/Minecraft.World/DamageSource.h index 9b073560..adca32b2 100644 --- a/Minecraft.World/DamageSource.h +++ b/Minecraft.World/DamageSource.h @@ -30,6 +30,7 @@ public: static DamageSource *anvil; static DamageSource *fallingBlock; static DamageSource *flyIntoWall; + static DamageSource *hotFloor; static DamageSource *mobAttack(shared_ptr mob); static DamageSource *playerAttack(shared_ptr player); diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index 6a5cec0b..1ab239d0 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -487,7 +487,7 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt) FlowerFeature(Tile::mushroom_red_Id).place(level, pprandom, x, y, z); } - OreFeature magmaFeature(Tile::magma_Id, 0, 160, Tile::netherrack_Id); + OreFeature magmaFeature(Tile::magma_block_Id, 0, 160, Tile::netherrack_Id); for (int i = 0; i < 4; i++) { int x = xo + pprandom->nextInt(16); diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index eda0924a..0f20231f 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -211,9 +211,9 @@ void LivingEntity::baseTick() if (!level->isClientSide && isAlive() && onGround && !isSneaking() && tickCount % 10 == 0) { int tileBelow = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z)); - if (tileBelow == Tile::magma_Id) + if (tileBelow == Tile::magma_block_Id) { - hurt(DamageSource::inFire, 1); + hurt(DamageSource::hotFloor, 1); } } diff --git a/Minecraft.World/MagmaTile.cpp b/Minecraft.World/MagmaTile.cpp index ccc979cf..5f1205dd 100644 --- a/Minecraft.World/MagmaTile.cpp +++ b/Minecraft.World/MagmaTile.cpp @@ -3,6 +3,50 @@ #include "MagmaTile.h" MagmaTile::MagmaTile(int id) : Tile(id, Material::stone) -{ +{ setLightEmission(0.2f); } + +void MagmaTile::tick(Level *level, int x, int y, int z, Random *random) +{ + int above = level->getTile(x, y + 1, z); + if (above == Tile::water_Id || above == Tile::flowing_water_Id) + { + level->removeTile(x, y + 1, z); + level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, 2.6f + (random->nextFloat() - random->nextFloat()) * 0.8f); + + for (int i = 0; i < 8; ++i) + { + float rx = x + 0.5f + (random->nextFloat() - random->nextFloat()) * 0.5f; + float ry = y + 0.25f + random->nextFloat() * 0.25f; + float rz = z + 0.5f + (random->nextFloat() - random->nextFloat()) * 0.5f; + level->addParticle(eParticleType_largesmoke, rx, ry, rz, 0, 0, 0); + } + } + level->addToTickNextTick(x, y, z, id, getTickDelay(level) + random->nextInt(10)); +} + +void MagmaTile::animateTick(Level *level, int x, int y, int z, Random *random) +{ + // rain -> smoke particles + if (level->isRainingAt(x, y + 1, z)) + { + for (int i = 0; i < 4; ++i) + { + float rx = x + random->nextFloat(); + float ry = y + 1.0f + random->nextFloat() * 0.5f; + float rz = z + random->nextFloat(); + level->addParticle(eParticleType_largesmoke, rx, ry, rz, 0, 0, 0); + } + } +} + +int MagmaTile::getTickDelay(Level *level) +{ + return 160; +} + +int MagmaTile::getLightColor(LevelSource *level, int x, int y, int z, int tileId) +{ + return 0x0f000f0; +} \ No newline at end of file diff --git a/Minecraft.World/MagmaTile.h b/Minecraft.World/MagmaTile.h index 51abbf83..2333e784 100644 --- a/Minecraft.World/MagmaTile.h +++ b/Minecraft.World/MagmaTile.h @@ -5,4 +5,9 @@ class MagmaTile : public Tile { public: MagmaTile(int id); + virtual void tick(Level *level, int x, int y, int z, Random *random) override; + + virtual void animateTick(Level *level, int x, int y, int z, Random *random) override; + virtual int getTickDelay(Level *level) override; + virtual int getLightColor(LevelSource *level, int x, int y, int z, int tileId = -1) override; }; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index e4df1042..eed25a61 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -592,7 +592,7 @@ void Tile::staticCtor() Tile::frosted_ice = static_cast((new FrostedIceTile(frosted_ice_Id))->setDestroyTime(0.5f)->setLightBlock(3)->setSoundType(Tile::SOUND_GLASS)->setIconName(L"ice")->setDescriptionId(IDS_TILE_FROSTED_ICE)->setUseDescriptionId(IDS_DESC_ICE)->setNotCollectStatistics()); Tile::end_bricks = (new Tile(end_bricks_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(3.0f)->setExplodeable(9)->setSoundType(SOUND_STONE)->setIconName(L"end_bricks")->setDescriptionId(IDS_TILE_END_BRICKS)->setUseDescriptionId(IDS_DESC_STONE); - Tile::magma = static_cast((new MagmaTile(magma_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_stone)->setDestroyTime(0.5f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"magma")->setDescriptionId(IDS_TILE_MAGMA)->setUseDescriptionId(IDS_DESC_MAGMA)); + Tile::magma = static_cast((new MagmaTile(magma_block_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_stone)->setDestroyTime(0.5f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"magma")->setDescriptionId(IDS_TILE_MAGMA)->setUseDescriptionId(IDS_DESC_MAGMA)); Tile::nether_wart_block = (new Tile(nether_wart_block_Id, Material::grass))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_wheat)->setDestroyTime(0.5f)->setSoundType(SOUND_WOOD)->setIconName(L"nether_wart_block")->setDescriptionId(IDS_TILE_NETHER_WART_BLOCK)->setUseDescriptionId(IDS_DESC_NETHER_WART_BLOCK); Tile::red_nether_brick = (new Tile(red_nether_brick_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"red_nether_brick")->setDescriptionId(IDS_TILE_RED_NETHER_BRICK)->setUseDescriptionId(IDS_DESC_RED_NETHER_BRICK); Tile::bone_block = static_cast((new BoneBlockTile(bone_block_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(1.5f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"bone_block_side")->setDescriptionId(IDS_TILE_BONE_BLOCK)->setUseDescriptionId(IDS_DESC_BONE_BLOCK)->sendTileData()); @@ -1934,7 +1934,7 @@ const int Tile::slime_Id; const int Tile::beetroots_Id; const int Tile::grass_path_Id; const int Tile::end_bricks_Id; -const int Tile::magma_Id; +const int Tile::magma_block_Id; const int Tile::nether_wart_block_Id; const int Tile::red_nether_brick_Id; const int Tile::bone_block_Id; diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index 2f2361a6..a29d889f 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -451,7 +451,7 @@ public: static const int grass_path_Id = 208; //end_gateway 209 static const int frosted_ice_Id = 212; - static const int magma_Id = 213; + static const int magma_block_Id = 213; static const int nether_wart_block_Id = 214; static const int red_nether_brick_Id = 215; static const int bone_block_Id = 216;