summaryrefslogtreecommitdiffstats
path: root/Server
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
commit1bc145ff44bee52d3b71812cc06ffe214f4ac216 (patch)
tree7ea9f3b0029bbf5041c2f05c7d3f3e156c3e6186 /Server
parentMerge pull request #2595 from cengizIO/master (diff)
parentImplemented brewing (diff)
downloadcuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.gz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.bz2
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.lz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.xz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.zst
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua3
-rw-r--r--Server/Plugins/APIDump/Classes/BlockEntities.lua41
-rw-r--r--Server/Plugins/APIDump/Classes/Plugins.lua2
-rw-r--r--Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua26
-rw-r--r--Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua28
-rw-r--r--Server/brewing.txt235
6 files changed, 335 insertions, 0 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 33d351104..02ce1f894 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -2067,6 +2067,7 @@ a_Player:OpenWindow(Window);
ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" },
Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." },
+ GetBrewingRecipe = { Params = "{{cItem|cItem}}, {{cItem|cItem}}", Return = "{{cItem|cItem}}", Notes = "(STATIC) Returns the result item, if a recipe has been found. If no recipe is found, returns no value." },
GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: &lt;CommitHash&gt;\"." },
GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: &lt;DateTime-iso8601&gt;\"." },
GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." },
@@ -2333,6 +2334,7 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress")
DigBlock = { Params = "X, Y, Z", Return = "", Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors." },
DoExplosionAt = { Params = "Force, X, Y, Z, CanCauseFire, Source, SourceData", Return = "", Notes = "Creates an explosion of the specified relative force in the specified position. If CanCauseFire is set, the explosion will set blocks on fire, too. The Source parameter specifies the source of the explosion, one of the esXXX constants. The SourceData parameter is specific to each source type, usually it provides more info about the source." },
DoWithBlockEntityAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a block entity at the specified coords, calls the CallbackFunction with the {{cBlockEntity}} parameter representing the block entity. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The function returns false if there is no block entity, or if there is, it returns the bool value that the callback has returned. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
+ DoWithBrewingstandAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a brewingstand at the specified coords, calls the CallbackFunction with the {{cBrewingstandEntity}} parameter representing the brewingstand. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBrewingstandEntity|cBrewingstandEntity}})</pre> The function returns false if there is no brewingstand, or if there is, it returns the bool value that the callback has returned." },
DoWithBeaconAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a beacon at the specified coords, calls the CallbackFunction with the {{cBeaconEntity}} parameter representing the beacon. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBeaconEntity|BeaconEntity}})</pre> The function returns false if there is no beacon, or if there is, it returns the bool value that the callback has returned." },
DoWithChestAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a chest at the specified coords, calls the CallbackFunction with the {{cChestEntity}} parameter representing the chest. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The function returns false if there is no chest, or if there is, it returns the bool value that the callback has returned." },
DoWithCommandBlockAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a command block at the specified coords, calls the CallbackFunction with the {{cCommandBlockEntity}} parameter representing the command block. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cCommandBlockEntity|CommandBlockEntity}})</pre> The function returns false if there is no command block, or if there is, it returns the bool value that the callback has returned." },
@@ -2353,6 +2355,7 @@ local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress")
},
FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
+ ForEachBrewingstandInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each brewingstand in the chunk. Returns true if all brewingstands in the chunk have been processed (including when there are zero brewingstands), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBrewingstandEntity|cBrewingstandEntity}})</pre> The callback should return false or no value to continue with the next brewingstand, or true to abort the enumeration." },
ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." },
ForEachEntity = { Params = "CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
diff --git a/Server/Plugins/APIDump/Classes/BlockEntities.lua b/Server/Plugins/APIDump/Classes/BlockEntities.lua
index daa658654..019e702eb 100644
--- a/Server/Plugins/APIDump/Classes/BlockEntities.lua
+++ b/Server/Plugins/APIDump/Classes/BlockEntities.lua
@@ -76,6 +76,47 @@ return
},
},
+ cBrewingstandEntity =
+ {
+ Desc = [[
+ This class represents a brewingstand entity in the world.</p>
+ <p>
+ See also the {{cRoot}}:GetBrewingRecipe() function.
+ ]],
+ Functions =
+ {
+ GetBrewingTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current items finishes brewing, in ticks" },
+ GetTimeBrewed = { Params = "", Return = "number", Notes = "Returns the time that the current items has been brewing, in ticks" },
+ GetLeftBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the left bottle slot" },
+ GetMiddleBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the middle bottle slot" },
+ GetRightBottleSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the right bottle slot" },
+ GetIndgredientSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the ingredient slot" },
+ GetResultItem = { Params = "number", Return = "{{cItem|cItem}}", Notes = "Returns the expected result item for the given slot number." },
+ SetLeftBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the left bottle slot" },
+ SetMiddleBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the middle bottle slot" },
+ SetRightBottleSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the right bottle slot" },
+ SetIngredientSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the ingredient bottle slot" },
+ },
+ Constants =
+ {
+ bsLeftBottle = { Notes = "Index of the left bottle slot" },
+ bsMiddleBottle = { Notes = "Index of the middle bottle slot" },
+ bsRightBottle = { Notes = "Index of the right bottle slot" },
+ bsIngredient = { Notes = "Index of the ingredient slot" },
+ ContentsWidth = { Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents" },
+ ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents" },
+ },
+ ConstantGroups =
+ {
+ SlotIndices =
+ {
+ Include = "bs.*",
+ TextBefore = "When using the GetSlot() or SetSlot() function, use these constants for slot index:",
+ },
+ },
+ Inherits = "cBlockEntityWithItems"
+ }, -- cBrewingstandEntity
+
cChestEntity =
{
Desc = [[
diff --git a/Server/Plugins/APIDump/Classes/Plugins.lua b/Server/Plugins/APIDump/Classes/Plugins.lua
index f892ad8f6..758598242 100644
--- a/Server/Plugins/APIDump/Classes/Plugins.lua
+++ b/Server/Plugins/APIDump/Classes/Plugins.lua
@@ -110,6 +110,8 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
crUnknownCommand = { Notes = "When the given command doesn't exist." },
HOOK_BLOCK_SPREAD = { Notes = "Called when a block spreads based on world conditions" },
HOOK_BLOCK_TO_PICKUPS = { Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them." },
+ HOOK_BREWING_COMPLETING = { "Called before a brewing stand completes a brewing process." },
+ HOOK_BREWING_COMPLETED = { "Called when a brewing stand completed a brewing process." },
HOOK_CHAT = { Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message" },
HOOK_CHUNK_AVAILABLE = { Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}." },
HOOK_CHUNK_GENERATED = { Notes = "Called after a chunk is generated. A plugin may do last modifications on the generated chunk before it is handed of to the {{cWorld|world}}." },
diff --git a/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua b/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua
new file mode 100644
index 000000000..316227739
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnBrewingCompleted.lua
@@ -0,0 +1,26 @@
+return
+{
+ HOOK_BREWING_COMPLETED =
+ {
+ CalledWhen = "A brewing process is completed.",
+ DefaultFnName = "OnBrewingCompleted", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cBrewingstand|brewing stand}} has completed the brewing process.
+ See also the {{OnBrewingCompleting|HOOK_BREWING_COMPLETING}} hook for a similar hook, is called when a
+ brewing process is completing.
+ ]],
+ Params =
+ {
+ { Name = "World", Type = "{{cWorld}}", Notes = "World where the brewing stand resides." },
+ { Name = "Brewingstand", Type = "{{cBrewingstand}}", Notes = "The brewing stand that completed the brewing process." },
+ },
+ Returns = [[
+ If the function returns false or no value, Cuberite calls other plugins with this event. If the
+ function returns true, no other plugin is called for this event.</p>
+ ]],
+ }, -- HOOK_BREWING_COMPLETED
+}
+
+
+
+
diff --git a/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua b/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua
new file mode 100644
index 000000000..14429c8ff
--- /dev/null
+++ b/Server/Plugins/APIDump/Hooks/OnBrewingCompleting.lua
@@ -0,0 +1,28 @@
+return
+{
+ HOOK_BREWING_COMPLETING =
+ {
+ CalledWhen = "A brewing process is completing.",
+ DefaultFnName = "OnBrewingCompleting", -- also used as pagename
+ Desc = [[
+ This hook is called whenever a {{cBrewingstand|brewing stand}} is completing the brewing process. Plugins may
+ refuse the completing of the brewing process.<p>
+ See also the {{OnBrewingCompleted|HOOK_BREWING_COMPLETED}} hook for a similar hook, is called after the
+ brewing process has been completed.
+ ]],
+ Params =
+ {
+ { Name = "World", Type = "{{cWorld}}", Notes = "World where the brewing stand resides." },
+ { Name = "Brewingstand", Type = "{{cBrewingstand}}", Notes = "The brewing stand that completes the brewing process." },
+ },
+ Returns = [[
+ If the function returns false or no value, Cuberite calls other plugins with this event. If the function returns true,
+ no other plugin's callback is called and the brewing process is canceled.
+ <p>
+ ]],
+ }, -- HOOK_BREWING_COMPLETING
+}
+
+
+
+
diff --git a/Server/brewing.txt b/Server/brewing.txt
new file mode 100644
index 000000000..af690d81e
--- /dev/null
+++ b/Server/brewing.txt
@@ -0,0 +1,235 @@
+#*****************#
+# Brewing Recipes #
+#*****************#
+# The time for a brewing recipe is always 20 seconds (400 ticks).
+#
+# Minecraft-Wiki Brewing:
+# http://minecraft.gamepedia.com/Brewing
+#
+# A brewing recipe has this format:
+# Data Value + Ingredient = Potion
+
+
+### Primary ###
+# Akward Potion
+0 + netherwart = 16
+
+# Mundane Potion
+0 + redstonedust = 64
+0 + ghasttear = 8192
+0 + glisteringmelon = 8192
+0 + blazepowder = 8192
+0 + magmacream = 8192
+0 + sugar = 8192
+0 + spidereye = 8192
+0 + rabbitsfoot = 8192
+
+# Thick Potion
+0 + glowstonedust = 32
+
+# Potion of Weakness
+0 + fermentedspidereye = 8264
+
+
+
+
+### Secondary ###
+
+## Positive ##
+
+# Potion of Healing
+16 + glisteringmelon = 8197
+
+# Potion of Fire Resistance
+16 + magmacream = 8195
+
+# Potion of Regeneration
+16 + ghasttear = 8193
+
+# Potion of Strength
+16 + blazepowder = 8201
+
+# Potion of Swiftness
+16 + sugar = 8194
+
+# Potion of Night Vision
+16 + goldencarrot = 8198
+
+# Potion of Water Breathing
+16 + pufferfish = 8205
+
+# Potion of Leaping
+16 + rabbitsfoot = 8203
+
+
+## Negative ##
+
+# Potion of Poison
+16 + spidereye = 8196
+
+# Potion of Weakness
+16 + fermentedspidereye = 8200
+32 + fermentedspidereye = 8200
+64 + fermentedspidereye = 8200
+
+# Potion of Weakness (extended)
+8192 + fermentedspidereye = 8264
+
+
+
+
+### Tertiary ###
+
+## Positive ##
+
+# Potion of Fire Resistance (extended)
+8195 + redstonedust = 8259
+8227 + redstonedust = 8259
+
+# Potion of Healing II
+8197 + glowstonedust = 8229
+8261 + glowstonedust = 8229
+
+# Potion of Regeneration (extended)
+8193 + redstonedust = 8257
+8225 + redstonedust = 8257
+
+# Potion of Regeneration II
+8193 + glowstonedust = 8225
+8257 + glowstonedust = 8225
+
+# Potion of Strength (extended)
+8201 + redstonedust = 8265
+8233 + redstonedust = 8265
+
+# Potion of Strength II
+8201 + glowstonedust = 8233
+8265 + glowstonedust = 8233
+
+# Potion of Swiftness (extended)
+8194 + redstonedust = 8258
+8226 + redstonedust = 8258
+
+# Potion of Swiftness II
+8194 + glowstonedust = 8226
+8258 + glowstonedust = 8226
+
+# Potion of Night Vision (extended)
+8198 + redstonedust = 8262
+
+# Potion of Invisibility
+8198 + fermentedspidereye = 8206
+
+# Potion of Invisibility (extended)
+8262 + fermentedspidereye = 8270
+
+# Potion of Invisibility (extended)
+8206 + redstonedust = 8270
+
+# Potion of Water Breathing (extended)
+8205 + redstonedust = 8269
+8237 + redstonedust = 8269
+
+# Potion of Leaping II
+8203 + glowstonedust = 8235
+8267 + glowstonedust = 8235
+
+# Potion of Leaping (extended)
+8203 + redstonedust = 8267
+8235 + redstonedust = 8267
+
+
+## Negative ##
+
+# Potion of Harming
+8197 + fermentedspidereye = 8204
+8196 + fermentedspidereye = 8204
+8260 + fermentedspidereye = 8204
+
+# Potion of Harming II
+8229 + fermentedspidereye = 8236
+8228 + fermentedspidereye = 8236
+
+# Potion of Harming II
+8204 + glowstonedust = 8236
+8268 + glowstonedust = 8236
+
+# Potion of Poison (extended)
+8196 + redstonedust = 8260
+8228 + redstonedust = 8260
+
+# Potion of Poison II
+8196 + glowstonedust = 8228
+8260 + glowstonedust = 8228
+
+# Potion of Slowness
+8195 + fermentedspidereye = 8202
+8194 + fermentedspidereye = 8202
+8203 + fermentedspidereye = 8202
+
+# Potion of Slowness (extended)
+8202 + redstonedust = 8266
+8234 + redstonedust = 8266
+
+# Potion of Slowness (extended)
+8259 + fermentedspidereye = 8266
+8258 + fermentedspidereye = 8266
+8267 + fermentedspidereye = 8266
+
+# Potion of Weakness
+8201 + fermentedspidereye = 8200
+8193 + fermentedspidereye = 8200
+
+# Potion of Weakness (extended)
+8265 + fermentedspidereye = 8264
+8257 + fermentedspidereye = 8264
+
+# Potion of Weakness (extended)
+8200 + redstonedust = 8264
+8232 + redstonedust = 8264
+
+
+
+
+### Reverted ###
+
+## Glowstone ##
+
+# Potion of Fire Resistance (reverted)
+8259 + glowstonedust = 8227
+
+# Potion of Night Vision (reverted)
+8262 + glowstonedust = 8230
+
+# Potion of Weakness (reverted)
+8264 + glowstonedust = 8232
+
+# Potion of Slowness (reverted)
+8266 + glowstonedust = 8234
+
+# Potion of Water Breathing (reverted)
+8269 + glowstonedust = 8237
+
+
+## Redstone ##
+
+# Potion of Healing (reverted)
+8229 + redstonedust = 8261
+
+# Potion of Harming (reverted)
+8236 + redstonedust = 8268
+
+
+## Fermented Spider Eye ##
+
+# Potion of Harming (reverted)
+8261 + fermentedspidereye = 8268
+8260 + fermentedspidereye = 8268
+
+# Potion of Slowness (reverted)
+8227 + fermentedspidereye = 8234
+8226 + fermentedspidereye = 8234
+
+# Potion of Weakness (reverted)
+8233 + fermentedspidereye = 8232
+8225 + fermentedspidereye = 8232