Skip to main content

Minecraft like block world in Python

Project description

PyBlockWorld

Eine an Minecraft angelehnte Welt aus Blöcken.

Installation

Die Installation erfolgt über pip install pyblockworld.

API

    from pyblockworld import World

    #
    # BEISPIEL 1
    #
    
    # Eine Funktion, die beim Drücken der B-Taste aufgerufen werden soll
    def b_key_pressed(world:World):
        print("B pressed. Player at", world.player_position())
        
    # Erstellen einer neuen Welt
    world = World()
    # Die Funktion für die build-Taste (b) wird zugewiesen
    world.build_key_pressed = b_key_pressed
    # Die Welt wird gestartet
    world.run()

    #
    # BEISPIEL 2
    #

    # Nun werden beim Drücken der Taste ein paar Blöcke platziert.
    def b_key_pressed(world:World):
        # Neue Blöcke können mit setBlock gesetzt werden.
        # Verfügbare Materialien stehen in World.MATERIALS und umfassen
        # air, default:brick, default:stone, default:sand, default:grass
        print("Block types", World.MATERIALS)
        x,y,z = world.player_position()
        # Einen Block platzieren
        world.setBlock(x,y,z, "default:brick")

        # Mehrere Blöcke auf einmal abseits des Spielers platzieren
        x,y,z = x,y,z+3
        world.setBlocks(x,y,z, x+3,y+3,z+3, "default:grass")
        
    world = World()
    world.build_key_pressed = b_key_pressed
    world.run()

Quellen

Der Quellcode basiert auf dem Code von SensorCraft, der wiederum auf dem Code von Craft basiert.

Changelog

  • 0.3.10

    • Bugfix: Fehlende Bildtextur in Paket aufgenommen.
  • 0.3.9

    • Support für Python 3.13
  • 0.3.8

    • Methoden der Klasse World dokumentiert.
  • 0.3.5

    • Changelog eingeührt
    • Support für Python 3.8
  • 0.3.7

    • PeristentWorld als speicherbare Welt hinzugefügt.
    • Doku aktualisiert: Abschnitt Start entfernt.
    • World.player_position hat das Attribut as_int, um ein Int-Tuple zu erzeugen

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyblockworld-0.3.10.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyblockworld-0.3.10-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pyblockworld-0.3.10.tar.gz.

File metadata

  • Download URL: pyblockworld-0.3.10.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.7 Linux/5.15.193-1-MANJARO

File hashes

Hashes for pyblockworld-0.3.10.tar.gz
Algorithm Hash digest
SHA256 ecf850666a66c5da1b6c58b330b7144c00a653893a3343cc6f2edbc05e47d311
MD5 d88c520a06121d9fc28a54d81e4bcf8b
BLAKE2b-256 213ff0e11562f404abd0502115580e7355120b175cb304501e3ed8fa0bac2e64

See more details on using hashes here.

File details

Details for the file pyblockworld-0.3.10-py3-none-any.whl.

File metadata

  • Download URL: pyblockworld-0.3.10-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.7 Linux/5.15.193-1-MANJARO

File hashes

Hashes for pyblockworld-0.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f3925674c2b50c062eb9cf752769492d72ac720f6b2cca37169fe7ee0bdc0e
MD5 20f3932180f80c89ede2735966c3fe61
BLAKE2b-256 e32c2758749a64720b3855763f9cd52488988a1c509b53890ef7b9d40b38dcaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page