A fast and easy to use, moddable, Python based Minecraft server!

Overview

PyMine

discord views quality contributors code size build status code style

PyMine - The fastest, easiest to use, Python-based Minecraft Server!

Features

Note: This list is not always up to date, and doesn't contain all the features that PyMine offers

  • Joinable - the login process is complete, but users can not yet join the world
  • Packet Models - missing some clientbound packets
  • Status + Login Logic - completed
  • Play Logic - currently a work in progress
  • World Generation - superflat world generation has been started
  • Entities/Entity AI - not started yet
  • Plugin API - completed, but more will be added as the development continues
  • Command/Argument Parsing - currently a work in progress
  • Query Support - completed
  • RCON Support - not started yet

Contributing

Installation / Usage

Check out the docs for more info

Installing from source

  • First, clone the repository git clone https://github.com/py-mine/PyMine.git and move into that directory (cd PyMine)
  • Next, install the required Python packages via pip (python3 -m pip install -r requirements.txt)
  • To run the server, you should run python3 pymine.
  • It is recommended you do not use regular Python, but PyPy3

API/Plugin Examples

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Milo Weinberg

๐Ÿ’ป ๐ŸŽจ ๐Ÿ”Œ ๐Ÿ”ฃ ๐Ÿง‘โ€๐Ÿซ ๐Ÿ“– ๐Ÿ’ฌ ๐Ÿ› ๐Ÿ’ก ๐Ÿค” ๐Ÿ“† ๐Ÿ‘€ โš ๏ธ

Sh-wayz

๐Ÿ’ป ๐Ÿ› ๐Ÿ“– ๐Ÿ’ก ๐Ÿ’ฌ ๐Ÿ‘€ โš ๏ธ ๐Ÿ“†

Ammar-sys

๐Ÿ“–

Treyver Reicha

๐Ÿ’ป ๐Ÿ‘€ ๐Ÿค” ๐Ÿ› ๐Ÿ“† โš ๏ธ

Paul Przybyszewski

๐Ÿ’ป

Ashwin Vinod

๐Ÿค” ๐Ÿ’ป ๐Ÿ“–

imSofi

๐Ÿ›

Kevin Thomas

๐Ÿค”

Milan Mehra

