MinecraftConsoles/Minecraft.World/ToggleDownfallCommand.cpp
Riley M. c0da06e4ee
major: Switch to forward slashes(+more) to fix compilation on Linux (#1403)
Notably also adds some metadata files for NixOS 

* add support for linux clang cross compiles

* add linux clang instructions

* un-capitalize Mob.horse.*

* update the description in flake.nix

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-04-14 16:47:37 -05:00

35 lines
1 KiB
C++

#include "stdafx.h"
#include "../Minecraft.Client/MinecraftServer.h"
#include "../Minecraft.Client/ServerLevel.h"
#include "net.minecraft.commands.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.storage.h"
#include "net.minecraft.network.packet.h"
#include "ToggleDownfallCommand.h"
EGameCommand ToggleDownfallCommand::getId()
{
return eGameCommand_ToggleDownfall;
}
int ToggleDownfallCommand::getPermissionLevel()
{
return LEVEL_GAMEMASTERS;
}
void ToggleDownfallCommand::execute(shared_ptr<CommandSender> source, byteArray commandData)
{
doToggleDownfall();
logAdminAction(source, ChatPacket::e_ChatCustom, L"commands.downfall.success");
}
void ToggleDownfallCommand::doToggleDownfall()
{
MinecraftServer::getInstance()->levels[0]->toggleDownfall();
MinecraftServer::getInstance()->levels[0]->getLevelData()->setThundering(true);
}
shared_ptr<GameCommandPacket> ToggleDownfallCommand::preparePacket()
{
return std::make_shared<GameCommandPacket>(eGameCommand_ToggleDownfall, byteArray());
}