diff --git a/docs/authors.rst b/docs/authors.rst index 97b521d..bf9ec3d 100644 --- a/docs/authors.rst +++ b/docs/authors.rst @@ -1,3 +1,5 @@ +.. _authors: + ******* Authors ******* diff --git a/docs/contributing.rst b/docs/contributing.rst index 985e561..86ed6ed 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -1,3 +1,5 @@ +.. _contributing: + ************ Contributing ************ diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 32fa723..874fc3b 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -1,4 +1,9 @@ +.. _getting-started: + *************** Getting Started *************** +See the `Basic Example Bot `__ for basic usage of SpockBot. + +Also see the `Extra Repository `__ for some more plugin examples. diff --git a/docs/index.rst b/docs/index.rst index 183c6b5..66b37b2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,8 +5,6 @@ SpockBot Welcome to SpockBot's documentation! ==================================== -Contents: - .. toctree:: :caption: Usage :maxdepth: 1 diff --git a/docs/installation.rst b/docs/installation.rst index 251f50c..db3e0fc 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,4 +1,19 @@ +.. _installation: + ************ Installation ************ +If you are looking to contribute to SpockBot please follow the instructions :ref:`here `. + +#. Install cryptography first, instructions for that are `here `__ + +#. Clone the repository locally:: + + git clone https://github.com/SpockBotMC/SpockBot.git + +#. Install SpockBot:: + + cd SpockBot + python3 setup.py install + diff --git a/docs/license.rst b/docs/license.rst index 6eaf245..f9d496c 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -1,3 +1,5 @@ +.. _license: + ******* License ******* diff --git a/docs/modules/modules.rst b/docs/modules/modules.rst new file mode 100644 index 0000000..6362c87 --- /dev/null +++ b/docs/modules/modules.rst @@ -0,0 +1,7 @@ +spock +===== + +.. toctree:: + :maxdepth: 4 + + spock diff --git a/docs/modules/spock.plugins.core.rst b/docs/modules/spock.plugins.core.rst index 7291471..0ade041 100644 --- a/docs/modules/spock.plugins.core.rst +++ b/docs/modules/spock.plugins.core.rst @@ -36,6 +36,14 @@ spock.plugins.core.settings module :undoc-members: :show-inheritance: +spock.plugins.core.taskmanager module +------------------------------------- + +.. automodule:: spock.plugins.core.taskmanager + :members: + :undoc-members: + :show-inheritance: + spock.plugins.core.ticker module -------------------------------- diff --git a/docs/modules/spock.plugins.helpers.rst b/docs/modules/spock.plugins.helpers.rst index 7d61836..9e34f17 100644 --- a/docs/modules/spock.plugins.helpers.rst +++ b/docs/modules/spock.plugins.helpers.rst @@ -4,6 +4,14 @@ spock.plugins.helpers package Submodules ---------- +spock.plugins.helpers.chat module +--------------------------------- + +.. automodule:: spock.plugins.helpers.chat + :members: + :undoc-members: + :show-inheritance: + spock.plugins.helpers.clientinfo module --------------------------------------- @@ -52,10 +60,10 @@ spock.plugins.helpers.keepalive module :undoc-members: :show-inheritance: -spock.plugins.helpers.move module ---------------------------------- +spock.plugins.helpers.movement module +------------------------------------- -.. automodule:: spock.plugins.helpers.move +.. automodule:: spock.plugins.helpers.movement :members: :undoc-members: :show-inheritance: diff --git a/docs/modules/spock.plugins.tools.rst b/docs/modules/spock.plugins.tools.rst index 270552a..a91694c 100644 --- a/docs/modules/spock.plugins.tools.rst +++ b/docs/modules/spock.plugins.tools.rst @@ -4,6 +4,14 @@ spock.plugins.tools package Submodules ---------- +spock.plugins.tools.collision module +------------------------------------ + +.. automodule:: spock.plugins.tools.collision + :members: + :undoc-members: + :show-inheritance: + spock.plugins.tools.inventory_async module ------------------------------------------ @@ -12,6 +20,14 @@ spock.plugins.tools.inventory_async module :undoc-members: :show-inheritance: +spock.plugins.tools.task module +------------------------------- + +.. automodule:: spock.plugins.tools.task + :members: + :undoc-members: + :show-inheritance: + Module contents --------------- diff --git a/docs/modules/spock.rst b/docs/modules/spock.rst index 47b4a43..5d5bf46 100644 --- a/docs/modules/spock.rst +++ b/docs/modules/spock.rst @@ -14,14 +14,6 @@ Subpackages Submodules ---------- -spock.task module ------------------ - -.. automodule:: spock.task - :members: - :undoc-members: - :show-inheritance: - spock.utils module ------------------ diff --git a/examples/basic/README.md b/examples/basic/README.md index d54597f..3bc6898 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -5,9 +5,10 @@ - Creating a plugin - Receiving chat messages - Sending chat commands +- Using inventory +- Moving to location - Triggering a periodic event using a timer - Registering for an event upon startup -- Changing bot position and orientation - Placing blocks - Reading blocks diff --git a/examples/basic/example_plugin.py b/examples/basic/example_plugin.py index 4106fdb..0577666 100644 --- a/examples/basic/example_plugin.py +++ b/examples/basic/example_plugin.py @@ -39,9 +39,10 @@ class ExamplePlugin(PluginBase): requires = ('Movement', 'Timers', 'World', 'ClientInfo', 'Inventory', 'Interact', 'Chat') # Example of registering an event handler - # Event types are enumerated here: + # Packet event types are enumerated here: # https://github.com/SpockBotMC/SpockBot/blob/master/spock/mcp # /mcdata.py#L213 + # There are other events that can be used that are emitted by other plugins events = { # This event will be triggered when a chat message is received # from the server @@ -49,6 +50,9 @@ class ExamplePlugin(PluginBase): # This event will be triggered after authentication when the bot # joins the game 'client_join_game': 'perform_initial_actions', + # This event is triggered once the inventory plugin has the + # full inventory + 'inventory_synced': 'hold_block', } def __init__(self, ploader, settings): @@ -72,9 +76,7 @@ def chat_event_handler(self, name, data): """Called when a chat message occurs in the game""" logger.info('Chat message received: {0}'.format(data)) - def periodic_event_handler(self): - """Triggered every 5 seconds by a timer""" - + def hold_block(self, name, data): # Search the hotbar for cobblestone slot = self.inventory.find_slot(4, self.inventory.window.hotbar_slots) logger.info(slot) @@ -84,6 +86,11 @@ def periodic_event_handler(self): # Switch to first slot because there is no cobblestone in hotbar else: self.inventory.select_active_slot(0) + # Return True to unregister the event handler + return True + + def periodic_event_handler(self): + """Triggered every 5 seconds by a timer""" logger.info('My position: {0} pitch: {1} yaw: {2}'.format( self.clientinfo.position,