๐Ÿค”

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • Stopping the Server causes unique behavour

    Stopping the Server causes unique behavour

    Describe Bug

    when stopping the server, multiple unexpected outcome could occur. these do not seem desirable and are therefore a bug.

    To Reproduce

    1

    1. start the server
    2. type stop
    error + screenshot

    image1

    $ ./startserver.sh
    ./startserver.sh: line 6: pypy: command not found
    python version ok (3.9.0+)
    [02/28/21 15:32:35 INFO]: Query server started on 127.0.1.1:25565.
    [02/28/21 15:32:35 INFO]: Loading default worlds for level world...
    [02/28/21 15:32:35 INFO]: Loaded default worlds: world, world_nether, world_the_end.
    [02/28/21 15:32:35 INFO]: PyMine 0.1 started on 127.0.1.1:25565!
    > stop
    [02/28/21 15:32:39 INFO]: Closing server...
    [02/28/21 15:32:39 INFO]: Server closed.
    Exception ignored in: <function DatagramStream.__del__ at 0x7fd4ba6cbd30>
    Traceback (most recent call last):
      File "/home/the456gamer/Projects/PyMine/PyMine-server/venv/lib/python3.9/site-packages/asyncio_dgram/aio.py", line 42, in __del__
      File "/usr/lib/python3.9/asyncio/selector_events.py", line 700, in close
      File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
      File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
    RuntimeError: Event loop is closed
    Unhandled error in exception handler
    context: {'message': 'Task was destroyed but it is pending!', 'task': <Task pending name='Task-3' coro=<QueryServer.handle() running at /home/the456gamer/Projects/PyMine/PyMine-server/pymine/logic/query.py:141> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fd4b92a8760>()]>>}
    Traceback (most recent call last):
      File "/usr/lib/python3.9/asyncio/base_events.py", line 1775, in call_exception_handler
        self._exception_handler(self, context)
      File "/home/the456gamer/Projects/PyMine/PyMine-server/pymine/api/console.py", line 70, in task_exception_handler
        if ctx["exception"]:
    KeyError: 'exception'
    [02/28/21 15:32:39 ERROR]: Error occurred while handling query packets: 
    Traceback (most recent call last):
      File "/usr/lib/python3.9/asyncio/queues.py", line 166, in get
        await getter
    GeneratorExit
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/the456gamer/Projects/PyMine/PyMine-server/pymine/logic/query.py", line 141, in handle
        data, remote = await self._server.recv()
      File "/home/the456gamer/Projects/PyMine/PyMine-server/venv/lib/python3.9/site-packages/asyncio_dgram/aio.py", line 106, in recv
        data, addr = await self._recvq.get()
      File "/usr/lib/python3.9/asyncio/queues.py", line 168, in get
        getter.cancel()  # Just in case getter is not done yet.
      File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
        self._check_closed()
      File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
        raise RuntimeError('Event loop is closed')
    RuntimeError: Event loop is closed
    

    2

    1. start the server
    2. press ctrl+c
    3. observe how server doesnt stop
    4. observe how any input is now ignored
    5. press ctrl + c again
    6. observe how server now stops
    Screenshot

    image

    $ ./startserver.sh
    ./startserver.sh: line 6: pypy: command not found
    python version ok (3.9.0+)
    [02/28/21 15:41:11 INFO]: Query server started on 127.0.1.1:25565.
    [02/28/21 15:41:11 INFO]: Loading default worlds for level world...
    [02/28/21 15:41:11 INFO]: Loaded default worlds: world, world_nether, world_the_end.
    [02/28/21 15:41:11 INFO]: PyMine 0.1 started on 127.0.1.1:25565!
    >                                                                                                                                                                                                                                             
    exit
    stop
    stop
    
    
    aqnjdnijec
    fernjvenjov
    ^C[02/28/21 15:41:36 INFO]: Closing server...
    [02/28/21 15:41:36 INFO]: Server closed.
    

    Expected Behavior

    For the server to safely stop without errors

    Additional Context

    $ python3.9 --version
    Python 3.9.0+
    
    $ cat /etc/*-release 
           โ”‚ File: /etc/lsb-release
       1   โ”‚ DISTRIB_ID=Ubuntu
       2   โ”‚ DISTRIB_RELEASE=20.04
       3   โ”‚ DISTRIB_CODENAME=focal
       4   โ”‚ DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
    ---
           โ”‚ File: /etc/os-release
       1   โ”‚ NAME="Ubuntu"
       2   โ”‚ VERSION="20.04.2 LTS (Focal Fossa)"
       3   โ”‚ ID=ubuntu
       4   โ”‚ ID_LIKE=debian
       5   โ”‚ PRETTY_NAME="Ubuntu 20.04.2 LTS"
       6   โ”‚ VERSION_ID="20.04"
       7   โ”‚ HOME_URL="https://www.ubuntu.com/"
       8   โ”‚ SUPPORT_URL="https://help.ubuntu.com/"
       9   โ”‚ BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
      10   โ”‚ PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
      11   โ”‚ VERSION_CODENAME=focal
      12   โ”‚ UBUNTU_CODENAME=focal
    
    Bug 
    opened by the456gamer 7
  • Add proper console

    Add proper console

    Console should have like two sections, horizontally split. The bottom-most one should be just one row/line and should contain a > and whatever the user is typing. The above section should contain output/logging information. If a user is typing, what they've typed should not be overwritten by any logging/output.

    You can see any modern console, such as paper/bukkit/vanilla for how this looks/feels

    Enhancement stale 
    opened by Iapetus-11 7
  • Fix negative varint values.

    Fix negative varint values.

    Due to a bitshift effect, the old implentation of the varint functions leads to very high positive numbers for wanted negative ones. The error occurs in the following line num += 1 + 1 << 32, here you must not add with 1, because otherwise an offset in the negative numbers arises which has a discontinuity point. Besides this problem, the value of the upper limit was also shifted by an offset of +1.

    To prove the errors, an extended unittest was implemented which does not find any errors after the fix.

    Since testing with pytest without poetry is more convenient, a setup.py was created. Note that the dependencies for runtime are now entered in the setup.py. In the requirenments.txt are now only the dependencies for the developer environment.

    The server can be started with python -m pymine. Tests can be performed with python and venv with the command python -m pytest tests.

    In general i can recommend to reduce the dependency on poetry and to rework the implentation of varint. Especially I don't think it is useful to calculate min and max all the time, rather implement a function for varint and varlong here.

    Greetings jpotyka

    opened by jpotyka 5
  • Sphinx docstrings

    Sphinx docstrings

    Is your feature request related to a problem? Please describe. Need me some hot docstrings.

    Describe the solution you'd like Add sphinx-styled descriptive docstrings to all classes/major functions.

    Describe alternatives you've considered noโค๏ธ Additional info: https://atom.io/packages/docblock-python

    Enhancement Good First Issue 
    opened by Sh-wayz 5
  • key value storage for plugins

    key value storage for plugins

    Add a dynamic key: value storage database for plugins to use. This wouldn't be for user configuration, but more plugins sitting persistent info

    There should be support for multiple backends, including external And ideally convert between them

    Enhancement 
    opened by the456gamer 4
  • Implement all packets

    Implement all packets

    Once base packet class is done, start creating all the packets. These packets should go under src/types/packets and should be subclasses of src.types.packet.Packet. For a list of all the packets, look here: https://wiki.vg/Protocol (Important: this link displays the most recent versions protocol, to view a specific version go here)

    Packet Making Guide v2

    Naming

    • Packets are named by their state and name on wiki.vg Examples: class PlayUpdateLight or class HandshakeHandshake or class PlayPlayerPosition

    Creation

    • Packets should have two class object attributes (id and to), a docstring describing them, an __init__, and the decode or encode method (or both)
    • Packets should also subclass a Packet object, and initialize it. Example:
    class TestExample(Packet):
      """This is an example packet, not used at all. (Client -> Server AND Server -> Client)
    
      :param str dummy_payload: The payload of the packet.
      :attr int id: Unique packet ID.
      :attr int to: Packet direction.
      :attr dummy_payload:
      """
    
      id = 0x00  # ID of the packet, found on wiki.vg in the section where there's info on the packet
      to = 2  # 0=serverbound, 1=clientbound, 2=both be careful when using 2 as many packets are both, but have different IDs
    
      def __init__(self, dummy_payload: str) -> None:
        super().__init__()
    
        self.dummy_payload = dummy_payload
    
      def encode(self) -> bytes:
        return Buffer.pack_string(self.dummy_payload)
    
      @classmethod
      def decode(cls, buf: Buffer) -> TestExample:
        return cls(buf.unpack_string())
    

    Additional Info:

    • Packet docstrings should be generated via the atom plugin docblock-python or another plugin for another editor. They should be in the sphinx format.
    • Docstrings, on the first line, should contain the short summary, any additional links/info, and in parentheses the direction(s) of the packet.
    • Remember to add the name of the packet to the file's __all__ (located near the top of the file, after imports)
    • If you can't find the right file to place your packet, you can create a new one. Remember to import annotations from __future__ to allow for proper typehints, and to add an __all__.

    Progress Checklist (By States)

    • [x] handshake packets
    • [x] status packets
    • [x] login packets
    • [ ] play packets
    Enhancement 
    opened by Iapetus-11 4
  • Show current mode when vi_mode is enabled

    Show current mode when vi_mode is enabled

    Feature

    What the title said, there should be something(Maybe a right prompt or bottom toolbar?) displaying current editing mode when vi_mode is enabled. No need for it to have the entire name, I for insert, N for normal, etc.

    Reason

    It's nice to know which mode you're in so you don't accidentally mess up your command.

    Examples

    These are screenshots of my fish prompt that could serve as inspiration.

    image

    image

    image

    Enhancement 
    opened by Sh-wayz 3
  • md lint the markdown files

    md lint the markdown files

    this includes link brackets line breaks to fit to 100chars and adding a .markdownlintrc file

    i also commented out the ghprofile view counter, which seemed to have broken

    opened by the456gamer 2
  • Player join events

    Player join events

    Add two new methodes to registery to be used by plugins.

    @on_login_success is equivalent to @on_packet("login", 0x02) and both will get trigger after a successful login with the following args: the associated stream and packet.

    @on_join is equivalent to @on_packet("play", 0x24) and both will get trigger after a player fully load into the world with the following args: the associated stream and packet.

    opened by martin-feaux 2
  • robot is still a paper weight

    robot is still a paper weight

    Describe Bug

    A clear and concise description of what the bug is.

    To Reproduce

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected Behavior

    A clear and concise description of what you expected to happen.

    Screenshots / Proof

    If applicable, add screenshots to help explain your problem.

    Additional Context

    Add any other context about the problem here, including OS, Python version, and other important contextual information.

    Bug 
    opened by dh2di3oj2 2
  • Add custom resource pack support

    Add custom resource pack support

    Feature

    • A way to add custom resource pack(s) for the server.
    • The resource pack(s) can be optional or required for the player to accept.

    Reason

    • So that it's convenient for new players to use the resource pack that the server owner wants them to use.
    Enhancement 
    opened by infinitygamer404 2
  • Help: Display arguments for each command

    Help: Display arguments for each command

    Display argument names and their annotations (if any) for each command.

    == help menu ==
    test: Documentation missing.
     Arguments:
     - b: Bool
     - f: Float
     - d: Double
     - i: Integer
     - s: str
     - s2: String
     - s3: String
    

    Checkbox in #266

    opened by Martysh12 0
  • Commands: Heal and Feed commands

    Commands: Heal and Feed commands

    Add a heal and a feed command, for manipulating health and hunger.

    Heal

    Sets a player's health to any value using the PlayUpdateHealth packet.

    Syntax

    heal <username> <new_health>

    new_health - integer value between 0 - 20

    Feed

    Sets a player's hunger to any value using the PlayUpdateHealth packet.

    Syntax

    feed <username> <new_food>

    new_food - integer value between 0 - 20

    opened by Martysh12 0
  • Config cleanup

    Config cleanup

    Feature

    • Config should be sorted by category(rcon, query, world, etc)->alphabetically, with comments describing each section. Comment can be achieved with ruamel.yaml

    Reason

    • The config should be mainly self-explanatory to new users. This also stops noob devs like me from spamming petus for help quite as often.
    Enhancement Good First Issue 
    opened by Sh-wayz 3
  • Built-in multi-world support!

    Built-in multi-world support!

    • PyMine should have built-in support for multiple worlds (aside from the default overworld, nether, and end)
    • Perhaps there would be a set of commands allowing for the easy management of the worlds.

    Reason

    • Multi-world plugins tend to be jank or hard to use, PyMine having built in multi-world support would be an excellent addition.
    Enhancement 
    opened by Iapetus-11 3
Owner
PyMine
PyMine
Extremely easy multi instancing software for minecraft speedrunning.

Easy Multi Extremely easy multi/single instancing software for minecraft speedrunning. A couple of goals of this project: Setup multi in minutes No fi

Duncan 8 Jul 16, 2022
Fast, flexible and easy to use probabilistic modelling in Python.

Please consider citing the JMLR-MLOSS Manuscript if you've used pomegranate in your academic work! pomegranate is a package for building probabilistic

Jacob Schreiber 3k Dec 29, 2022
A Lighting Pytorch Framework for Recommendation System, Easy-to-use and Easy-to-extend.

Torch-RecHub A Lighting Pytorch Framework for Recommendation Models, Easy-to-use and Easy-to-extend. ๅฎ‰่ฃ… pip install torch-rechub ไธป่ฆ็‰นๆ€ง scikit-learn้ฃŽๆ ผๆ˜“็”จ

Mincai Lai 67 Jan 4, 2023
Fast image augmentation library and easy to use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about library: https://www.mdpi.com/2078-2489/11/2/125

Albumentations Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to inc

null 11.4k Jan 9, 2023
this is a lite easy to use virtual keyboard project for anyone to use

virtual_Keyboard this is a lite easy to use virtual keyboard project for anyone to use motivation I made this for this year's recruitment for RobEn AA

Mohamed Emad 3 Oct 23, 2021
A collection of easy-to-use, ready-to-use, interesting deep neural network models

Interesting and reproducible research works should be conserved. This repository wraps a collection of deep neural network models into a simple and un

Aria Ghora Prabono 16 Jun 16, 2022
An Easy-to-use, Modular and Prolongable package of deep-learning based Named Entity Recognition Models.

DeepNER An Easy-to-use, Modular and Prolongable package of deep-learning based Named Entity Recognition Models. This repository contains complex Deep

Derrick 9 May 30, 2022
Project Aquarium is a SUSE-sponsored open source project aiming at becoming an easy to use, rock solid storage appliance based on Ceph.

Project Aquarium Project Aquarium is a SUSE-sponsored open source project aiming at becoming an easy to use, rock solid storage appliance based on Cep

Aquarist Labs 73 Jul 21, 2022
A more easy-to-use implementation of KPConv based on PyTorch.

A more easy-to-use implementation of KPConv This repo contains a more easy-to-use implementation of KPConv based on PyTorch. Introduction KPConv is a

Zheng Qin 36 Dec 29, 2022
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 3k Jan 3, 2023
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 2.8k Feb 12, 2021
Minecraft Hack Detection With Python

Minecraft Hack Detection An attempt to try and use crowd sourced replays to find

Kuleen Sasse 3 Mar 26, 2022
Fast and Easy Infinite Neural Networks in Python

Neural Tangents ICLR 2020 Video | Paper | Quickstart | Install guide | Reference docs | Release notes Overview Neural Tangents is a high-level neural

Google 1.9k Jan 9, 2023
Discord-Protect is a simple discord bot allowing you to have some security on your discord server by ordering a captcha to the user who joins your server.

Discord-Protect Discord-Protect is a simple discord bot allowing you to have some security on your discord server by ordering a captcha to the user wh

Tir Omar 2 Oct 28, 2021
Minecraft agent to farm resources using reinforcement learning

BarnyardBot CS 175 group project using Malmo download BarnyardBot.py into the python examples directory and run 'python BarnyardBot.py' in the console

null 0 Jul 26, 2022
PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices.

PyTorch-LIT PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices. With

Amin Rezaei 157 Dec 11, 2022
Easy to use Python camera interface for NVIDIA Jetson

JetCam JetCam is an easy to use Python camera interface for NVIDIA Jetson. Works with various USB and CSI cameras using Jetson's Accelerated GStreamer

NVIDIA AI IOT 358 Jan 2, 2023
A simple, high level, easy-to-use open source Computer Vision library for Python.

ZoomVision : Slicing Aid Detection A simple, high level, easy-to-use open source Computer Vision library for Python. Installation Installing dependenc

Nurettin SinanoฤŸlu 2 Mar 4, 2022