Files
MinecraftConsoles/Minecraft.World/ToggleDownfallCommand.cpp
ModMaker101 a9be52c41a Project modernization (#630)
* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
2026-03-08 09:56:03 +07:00

35 lines
1.0 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());
}