diff options
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 285 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/main.lua | 19 | ||||
m--------- | MCServer/Plugins/Core | 0 | ||||
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 52 | ||||
-rw-r--r-- | MCServer/crafting.txt | 40 | ||||
-rw-r--r-- | MCServer/items.ini | 62 |
6 files changed, 362 insertions, 96 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 321f50732..cccc05ce2 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -403,20 +403,12 @@ g_APIDesc = in the world. Note that doublechests consist of two separate cChestEntity objects, they do not collaborate in any way.</p> <p> - The chest entity can be created by the plugins only in the {{OnChunkGenerating}} and - {{OnChunkGenerated}} hooks, as part of the new chunk being generated. Plugins may generate chests - with contents in this way.</p> - <p> To manipulate a chest already in the game, you need to use {{cWorld}}'s callback mechanism with either DoWithChestAt() or ForEachChestInChunk() function. See the code example below ]], Inherits = "cBlockEntityWithItems", - Functions = - { - constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cChestEntity", Notes = "Creates a new cChestEntity object. To be used only in the chunk generating hooks {{OnChunkGenerating}} and {{OnChunkGenerated}}." }, - }, Constants = { ContentsHeight = { Notes = "Height of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" }, @@ -466,6 +458,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." }, }, GetBiome = { Params = "RelX, RelZ", Return = "EMCSBiome", Notes = "Returns the biome at the specified relative coords" }, + GetBlockEntity = { Params = "RelX, RelY, RelZ", Return = "{{cBlockEntity}} descendant", Notes = "Returns the block entity for the block at the specified coords. Creates it if it doesn't exist. Returns nil if the block has no block entity capability." }, GetBlockMeta = { Params = "RelX, RelY, RelZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" }, GetBlockType = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" }, GetBlockTypeMeta = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" }, @@ -504,7 +497,42 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Constants = { }, - }, + AdditionalInfo = + { + { + Header = "Manipulating block entities", + Contents = [[ + To manipulate block entities while the chunk is generated, first use SetBlockTypeMeta() to set + the correct block type and meta at the position. Then use the GetBlockEntity() to create and + return the correct block entity instance. Finally, use {{tolua}}.cast() to cast to the proper + type.</p> + Note that you don't need to check if a block entity has previously existed at the place, because + GetBlockEntity() will automatically re-create the correct type for you.</p> + <p> + The following code is taken from the Debuggers plugin, it creates a sign at each chunk's [0, 0] + coords, with the text being the chunk coords: +<pre class="prettyprint lang-lua"> +function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc) + -- Get the topmost block coord: + local Height = a_ChunkDesc:GetHeight(0, 0); + + -- Create a sign there: + a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0); + local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0); + if (BlockEntity ~= nil) then + LOG("Setting sign lines..."); + local SignEntity = tolua.cast(BlockEntity, "cSignEntity"); + SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)"); + end + + -- Update the heightmap: + a_ChunkDesc:SetHeight(0, 0, Height + 1); +end +</pre> + ]], + }, + }, -- AdditionalInfo + }, -- cChunkDesc cClientHandle = { @@ -642,40 +670,31 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), cDispenserEntity = { - Desc = [[This class represents a dispenser block entity in the world. Most of this block entity's functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior common with a {{cDropperEntity|dropper}} entity. -</p> - <p>An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks). -]], - Functions = - { - constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cDispenserEntity", Notes = "Creates a new cDispenserEntity at the specified coords" }, - }, - Constants = - { - }, + Desc = [[ + This class represents a dispenser block entity in the world. Most of this block entity's + functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents + the behavior common with a {{cDropperEntity|dropper}} entity. + ]], Inherits = "cDropSpenserEntity", }, cDropperEntity = { - Desc = [[This class represents a dropper block entity in the world. Most of this block entity's functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior common with the {{cDispenserEntity|dispenser}} entity. -</p> - <p>An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks). -]], - Functions = - { - constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cDropperEntity", Notes = "Creates a new cDropperEntity at the specified coords" }, - }, - Constants = - { - }, + Desc = [[ + This class represents a dropper block entity in the world. Most of this block entity's functionality + is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior + common with the {{cDispenserEntity|dispenser}} entity.</p> + <p> + An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks). + ]], Inherits = "cDropSpenserEntity", - }, + }, -- cDropperEntity cDropSpenserEntity = { - Desc = [[This is a class that implements behavior common to both {{cDispenserEntity|dispensers}} and {{cDropperEntity|droppers}}. -]], + Desc = [[ + This is a class that implements behavior common to both {{cDispenserEntity|dispensers}} and {{cDropperEntity|droppers}}. + ]], Functions = { Activate = { Params = "", Return = "", Notes = "Sets the block entity to dropspense an item in the next tick" }, @@ -687,9 +706,8 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), ContentsWidth = { Notes = "Width (X) of the {{cItemGrid}} representing the contents" }, ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid}} representing the contents" }, }, - Inherits = "cBlockEntityWithItems"; - }, + }, -- cDropSpenserEntity cEnchantments = { @@ -738,6 +756,8 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), enchInfinity = { Notes = "" }, enchKnockback = { Notes = "" }, enchLooting = { Notes = "" }, + enchLuckOfTheSea = { Notes = "" }, + enchLure = { Notes = "" }, enchPower = { Notes = "" }, enchProjectileProtection = { Notes = "" }, enchProtection = { Notes = "" }, @@ -913,7 +933,6 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), cFile:Delete("/usr/bin/virus.exe"); </pre></p> ]], - Functions = { Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." }, @@ -925,8 +944,7 @@ cFile:Delete("/usr/bin/virus.exe"); IsFolder = { Params = "Path", Return = "bool", Notes = "Returns true if the specified path points to an existing folder." }, Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." }, }, - - }, + }, -- cFile cFireChargeEntity = { @@ -938,11 +956,11 @@ cFile:Delete("/usr/bin/virus.exe"); cFurnaceEntity = { - Desc = [[This class represents a furnace block entity in the world. An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks) -]], + Desc = [[ + This class represents a furnace block entity in the world. + ]], Functions = { - constructor = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "cFurnaceEntity", Notes = "Creates a new cFurnaceEntity at the specified coords and the specified block type / meta" }, GetCookTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current item finishes cooking, in ticks" }, GetFuelBurnTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current fuel is depleted, in ticks" }, GetFuelSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the fuel slot" }, @@ -996,14 +1014,10 @@ cFile:Delete("/usr/bin/virus.exe"); cHopperEntity = { Desc = [[ - This class represents a hopper block entity in the world.</p> - <p> - Plugins may use this class during chunk generation ({{OnChunkGenerated|HOOK_CHUNK_GENERATED}} and - {{OnChunkGenerating|HOOK_CHUNK_GENERATING}}) to add hoppers to the generated chunk. + This class represents a hopper block entity in the world. ]], Functions = { - constructor = { Params = "BlockX, BlockY, BlockZ", Return = "cHopperEntity", Notes = "Creates and returns a new hopper at the specified coords." }, GetOutputBlockPos = { Params = "BlockMeta", Return = "bool, BlockX, BlockY, BlockZ", Notes = "Returns whether the hopper is attached, and if so, the block coords of the block receiving the output items, based on the given meta." }, }, Constants = @@ -1255,6 +1269,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, DamageItem = { Params = "[Amount]", Return = "bool", Notes = "Adds the specified damage. Returns true when damage reaches max value and the item should be destroyed (but doesn't destroy the item)" }, Empty = { Params = "", Return = "", Notes = "Resets the instance to an empty item" }, GetMaxDamage = { Params = "", Return = "number", Notes = "Returns the maximum value for damage that this item can get before breaking; zero if damage is not accounted for for this item type" }, + GetMaxStackSize = { Params = "", Return = "number", Notes = "Returns the maximum stack size for this item." }, IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" }, IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" }, IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage and enchantments)" }, @@ -1452,6 +1467,22 @@ end }, }, -- cItems + cJukeboxEntity = + { + Desc = [[ + This class represents a jukebox in the world. It can play the records, either when the + {{cPlayer|player}} uses the record on the jukebox, or when a plugin instructs it to play. + ]], + Inherits = "cBlockEntity", + Functions = + { + EjectRecord = { Params = "", Return = "", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0)" }, + GetRecord = { Params = "", Return = "number", Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records." }, + PlayRecord = { Params = "", Return = "", Notes = "Plays the currently present record. No action if there's no current record." }, + SetRecord = { Params = "number", Return = "", Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records." }, + }, + }, -- cJukeboxEntity + cLineBlockTracer = { Desc = [[Objects of this class provide an easy-to-use interface to tracing lines through individual @@ -1683,7 +1714,26 @@ a_Player:OpenWindow(Window); mtZombiePigman = { Notes = "" }, }, Inherits = "cPawn", - }, + }, -- cMonster + + cNoteEntity = + { + Desc = [[ + This class represents a note block entity in the world. It takes care of the note block's pitch, + and also can play the sound, either when the {{cPlayer|player}} right-clicks it, redstone activates + it, or upon a plugin's request.</p> + <p> + The pitch is stored as an integer between 0 and 24. + ]], + Functions = + { + GetPitch = { Params = "", Return = "number", Notes = "Returns the current pitch set for the block" }, + IncrementPitch = { Params = "", Return = "", Notes = "Adds 1 to the current pitch. Wraps around to 0 when the pitch cannot go any higher." }, + MakeSound = { Params = "", Return = "", Notes = "Plays the sound for all {{cClientHandle|clients}} near this block." }, + SetPitch = { Params = "Pitch", Return = "", Notes = "Sets a new pitch for the block." }, + }, + Inherits = "cBlockEntity", + }, -- cNoteEntity cPawn = { @@ -1852,7 +1902,7 @@ a_Player:OpenWindow(Window); <pre class="prettyprint lang-lua"> cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); </pre></p> -]], + ]], Functions = { AddHook = @@ -1872,7 +1922,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, DisablePlugin = { Params = "PluginName", Return = "bool", Notes = "Disables a plugin specified by its name. Returns true if the plugin was disabled, false if it wasn't found or wasn't active." }, ExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Executes the command as if given by the specified Player. Checks permissions. Returns true if executed." }, - ExecuteConsoleCommand = { Params = "CommandStr", Return = "bool", Notes = "Executes the command as if given on the server console. Returns true if executed." }, FindPlugins = { Params = "", Return = "", Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)" }, ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Same as ExecuteCommand, but doesn't check permissions" }, ForEachCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function(Command, Permission, HelpString)</pre>. If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." }, @@ -2000,8 +2049,8 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); GetVirtualRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of virtual RAM that the entire MCServer process is using, in KiB. Negative if the OS doesn't support this query." }, GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." }, GetWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Returns the cWorld object of the given world. It returns nil if there is no world with the given name." }, - QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread The command's output will be sent to console " .. '"stop" and "restart" commands have special handling.' }, - SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds." }, + QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread. The command's output will be sent to console." }, + SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds. Note that the saving is queued on each world's tick thread and this functions returns before the chunks are actually saved." }, SetPrimaryServerVersion = { Params = "Protocol Version", Return = "", Notes = "Sets the servers PrimaryServerVersion to the given protocol number." } }, Constants = @@ -2030,35 +2079,22 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); Constants = { }, - }, + }, -- cServer cSignEntity = { Desc = [[ A sign entity represents a sign in the world. This class is only used when generating chunks, so - that the plugins may generate signs within new chunks. + that the plugins may generate signs within new chunks. See the code example in {{cChunkDesc}}. ]], Functions = { + GetLine = { Params = "LineIndex", Return = "string", Notes = "Returns the specified line. LineIndex is expected between 0 and 3. Returns empty string and logs to server console when LineIndex is invalid." }, + SetLine = { Params = "LineIndex, LineText", Return = "", Notes = "Sets the specified line. LineIndex is expected between 0 and 3. Logs to server console when LineIndex is invalid." }, + SetLines = { Params = "Line1, Line2, Line3, Line4", Return = "", Notes = "Sets all the sign's lines at once." }, }, - Constants = - { - }, - Inherits = "cBlockEntity"; - }, - - cStringMap = - { - Desc = [[cStringMap is an object that maps strings with strings, it's also known as a dictionary -]], - Functions = - { - }, - Constants = - { - }, - }, + }, -- cSignEntity cThrownEggEntity = { @@ -2238,7 +2274,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, GetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the block skylight of the block at the specified coords, or 0 if the appropriate chunk is not loaded." }, GetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ", Return = "BlockValid, BlockType, BlockMeta", Notes = "Returns the block type and metadata for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true." }, - GetClassStatic = { Params = "", Return = "string", Notes = "Returns the name of the class, \"cWorld\"." }, GetDimension = { Params = "", Return = "eDimension", Notes = "Returns the dimension of the world - dimOverworld, dimNether or dimEnd." }, GetGameMode = { Params = "", Return = "eGameMode", Notes = "Returns the gamemode of the world - gmSurvival, gmCreative or gmAdventure." }, GetGeneratorQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks that are queued in the chunk generator." }, @@ -2443,6 +2478,112 @@ end }, }, -- ItemCategory + lxp = + { + Desc = [[ + This class provides an interface to the XML parser, + {{http://matthewwild.co.uk/projects/luaexpat/|LuaExpat}}. It provides a SAX interface with an + incremental XML parser.</p> + <p> + With an event-based API like SAX the XML document can be fed to the parser in chunks, and the + parsing begins as soon as the parser receives the first document chunk. LuaExpat reports parsing + events (such as the start and end of elements) directly to the application through callbacks. The + parsing of huge documents can benefit from this piecemeal operation.</p> + <p> + See the online + {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}} for details + on how to work with this parser. The code examples below should provide some basic help, too. + ]], + Functions = + { + new = {Params = "CallbacksTable, [SeparatorChar]", Return = "XMLParser object", Notes = "Creates a new XML parser object, with the specified callbacks table and optional separator character."}, + }, + Constants = + { + _COPYRIGHT = { Notes = "" }, + _DESCRIPTION = { Notes = "" }, + _VERSION = { Notes = "" }, + }, + AdditionalInfo = + { + { + Header = "Parser callbacks", + Contents = [[ + The callbacks table passed to the new() function specifies the Lua functions that the parser + calls upon various events. The following table lists the most common functions used, for a + complete list see the online + {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}}.</p> + <table> + <tr><th>Function name</th><th>Parameters</th><th>Notes</th></tr> + <tr><td>CharacterData</td><td>Parser, string</td><td>Called when the parser recognizes a raw string inside the element</td></tr> + <tr><td>EndElement</td><td>Parser, ElementName</td><td>Called when the parser detects the ending of an XML element</td></tr> + <tr><td>StartElement</td><td>Parser, ElementName, AttributesTable</td><td>Called when the parser detects the start of an XML element. The AttributesTable is a Lua table containing all the element's attributes, both in the array section (in the order received) and in the dictionary section.</td></tr> + </table> + ]], + }, + { + Header = "XMLParser object", + Contents = [[ + The XMLParser object returned by lxp.new provides the functions needed to parse the XML. The + following list provides the most commonly used ones, for a complete list see the online + {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}}. + <ul> + <li>close() - closes the parser, freeing all memory used by it.</li> + <li>getCallbacks() - returns the callbacks table for this parser.</li> + <li>parse(string) - parses more document data. the string contains the next part (or possibly all) of the document. Returns non-nil for success or nil, msg, line, col, pos for error.</li> + <li>stop() - aborts parsing (can be called from within the parser callbacks).</li> + </ul> + ]], + }, + { + Header = "Code example", + Contents = [[ + The following code reads an entire XML file and outputs its logical structure into the console: +<pre class="prettyprint lang-lua"> +local Depth = 0; + +-- Define the callbacks: +local Callbacks = { + CharacterData = function(a_Parser, a_String) + LOG(string.rep(" ", Depth) .. "* " .. a_String); + end + + EndElement = function(a_Parser, a_ElementName) + Depth = Depth - 1; + LOG(string.rep(" ", Depth) .. "- " .. a_ElementName); + end + + StartElement = function(a_Parser, a_ElementName, a_Attribs) + LOG(string.rep(" ", Depth) .. "+ " .. a_ElementName); + Depth = Depth + 1; + end +} + +-- Create the parser: +local Parser = lxp.new(Callbacks); + +-- Parse the XML file: +local f = io.open("file.xml", "rb"); +while (true) do + local block = f:read(128 * 1024); -- Use a 128KiB buffer for reading + if (block == nil) then + -- End of file + break; + end + Parser:parse(block); +end + +-- Signalize to the parser that no more data is coming +Parser:parse(); + +-- Close the parser: +Parser:close(); +</pre> + ]], + }, + }, -- AdditionalInfo + }, -- lxp + TakeDamageInfo = { Desc = [[ diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index d84926b53..ab154dc45 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -373,13 +373,18 @@ function ReadDescriptions(a_API) return false; end - -- Returns true if the function (specified by its fully qualified name) is to be ignored - local function IsFunctionIgnored(a_FnName) + -- Returns true if the function is to be ignored + local function IsFunctionIgnored(a_ClassName, a_FnName) if (g_APIDesc.IgnoreFunctions == nil) then return false; end + if (((g_APIDesc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then + -- The function is documented, don't ignore + return false; + end + local FnName = a_ClassName .. "." .. a_FnName; for i, name in ipairs(g_APIDesc.IgnoreFunctions) do - if (a_FnName:match(name)) then + if (FnName:match(name)) then return true; end end @@ -482,7 +487,7 @@ function ReadDescriptions(a_API) if (FnDesc == nil) then -- No description for this API function AddFunction(func.Name); - if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then + if not(IsFunctionIgnored(cls.Name, FnName)) then table.insert(cls.UndocumentedFunctions, FnName); end else @@ -505,7 +510,7 @@ function ReadDescriptions(a_API) else -- if (APIDesc.Functions ~= nil) for j, func in ipairs(cls.Functions) do local FnName = func.DocID or func.Name; - if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then + if not(IsFunctionIgnored(cls.Name, FnName)) then table.insert(cls.UndocumentedFunctions, FnName); end end @@ -567,7 +572,7 @@ function ReadDescriptions(a_API) g_Stats.NumUndocumentedClasses = g_Stats.NumUndocumentedClasses + 1; for j, func in ipairs(cls.Functions) do local FnName = func.DocID or func.Name; - if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then + if not(IsFunctionIgnored(cls.Name, FnName)) then table.insert(cls.UndocumentedFunctions, FnName); end end -- for j, func - cls.Functions[] @@ -586,7 +591,7 @@ function ReadDescriptions(a_API) -- Remove ignored functions: local NewFunctions = {}; for j, fn in ipairs(cls.Functions) do - if (not(IsFunctionIgnored(cls.Name .. "." .. fn.Name))) then + if (not(IsFunctionIgnored(cls.Name, fn.Name))) then table.insert(NewFunctions, fn); end end -- for j, fn diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core -Subproject de53a607f30c583e08c06b6e5eb936cd278ab8c +Subproject 9ec55bcdcaf8b3eea8e98e3e502890295dda14d diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 04a15a002..9350606cc 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -26,6 +26,7 @@ function Initialize(Plugin) cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat); cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity); cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); PluginManager = cRoot:Get():GetPluginManager(); PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); @@ -44,6 +45,8 @@ function Initialize(Plugin) PluginManager:BindCommand("/fs", "debuggers", HandleFoodStatsCmd, "- Turns regular foodstats message on or off"); PluginManager:BindCommand("/arr", "debuggers", HandleArrowCmd, "- Creates an arrow going away from the player"); PluginManager:BindCommand("/fb", "debuggers", HandleFireballCmd, "- Creates a ghast fireball as if shot by the player"); + PluginManager:BindCommand("/xpa", "debuggers", HandleAddExperience, "- Adds 200 experience to the player"); + PluginManager:BindCommand("/xpr", "debuggers", HandleRemoveXp, "- Remove all xp"); -- Enable the following line for BlockArea / Generator interface testing: -- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED); @@ -499,32 +502,38 @@ end -function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc) - -- Test ChunkDesc / BlockArea interaction - local BlockArea = cBlockArea(); - ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15); - - -- BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic"); - - ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5); - return false; +function OnChat(a_Player, a_Message) + return false, "blabla " .. a_Message; end -function OnChat(a_Player, a_Message) - return false, "blabla " .. a_Message; +function OnPlayerRightClickingEntity(a_Player, a_Entity) + LOG("Player " .. a_Player:GetName() .. " right-clicking entity ID " .. a_Entity:GetUniqueID() .. ", a " .. a_Entity:GetClass()); + return false; end -function OnPlayerRightClickingEntity(a_Player, a_Entity) - LOG("Player " .. a_Player:GetName() .. " right-clicking entity ID " .. a_Entity:GetUniqueID() .. ", a " .. a_Entity:GetClass()); - return false; +function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc) + -- Get the topmost block coord: + local Height = a_ChunkDesc:GetHeight(0, 0); + + -- Create a sign there: + a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0); + local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0); + if (BlockEntity ~= nil) then + LOG("Setting sign lines..."); + local SignEntity = tolua.cast(BlockEntity, "cSignEntity"); + SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)"); + end + + -- Update the heightmap: + a_ChunkDesc:SetHeight(0, 0, Height + 1); end @@ -839,3 +848,18 @@ end +function HandleAddExperience(a_Split, a_Player) + a_Player:DeltaExperience(200); + + return true; +end + + + + + +function HandleRemoveXp(a_Split, a_Player) + a_Player:SetCurrentExperience(0); + + return true; +end diff --git a/MCServer/crafting.txt b/MCServer/crafting.txt index 5132bf436..fe9a465d0 100644 --- a/MCServer/crafting.txt +++ b/MCServer/crafting.txt @@ -1,4 +1,3 @@ - # This file describes the crafting recipes that MCServer knows. # The syntax is as follows: # <Line> = <Recipe>#<Comment> @@ -380,8 +379,45 @@ GreenWool = Wool, * | GreenDye, * RedWool = Wool, * | RedDye, * BlackWool = Wool, * | BlackDye, * +#******************************************************# +# Stained Glass: +# +WhiteStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | BoneMeal, 2:2 +OrangeStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | OrangeDye, 2:2 +MagentaStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | MagentaDye, 2:2 +LightBlueStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | LightBlueDye, 2:2 +YellowStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | YellowDye, 2:2 +LimeStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | LimeDye, 2:2 +PinkStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | PinkDye, 2:2 +GrayStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | GrayDye, 2:2 +LightGrayStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | LightGrayDye, 2:2 +CyanStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | CyanDye, 2:2 +VioletStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | VioletDye, 2:2 +BlueStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | BlueDye, 2:2 +BrownStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | BrownDye, 2:2 +GreenStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | GreenDye, 2:2 +RedStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | RedDye, 2:2 +BlackStainedGlass, 8 = Glass, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | BlackDye, 2:2 - +#******************************************************# +# Stained Glass Pane: +# +WhiteStainedGlassPane, 16 = WhiteStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +OrangeStainedGlassPane, 16 = OrangeStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +MagentaStainedGlassPane, 16 = MagentaStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +LightBlueStainedGlassPane, 16 = LightBlueStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +YellowStainedGlassPane, 16 = YellowStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +LimeStainedGlassPane, 16 = LimeStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +PinkStainedGlassPane, 16 = PinkStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +GrayStainedGlassPane, 16 = GrayStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +LightGrayStainedGlassPane, 16 = LightGrayStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +CyanStainedGlassPane, 16 = CyanStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +VioletStainedGlassPane, 16 = VioletStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +BlueStainedGlassPane, 16 = BlueStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +BrownStainedGlassPane, 16 = BrownStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +GreenStainedGlassPane, 16 = GreenStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +RedStainedGlassPane, 16 = RedStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 +BlackStainedGlassPane , 16 = BlackStainedGlass, 1:2, 1:3, 2:2, 2:3, 3:2, 3:3 #******************************************************# diff --git a/MCServer/items.ini b/MCServer/items.ini index c4e2466d8..812168297 100644 --- a/MCServer/items.ini +++ b/MCServer/items.ini @@ -117,7 +117,11 @@ darkgreenwool=35:13 dkgreenwool=35:13 redwool=35:14 blackwool=35:15 +dandelion=37 + +; Obsolete, use "dandelion" instead (kept for compatibility, will be removed) flower=37 + rose=38 brownmushroom=39 redmushroom=40 @@ -208,7 +212,22 @@ portal=90 jackolantern=91 jacko=91 cakeblock=92 -lockedchest=95 +whitestainedglass=95 +orangestainedglass=95:1 +magentastainedglass=95:2 +lightbluestainedglass=95:3 +yellowstainedglass=95:4 +limestainedglass=95:5 +pinkstainedglass=95:6 +graystainedglass=95:7 +lightgraystainedglass=95:8 +cyanstainedglass=95:9 +violetstainedglass=95:10 +bluestainedglass=95:11 +brownstainedglass=95:12 +greenstainedglass=95:13 +redstainedglass=95:14 +blackstainedglass=95:15 trapdoor=96 silverfishblock=97 stonebricks=98 @@ -281,6 +300,42 @@ pillarquartzblock=155:2 quartzstairs=156 activatorrail=157 dropper=158 +whitestainedclay=159 +orangestainedclay=159:1 +magentastainedclay=159:2 +lightbluestainedclay=159:3 +yellowstainedclay=159:4 +limestainedclay=159:5 +pinkstainedclay=159:6 +graystainedclay=159:7 +lightgraystainedclay=159:8 +cyanstainedclay=159:9 +violetstainedclay=159:10 +bluestainedclay=159:11 +brownstainedclay=159:12 +greenstainedclay=159:13 +redstainedclay=159:14 +blackstainedclay=159:15 +whitestainedglasspane=160 +orangestainedglasspane=160:1 +magentastainedglasspane=160:2 +lightbluestainedglasspane=160:3 +yellowstainedglasspane=160:4 +limestainedglasspane=160:5 +pinkstainedglasspane=160:6 +graystainedglasspane=160:7 +lightgraystainedglasspane=160:8 +cyanstainedglasspane=160:9 +violetstainedglasspane=160:10 +bluestainedglasspane=160:11 +brownstainedglasspane=160:12 +greenstainedglasspane=160:13 +redstainedglasspane=160:14 +blackstainedglasspane=160:15 +acaciawood=162 +darkoakwood=162:1 +acaciawoodenstairs=163 +darkoakwoodenstairs=164 haybale=170 carpet=171 ironshovel=256 @@ -530,7 +585,12 @@ netherbrickitem=405 netherquartz=406 tntminecart=407 hopperminecart=408 +ironhorsearmor=417 +goldhorsearmor=418 +diamondhorsearmor=419 lead=420 +nametag=421 +commandblockminecart=422 goldrecord=2256 greenrecord=2257 |