4jcraft/Minecraft.World/Blocks/TileEntities/CommandBlockEntity.h
2026-03-21 15:52:50 -05:00

43 lines
1.3 KiB
C++

#pragma once
#include "TileEntity.h"
#include "../../Commands/CommandSender.h"
class ChatMessageComponent;
class CommandBlockEntity : public TileEntity, public CommandSender {
public:
eINSTANCEOF GetType() { return eTYPE_COMMANDBLOCKTILEENTITY; }
static TileEntity* create() { return new CommandBlockEntity(); }
// 4J Added
virtual std::shared_ptr<TileEntity> clone();
private:
int successCount;
std::wstring command;
std::wstring name;
public:
CommandBlockEntity();
void setCommand(const std::wstring& command);
std::wstring getCommand();
int performCommand(Level* level);
std::wstring getName();
void setName(const std::wstring& name);
virtual void sendMessage(
const std::wstring& message,
ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom,
int customData = -1, const std::wstring& additionalMessage = L"");
virtual bool hasPermission(EGameCommand command);
// void sendMessage(ChatMessageComponent *message);
// bool hasPermission(int permissionLevel, const std::wstring &commandName);
void save(CompoundTag* tag);
void load(CompoundTag* tag);
Pos* getCommandSenderWorldPosition();
Level* getCommandSenderWorld();
std::shared_ptr<Packet> getUpdatePacket();
int getSuccessCount();
void setSuccessCount(int successCount);
};