Skip to main content

This library is a python interface for cubiomes

Project description

Cubiomes Python Interface (CPI) Documentation

This is an updated fork of the original cubiomespi package, adding support for Minecraft 1.21 and cross-platform installations.

You can install this fork via pip:

pip install cubiomespi-fork

The original README follows below:

Overview

The Cubiomes Python Interface (CPI) is a python interface for Cubiomes

Usage

To use you can download it via pip, with:

 pip install cubiomespi

Classes

Generator

Stores data about the Minecraft world generator.

  • Attributes:
    • version (int): Minecraft version number.
    • seed (int): Random seed for world generation.
    • dimension (int): Dimension ID.

Dimension

Defines Minecraft dimensions with constants.

Constants:
    DIM_NETHER = -1
    DIM_OVERWORLD = 0
    DIM_END = 1
    DIM_UNDEF = 1000

MCVersion

Defines Minecraft version constants.

Constants:
    MC_1_0_0 = 3
    MC_1_1_0 = 4
    MC_1_2_5 = 5
    ... (and so on up to MC_1_20)

Structure

Defines various Minecraft structures with constants.

Constants:
    Feature = 0
    Desert_Pyramid = 1
    Jungle_Temple = 2
    ... (and so on)

BiomeID

Defines Minecraft biomes with constants.

Constants:
    none = -1
    ocean = 0
    plains = 1
    ... (and so on, including custom biomes)

BiomeGroups

Groups of biomes for convenience.

Attributes:
    Forests
    Beaches
    DesertBiomes
    Oceans

BastionType

Defines various bastion types.

Constants:
    HOUSING = 0
    STABLES = 1
    TREASURE = 2
    BRIDGE = 3

Functions

distance_between_structures(structure1, structure2) -> float

Calculates the distance between two structures.

Parameters:
    structure1 (tuple[int, int]): Coordinates of the first structure.
    structure2 (tuple[int, int]): Coordinates of the second structure.

Returns:
    float: Distance between the two structures.

distance_from_00(c1) -> float

Calculates the distance from the origin (0,0) to a given coordinate.

Parameters:
    c1 (tuple[int, int]): Coordinates.

Returns:
    float: Distance from the origin.

distance_between_points(x1, y1, x2, y2) -> float

Calculates the distance between two points.

Parameters:
    x1, y1, x2, y2 (int): Coordinates of the two points.

Returns:
    float: Distance between the two points.

convert_to_string(constant: int, typee: object) -> str

Converts a constant value to its string representation based on its type.

Parameters:
    constant (int): The constant to convert.
    typee (object): The type of the constant (e.g., BastionType, Structure, BiomeID).

Returns:
    str: String representation of the constant.

get_structure_pos(structure: Structure, g: Generator, rx: int, rz: int) -> tuple[int, int]

Gets the position of a structure.

Parameters:
    structure (Structure): The structure to find.
    g (Generator): The generator instance.
    rx, rz (int): Coordinates.

Returns:
    tuple[int, int]: Coordinates of the structure or None if not found.

is_viable_structure_pos(structure: Structure, g: Generator, x: int, z: int) -> bool

Checks if a position is viable for a structure.

Parameters:
    structure (Structure): The structure to check.
    g (Generator): The generator instance.
    x, z (int): Coordinates.

Returns:
    bool: True if viable, otherwise False.

get_stronghold_pos(g: Generator, count: int) -> list[tuple[int, int]]

Gets positions of strongholds.

Parameters:
    g (Generator): The generator instance.
    count (int): Number of strongholds to retrieve.

Returns:
    list[tuple[int, int]]: List of stronghold positions.

get_spawn_pos(g: Generator) -> tuple[int, int]

Gets the spawn position of the world.

Parameters:
    g (Generator): The generator instance.

Returns:
    tuple[int, int]: Spawn coordinates.

get_biome_at(g: Generator, x: int, y: int, z: int) -> BiomeID

Gets the biome at a specific coordinate.

Parameters:
    g (Generator): The generator instance.
    x, y, z (int): Coordinates.

Returns:
    BiomeID: ID of the biome at the coordinates.

get_bastion_variant(g: Generator, x: int, z: int) -> BastionType

Gets the bastion variant at a specific coordinate.

Parameters:
    g (Generator): The generator instance.
    x, z (int): Coordinates.

Returns:
    BastionType: Type of bastion at the coordinates.

find_structure_in_range(g: Generator, structure: Structure, srx: int, srz: int, erx: int, erz: int) -> list[tuple[int, int]]

Finds structures within a specified range.

Parameters:
    g (Generator): The generator instance.
    structure (Structure): The structure to find.
    srx, srz, erx, erz (int): Range coordinates.

Returns:
    list[tuple[int, int]]: List of structure positions or None if no structures are found.

find_closest_structure(g: Generator, structure: Structure, cx: int, cz: int, limit: int) -> tuple[int, int]

Finds the closest structure to a given coordinate.

Parameters:
    g (Generator): The generator instance.
    structure (Structure): The structure to find.
    cx, cz (int): Coordinates.
    limit (int): Maximum search distance.

Returns:
    tuple[int, int]: Coordinates of the closest structure or None if not found.

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

cubiomespi_fork-1.0.2.tar.gz (501.5 kB view details)

Uploaded Source

Built Distribution

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

cubiomespi_fork-1.0.2-cp314-cp314-macosx_26_0_arm64.whl (742.3 kB view details)

Uploaded CPython 3.14macOS 26.0+ ARM64

File details

Details for the file cubiomespi_fork-1.0.2.tar.gz.

File metadata

  • Download URL: cubiomespi_fork-1.0.2.tar.gz
  • Upload date:
  • Size: 501.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for cubiomespi_fork-1.0.2.tar.gz
Algorithm Hash digest
SHA256 36bb0efe9e84deac700a14e12bab02cf0b0304650618eccfc243da8f2dcc6043
MD5 d03142f25cf04e849ed79e8e582cb2b6
BLAKE2b-256 f3e971c86fa058d7f723878cde8a978f6b454a85f3356c969da53ce42b78a91c

See more details on using hashes here.

File details

Details for the file cubiomespi_fork-1.0.2-cp314-cp314-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for cubiomespi_fork-1.0.2-cp314-cp314-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 33eab3cb88086e8bb437f12a8709ce9c7637974f6e2315f2121e3ea7784fb45a
MD5 83b4053e8c2d5cc8614b92e16af1b3ec
BLAKE2b-256 3b6c2c895516ade4f6dc50fd13293920278cbc78ee1cb3f99986727877d8c175

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