TU19: merge Minecraft.World/Commands

This commit is contained in:
Tropical
2026-03-21 15:14:17 -05:00
parent 36ca1d912e
commit db0a6b2e6a
29 changed files with 1236 additions and 78 deletions

View File

@@ -1,5 +1,6 @@
#include "../Platform/stdafx.h"
#include "../Headers/net.minecraft.commands.h"
#include "../Headers/net.minecraft.world.entity.item.h"
#include "../Headers/net.minecraft.world.item.h"
#include "../Headers/net.minecraft.network.packet.h"
#include "../../Minecraft.Client/Player/ServerPlayer.h"
@@ -7,6 +8,8 @@
EGameCommand GiveItemCommand::getId() { return eGameCommand_Give; }
int GiveItemCommand::getPermissionLevel() { return LEVEL_GAMEMASTERS; }
void GiveItemCommand::execute(std::shared_ptr<CommandSender> source,
byteArray commandData) {
ByteArrayInputStream bais(commandData);
@@ -24,7 +27,8 @@ void GiveItemCommand::execute(std::shared_ptr<CommandSender> source,
if (player != NULL && item > 0 && Item::items[item] != NULL) {
std::shared_ptr<ItemInstance> itemInstance =
std::shared_ptr<ItemInstance>(new ItemInstance(item, amount, aux));
player->drop(itemInstance);
std::shared_ptr<ItemEntity> drop = player->drop(itemInstance);
drop->throwTime = 0;
// logAdminAction(source, L"commands.give.success",
// ChatPacket::e_ChatCustom, Item::items[item]->getName(itemInstance),
// item, amount, player->getAName());
@@ -49,4 +53,4 @@ std::shared_ptr<GameCommandPacket> GiveItemCommand::preparePacket(
return std::shared_ptr<GameCommandPacket>(
new GameCommandPacket(eGameCommand_Give, baos.toByteArray()));
}
}