Utils API Reference

The following section outlines the API for PyPixel.utils.

class HypixelUtils

General utilities relating to Hypixel.

static parseNBT(raw_data)

Parses NBT data from the API.

Parameters

raw_data (Union[bytes, str]) – The raw encoded NBT data.

Returns

The decoded NBT data.

Return type

nbt.nbt.NBTFile

static getRank(data)

Gets a player’s rank from their raw API data.

Parameters

data (dict) – The player’s raw API data.

Returns

The player’s rank.

Return type

Literal[‘Default’, ‘VIP’, ‘VIP+’, ‘MVP’, ‘MVP+’, ‘MVP++’, ‘YouTube’, ‘Helper’, ‘Moderator’, ‘Admin’]

static guildlevel(xp)

Gets a guild’s level from the guild’s xp.

Parameters

xp (float) – The guild’s XP.

Returns

The guild’s level.

Return type

int

static playerLevel(xp)

Gets a player’s network level from their network experience, using the equation (((2 * xp) + 30625) ^ (1 / 2) / 50) - 2.5.

Parameters

xp (float) – The player’s network experience.

Returns

The player’s network level.

Return type

int

static skywarsLevel(xp)

Gets a player’s SkyWars level from their SkyWars experience.

Parameters

xp (float) – The player’s SkyWars experience.

Returns

The player’s SkyWars level.

Return type

int

static getGameName(game)

New in version 0.1.9.

Gets the name of a Hypixel gamemode from its ID or it’s name in the API.

Parameters

game (Union[int, str]) – The game’s ID/API Name.

Returns

The game’s name, or if the game is not found, the original value you provided.

Return type

str

static stripFormatting(text)

New in version 0.2.0.

Strips Minecraft text formatting (§1) from text using Regex.

Parameters

text (str) – The text to strip.

Returns

The stripped text.

Return type

str

class SkyBlockUtils

Utilities relating to Hypixel SkyBlock.

static getItem(item, *, reverse)

Gets an item name from an item ID.

Parameters
  • item (str) – The item ID.

  • reverse (Optional[bool]) – Whether or not to translate an item name to an item ID.

Returns

The item name/ID.

Return type

str

static getMinionSlots(crafted)

Gets the number of crafted minion slots a player has.

Parameters

crafted (list) – The player’s crafted minions.

Returns

The player’s crafted minion slots.

Return type

int

static zombieSlayer(xp)

Gets the level for the Zombie slayer from the slayer experience.

Parameters

xp (float) – The player’s Zombie slayer XP.

Returns

The player’s Zombie slayer level.

Return type

int

static spiderSlayer(xp)

Gets the level for the Spider slayer from the slayer experience.

Parameters

xp (float) – The player’s Spider slayer XP.

Returns

The player’s Spider slayer level.

Return type

int

static wolfSlayer(xp)

Gets the level for the Wolf slayer from the slayer experience.

Parameters

xp (float) – The player’s Wolf slayer XP.

Returns

The player’s Wolf slayer level.

Return type

int

static slayerLevels(data)

Retrieves a SkyBlock player’s Slayer levels from their profile data.

Parameters

data (dict) – The player’s profile data.

Returns

A tuple with the player’s Slayer levels in the order Zombie, Spider, and Wolf.

Retype

int, int, int

static getSkillLevel(xp)

Converts skill XP to a skill level.

Parameters

xp (float) – The skill experience.

Returns

The skill’s level.

Return type

int

static getRunecraftLevel(xp)

Converts runecrafting skill XP to a skill level.

This is seperate from getSkillLevel because runecrafting has different experience requirements.

Parameters

xp (float) – The runecrafting skill experience.

Returns

The runecrafting skill’s level.

Return type

int

static farmingCollection(data)

Gets a player’s SkyBlock Farming collection from their member data.

Parameters

data (dict) – The player’s SkyBlock data.

Returns

A dict of their items in the Farming collection.

Return type

dict

static miningCollection(data)

Gets a player’s SkyBlock Mining collection from their member data.

Parameters

data (dict) – The player’s SkyBlock data.

Returns

A dict of their items in the Mining collection.

Return type

dict

static combatCollection(data)

Gets a player’s SkyBlock Combat collection from their member data.

Parameters

data (dict) – The player’s SkyBlock data.

Returns

A dict of their items in the Combat collection.

Return type

dict

static foragingCollection(data)

Gets a player’s SkyBlock Foraging collection from their member data.

Parameters

data (dict) – The player’s SkyBlock data.

Returns

A dict of their items in the Foraging collection.

Return type

dict

static fishingCollection(data)

Gets a player’s SkyBlock Fishing collection from their member data.

Parameters

data (dict) – The player’s SkyBlock data.

Returns

A dict of their items in the Fishing collection.

Return type

dict

static getCollectionData(data, req_xp, collection, c)

Modifies a collection’s collection data.

Parameters
  • data (dict) – The raw API data.

  • req_xp (list) – A list of the required XP.

  • collection (str) – The collection to modify the dict with.

  • c (dict) – The dict to modify.

Returns

The modified dict.

Return type

dict

static getLevel(req_xp, xp, *, subtract=True)

Gets a level from required xp and total xp.

Parameters
  • req_xp (list) – The required XP.

  • xp (float) – The total XP.

  • subtract (bool) – Whether or not to subtract from xp. Defaults to True

Returns

The level.

Return type

int

class Items

A class containing all the Hypixel SkyBlock Item IDs.

ids

A dict of every SkyBlock item ID.

class GameInfo

New in version 0.1.9.

Contains information on some games and their IDs.

apinames

A dict containing game names and what they’re referred to in the API.

databasenames

A dict containing game names and what they’re referred to in the Hypixel database (I assume).

ids

A dict containing the game’s API names and IDs.