Core - Schemas Module
anvil.lib.schemas
AddonDescriptor
An object representing an addon descriptor with validation for names and namespaces.
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
Name | Type | Description |
---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The name of the addon object. |
__init__(name, is_vanilla=False, is_vanilla_allowed=False)
Constructs all the necessary attributes for the AddonObject object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the addon object. |
required |
is_vanilla
|
bool
|
If the object is from vanilla Minecraft. Defaults to False. |
False
|
is_vanilla_allowed
|
bool
|
If overriding vanilla objects is allowed. Defaults to False. |
False
|
AddonObject
Bases: AddonDescriptor
An object representing an addon with functionality to modify its content, queue it for processing, and export it.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the addon object. |
is_vanilla |
bool
|
Indicates if the object is from vanilla Minecraft. |
object_type |
str
|
The type of the addon object. |
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
Name | Type | Description |
---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The name of the addon object. |
__init__(name, is_vanilla=False)
Constructs all the necessary attributes for the AddonObject object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the addon object. |
required |
content(content)
Sets the content of the addon object and returns the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
any
|
The content to be set for the addon object. |
required |
Returns:
Name | Type | Description |
---|---|---|
self |
AddonObject
|
The instance of the current AddonObject. |
do_not_shorten()
Setter property that disables shortening of dict
when exporting.
queue(directory=None)
Queues the addon object for processing and logs the event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str
|
The directory of the addon object. |
None
|
Returns:
Name | Type | Description |
---|---|---|
self |
AddonObject
|
The instance of the current AddonObject. |
JsonSchemes
A class used to read and write to the json_schemes.json file.
MinecraftBlockDescriptor
Bases: AddonDescriptor
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
Name | Type | Description |
---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The name of the addon object. |
states
property
Returns a string representation of the block states.
tags
property
Returns the tags associated with the block.
MinecraftDescription
Bases: AddonDescriptor
Handles Minecraft descriptions.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the Minecraft object. |
is_vanilla |
bool
|
If the object is from vanilla Minecraft. Defaults to False. |
identifier
property
Returns the identifier of the addon object in the format 'namespace:name'.
Returns:
Name | Type | Description |
---|---|---|
str |
Identifier
|
The identifier of the addon object. |
name
property
Returns the name of the addon object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The name of the addon object. |