aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/CommandBlockEntity.h
blob: 3a3c10b671d8e60ccb64509a4b4cf115d2eb8a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "TileEntity.h"
#include "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 shared_ptr<TileEntity> clone();

private:
	int successCount;
	wstring command;
	wstring name;

public:
	CommandBlockEntity();

	void setCommand(const wstring &command);
	wstring getCommand();
	int performCommand(Level *level);
	wstring getName();
	void setName(const wstring &name);
	virtual void sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type = ChatPacket::e_ChatCustom, int customData = -1, const wstring& additionalMessage = L"");
	virtual bool hasPermission(EGameCommand command);
	//void sendMessage(ChatMessageComponent *message);
	//bool hasPermission(int permissionLevel, const wstring &commandName);
	void save(CompoundTag *tag);
	void load(CompoundTag *tag);
	Pos *getCommandSenderWorldPosition();
	Level *getCommandSenderWorld();
	shared_ptr<Packet> getUpdatePacket();
	int getSuccessCount();
	void setSuccessCount(int successCount);
};