12 #include "../Defines.h"
36 virtual bool Load(
void) = 0;
43 virtual void Tick(
float a_Dt) = 0;
59 virtual bool OnEntityAddEffect (
cEntity & a_Entity,
int a_EffectType,
int a_EffectDurationTicks,
int a_EffectIntensity,
double a_DistanceModifier) = 0;
64 virtual bool OnExploded (
cWorld & a_World,
double a_ExplosionSize,
bool a_CanCauseFire,
double a_X,
double a_Y,
double a_Z,
eExplosionSource a_Source,
void * a_SourceData) = 0;
65 virtual bool OnExploding (
cWorld & a_World,
double & a_ExplosionSize,
bool & a_CanCauseFire,
double a_X,
double a_Y,
double a_Z,
eExplosionSource a_Source,
void * a_SourceData) = 0;
115 virtual bool OnWorldTick (
cWorld & a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec) = 0;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
eExplosionSource
The source of an explosion.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
std::basic_string_view< std::byte > ContiguousByteBufferView
std::vector< AString > AStringVector
std::map< AString, AString > AStringMap
A string dictionary, used for key-value pairs.
virtual bool OnPostCrafting(cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe)=0
virtual bool OnSpawningMonster(cWorld &a_World, cMonster &a_Monster)=0
AString m_Name
The name of the plugin, used to identify the plugin in the system and for inter-plugin calls.
AString m_FolderName
Name of the folder (in the Plugins folder) from which the plugin is loaded.
virtual bool OnEntityAddEffect(cEntity &a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier)=0
virtual bool OnPlayerBreakingBlock(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
virtual bool OnPlayerPlacedBlock(cPlayer &a_Player, const sSetBlock &a_BlockChange)=0
virtual bool OnPlayerEating(cPlayer &a_Player)=0
virtual bool OnPlayerFishing(cPlayer &a_Player, cItems &a_Reward, int &ExperienceAmount)=0
virtual bool OnWorldStarted(cWorld &a_World)=0
virtual bool OnPlayerFished(cPlayer &a_Player, const cItems &a_Reward, const int ExperienceAmount)=0
virtual bool OnEntityTeleport(cEntity &a_Entity, const Vector3d &a_OldPosition, const Vector3d &a_NewPosition)=0
AString GetLocalFolder(void) const
Returns the folder relative to the MCS Executable, from which the plugin is loaded.
virtual bool OnPlayerBrokenBlock(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
virtual bool OnChunkUnloading(cWorld &a_World, int a_ChunkX, int a_ChunkZ)=0
const AString & GetLoadError(void) const
Returns the error encountered while loading the plugin.
virtual bool OnChunkGenerating(cWorld &a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc *a_ChunkDesc)=0
virtual bool OnEntityChangingWorld(cEntity &a_Entity, cWorld &a_World)=0
virtual bool OnPlayerUsingItem(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)=0
virtual bool OnBrewingCompleting(cWorld &a_World, cBrewingstandEntity &a_BrewingstandEntity)=0
virtual bool OnServerPing(cClientHandle &a_ClientHandle, AString &a_ServerDescription, int &a_OnlinePlayersCount, int &a_MaxPlayersCount, AString &a_Favicon)=0
virtual bool OnProjectileHitBlock(cProjectileEntity &a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d &a_BlockHitPos)=0
void SetVersion(int a_Version)
virtual bool OnPlayerUsedItem(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)=0
virtual bool OnPlayerCrouched(cPlayer &a_Player)=0
virtual void OnDisable(void)
Called as the last call into the plugin before it is unloaded.
virtual bool OnUpdatedSign(cWorld &a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4, cPlayer *a_Player)=0
AString m_LoadError
The error encountered while loading the plugin.
virtual bool OnExploding(cWorld &a_World, double &a_ExplosionSize, bool &a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void *a_SourceData)=0
const AString & GetName(void) const
cPlugin(const AString &a_FolderName)
Creates a new instance.
virtual bool OnCollectingPickup(cPlayer &a_Player, cPickup &a_Pickup)=0
virtual bool OnEntityChangedWorld(cEntity &a_Entity, cWorld &a_World)=0
virtual bool OnPlayerSpawned(cPlayer &a_Player)=0
int GetVersion(void) const
cPluginManager::ePluginStatus m_Status
virtual bool OnSpawningEntity(cWorld &a_World, cEntity &a_Entity)=0
virtual bool OnSpawnedEntity(cWorld &a_World, cEntity &a_Entity)=0
virtual bool OnPlayerOpeningWindow(cPlayer &a_Player, cWindow &a_Window)=0
virtual bool OnHopperPullingItem(cWorld &a_World, cHopperEntity &a_Hopper, int a_DstSlotNum, cBlockEntityWithItems &a_SrcEntity, int a_SrcSlotNum)=0
virtual bool OnExecuteCommand(cPlayer *a_Player, const AStringVector &a_Split, const AString &a_EntireCommand, cPluginManager::CommandResult &a_Result)=0
virtual void Unload(void)
Unloads the plugin.
virtual bool OnPluginsLoaded(void)=0
virtual bool OnWorldTick(cWorld &a_World, std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec)=0
virtual bool OnPluginMessage(cClientHandle &a_Client, const AString &a_Channel, ContiguousByteBufferView a_Message)=0
virtual bool OnChunkGenerated(cWorld &a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc *a_ChunkDesc)=0
const AString & GetFolderName(void) const
Returns the name of the folder (in the Plugins folder) from which the plugin is loaded.
virtual bool OnPlayerAnimation(cPlayer &a_Player, int a_Animation)=0
virtual bool OnBlockSpread(cWorld &a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source)=0
Calls the specified hook with the params given.
virtual bool OnPlayerRightClickingEntity(cPlayer &a_Player, cEntity &a_Entity)=0
virtual bool OnCraftingNoRecipe(cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe)=0
virtual bool OnTakeDamage(cEntity &a_Receiver, TakeDamageInfo &a_TakeDamageInfo)=0
virtual bool OnPlayerPlacingBlock(cPlayer &a_Player, const sSetBlock &a_BlockChange)=0
virtual bool Load(void)=0
Loads and initializes the plugin.
virtual bool OnPlayerUsingBlock(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
virtual bool OnKilled(cEntity &a_Victim, TakeDamageInfo &a_TDI, AString &a_DeathMessage)=0
static const char * GetClassStatic(void)
virtual bool OnBrewingCompleted(cWorld &a_World, cBrewingstandEntity &a_BrewingstandEntity)=0
virtual bool OnDropSpense(cWorld &a_World, cDropSpenserEntity &a_DropSpenser, int a_SlotNum)=0
void SetName(const AString &a_Name)
virtual bool OnPlayerMoving(cPlayer &a_Player, const Vector3d &a_OldPosition, const Vector3d &a_NewPosition, bool a_PreviousIsOnGround)=0
virtual bool OnKilling(cEntity &a_Victim, cEntity *a_Killer, TakeDamageInfo &a_TDI)=0
virtual bool OnPlayerRightClick(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)=0
virtual bool OnLogin(cClientHandle &a_Client, UInt32 a_ProtocolVersion, const AString &a_Username)=0
virtual bool OnPlayerDestroyed(cPlayer &a_Player)=0
virtual bool OnPlayerLeftClick(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, char a_Status)=0
virtual bool OnHandshake(cClientHandle &a_Client, const AString &a_Username)=0
virtual bool OnProjectileHitEntity(cProjectileEntity &a_Projectile, cEntity &a_HitEntity)=0
virtual bool OnPlayerTossingItem(cPlayer &a_Player)=0
virtual bool OnLoginForge(cClientHandle &a_Client, const AStringMap &a_Mods)=0
virtual bool OnExploded(cWorld &a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void *a_SourceData)=0
virtual bool OnWeatherChanged(cWorld &a_World)=0
virtual bool OnPlayerJoined(cPlayer &a_Player)=0
virtual bool OnChat(cPlayer &a_Player, AString &a_Message)=0
cPluginManager::ePluginStatus GetStatus(void) const
virtual bool OnDisconnect(cClientHandle &a_Client, const AString &a_Reason)=0
virtual bool OnWeatherChanging(cWorld &a_World, eWeather &a_NewWeather)=0
virtual bool OnPlayerUsedBlock(cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
virtual bool OnPreCrafting(cPlayer &a_Player, cCraftingGrid &a_Grid, cCraftingRecipe &a_Recipe)=0
virtual bool OnUpdatingSign(cWorld &a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString &a_Line1, AString &a_Line2, AString &a_Line3, AString &a_Line4, cPlayer *a_Player)=0
virtual void Tick(float a_Dt)=0
virtual bool OnHopperPushingItem(cWorld &a_World, cHopperEntity &a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems &a_DstEntity, int a_DstSlotNum)=0
virtual bool OnChunkAvailable(cWorld &a_World, int a_ChunkX, int a_ChunkZ)=0
void SetLoadError(const AString &a_LoadError)
Sets m_LoadError to the specified string and m_Status to psError.
virtual bool OnSpawnedMonster(cWorld &a_World, cMonster &a_Monster)=0
bool IsLoaded(void) const
virtual bool OnPlayerShooting(cPlayer &a_Player)=0
virtual bool OnChunkUnloaded(cWorld &a_World, int a_ChunkX, int a_ChunkZ)=0
virtual bool OnBlockToPickups(cWorld &a_World, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cBlockEntity *a_BlockEntity, const cEntity *a_Digger, const cItem *a_Tool, cItems &a_Pickups)=0
virtual bool OnPlayerFoodLevelChange(cPlayer &a_Player, int a_NewFoodLevel)=0
ePluginStatus
Defines the status of a single plugin - whether it is loaded, disabled or errored.
@ psLoaded
The plugin has been loaded successfully.
This class bridges a vector of cItem for safe access via Lua.