From 57690b81a24a29d70cb6f4196a6e0f521a3cb61b Mon Sep 17 00:00:00 2001 From: changyong guo Date: Thu, 2 Aug 2018 22:59:10 +0800 Subject: Experience orb (#4259) * Replace cWorld::FindClosesPlayer with cWorld::DoWithClosestPlayer * Implement experience reward splitting into the orb sizes used in vanilla * Modified speed calculation in cExpOrb::Tick to make the orbs fly towards the player Fixes #4216 --- Server/Plugins/APIDump/Classes/World.lua | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'Server/Plugins') diff --git a/Server/Plugins/APIDump/Classes/World.lua b/Server/Plugins/APIDump/Classes/World.lua index bb991d9e6..8c19a44ef 100644 --- a/Server/Plugins/APIDump/Classes/World.lua +++ b/Server/Plugins/APIDump/Classes/World.lua @@ -968,6 +968,39 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, Notes = "If there is a mob head at the specified coords, calls the CallbackFunction with the {{cMobHeadEntity}} parameter representing the furnace. The CallbackFunction has the following signature:
function Callback({{cMobHeadEntity|MobHeadEntity}})
The function returns false if there is no mob head, or if there is, it returns the bool value that the callback has returned.", }, + DoWithNearestPlayer = + { + Params = + { + { + Name = "Position", + Type = "Vector3d", + }, + { + Name = "RangeLimit", + Type = "number", + }, + { + Name = "CallbackFunction", + Type = "function", + }, + { + Name = "CheckLineOfSight", + Type = "boolean", + }, + { + Name = "IgnoreSpectator", + Type = "boolean", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Calls the specified callback function with the {{cPlayer|player}} nearest to the specified position as its parameter, if they are still within the range limit. The CallbackFunction has the following signature:
function Callback({{cPlayer|Player}})
The function returns false if the player was not found, or whatever bool value the callback returned if the player was found.", + }, DoWithNoteBlockAt = { Params = @@ -3473,6 +3506,28 @@ function OnAllChunksAvailable() All return values from the callbacks are i Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value. Returns the EntityID of the new spawned primed tnt, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no primed tnt was created. (DEPRECATED, use vector-parametered version)", }, }, + SpawnSplitExperienceOrbs = + { + Params = + { + { + Name = "Position", + Type = "Vector3d", + }, + { + Name = "Reward", + Type = "number", + }, + }, + Returns = + { + { + Name = "EntityID", + Type = "table", + }, + }, + Notes = "Spawns experience orbs of the specified total value at the given location. The orbs' values are split according to regular Minecraft rules. Returns an array-table of UniqueID of all the orbs.", + }, TryGetHeight = { Params = -- cgit v1.2.3