Skip to content

Core - Enums Module

anvil.lib.jsonmodel.enums

Anvil's enums: targets, slots, block traits and states, JSON UI values and more.

Anchor

Bases: StrEnum

Enumeration representing the two anchor points that can be used in Minecraft: the feet and the eyes.

BlockCornerValues

Bases: StrEnum

Enumeration representing the corner and cardinal directions for block placement in Minecraft.

BlockFaceValues

Bases: StrEnum

Enumeration representing the different faces of a block in Minecraft.

BlockMaterial

Bases: StrEnum

Enumeration representing the different types of rendering methods a block can use in Minecraft.

Opaque: Used for a regular block texture without an alpha layer. Does not allow for transparency or translucency DoubleSided: Used for completely disabling backface culling. Blend: Used for a block like stained glass. Allows for transparency and translucency (slightly transparent textures). AlphaTest: Used for a block like the monster spawner. Does not allow for translucency, only fully opaque or fully transparent textures. Also disabled backface culling. AlphaTestSingleSided: Used for a block like the (unstained) glass. Does not allow for translucency, only fully opaque or fully transparent textures. Also enables backface culling. BlendToOpaque: Will blend like stained glass in the near render and turn opaque on the far render. AlphaTestToOpaque: Used for a block like the leaves. Does not allow for translucency, only fully opaque or fully transparent textures in the near render and turn only opaque on the far render. Also disabled backface culling. AlphaTestSingleSidedToOpaque: Used for a block like the sugar cane. Does not allow for translucency, only fully opaque or fully transparent textures in the near render and turn only opaque on the far render. Also enables backface culling.

BlockSoundGroup

Bases: StrEnum

The vanilla block sound groups, the ones blocks.json gives vanilla blocks (oak planks use Wood). They hold every sound event of a block: break, place, step, door and button clicks.

CardinalConnectionStates

Bases: StrEnum

Enumeration representing the connected faces of a block in Minecraft, used for blocks that can connect to adjacent blocks (e.g., fences, walls).

ControlSchemes

Bases: StrEnum

Enumeration representing the different control schemes in Minecraft Bedrock.

DamageCause

Bases: StrEnum

Enumeration for the different causes of damage in the game.

Difficulty

Bases: StrEnum

Enumeration for the different levels of game difficulty.

Dimension

Bases: StrEnum

Enumeration for the different dimensions in the game.

DurationInfoMode

Bases: StrEnum

Enumeration for how a server-side sound definition's duration is tracked.

EnchantsSlots

Bases: StrEnum

Enumeration of enchantment slots available in Minecraft.

This enum defines all possible equipment slots that can receive enchantments, organized by equipment type and usage category.

Armor Slots

ArmorHead: Helmet slot enchantments ArmorTorso: Chestplate slot enchantments ArmorLegs: Leggings slot enchantments ArmorFeet: Boots slot enchantments GArmor: General armor enchantments (applicable to any armor piece)

Weapon Slots

Sword: Sword-specific enchantments Bow: Bow-specific enchantments Spear: Spear/trident enchantments Crossbow: Crossbow-specific enchantments MeleeSpear: Melee trident enchantments

Tool Slots

GTool: General tool enchantments (applicable to multiple tool types) Hoe: Hoe-specific enchantments Shears: Shears-specific enchantments Flintandsteel: Flint and steel enchantments Shield: Shield-specific enchantments

Digging Tools

GDigging: General digging tool enchantments Axe: Axe-specific enchantments Pickaxe: Pickaxe-specific enchantments Shovel: Shovel-specific enchantments

Special Items

FishingRod: Fishing rod enchantments CarrotStick: Carrot on a stick enchantments Elytra: Elytra wing enchantments CosmeticHead: Cosmetic head item enchantments

FeatureRulePlacementPass

Bases: StrEnum

Enumeration for the different feature rule placement passes in Minecraft.

FilterEquipmentDomain

Bases: StrEnum

Enumeration representing the different equipment domains that can be used in filters in Minecraft.

FilterOperation

Bases: StrEnum

Enumeration representing the different operations that can be used in filters in Minecraft.

FilterSubject

Bases: StrEnum

Enumeration representing the different subjects that can be used in filters in Minecraft.

FogCameraLocation

Bases: StrEnum

Enumeration for the different locations of the fog camera in the game.

ItemCategory

Bases: StrEnum

Enumeration representing the categories of blocks and items that can be used in Minecraft.

LeashSpringType

Bases: StrEnum

Enumeration for the different types of leash springs in Minecraft.

Bouncy: Simulates a highly elastic spring that never reaches an equilibrium if the leashed entity is suspended mid-air. Dampened: Simulates a dampened spring attached to the front of the leashed entity's collision. It reaches an equilibrium if the entity is suspended mid-air and aligns with the movement direction. QuadDampened: Simulates four dampened springs connected to the center of each side of the entities' collisions. It reaches an equilibrium if the entity is suspended mid-air and gradually aligns with the leash holder over time.

LootPoolType

Bases: StrEnum

Enumeration for the different types of loot pools.

MaterialDefinitions

Bases: StrEnum

Enumeration representing the different definitions that can be set for a material in Minecraft.

MaterialFunc

Bases: StrEnum

Enumeration representing the different functions that can be set for a material in Minecraft.

MaterialOperation

Bases: StrEnum

Enumeration representing the different operations that can be set for a material in Minecraft.

MaterialStates

Bases: StrEnum

Enumeration representing the different states a material can be in Minecraft.

MusicCategory

Bases: StrEnum

Enumeration for the different categories of music in the game.

Population

Bases: StrEnum

Enumeration for the different types of in-game populations.

RenderDistanceType

Bases: StrEnum

Enumeration for the different types of render distances in the game.

RideableDismountMode

Bases: StrEnum

Enumeration for the different modes of dismounting a rideable entity in Minecraft.

Slots

Bases: StrEnum

Enumeration for the different types of inventory slots in the game.

SoundCategory

Bases: StrEnum

Enumeration for the different categories of sounds in the game.

SupportedBy

Bases: StrEnum

Where the block holding up a supported block is.

Below = 'below' class-attribute instance-attribute

The block below.

BlockFace = 'block_face' class-attribute instance-attribute

The block it was placed against, read from minecraft:block_face.

Facing = 'facing' class-attribute instance-attribute

The block its minecraft:cardinal_direction points at.

Sign = 'sign' class-attribute instance-attribute

The block below when its standing state is on, otherwise the block its minecraft:cardinal_direction points at.

Target

Bases: StrEnum

Enumeration for the types of targets that can be selected in Minecraft.

UIAnchor

Bases: StrEnum

Enumeration of anchor positions for UI element layout.

Anchors determine how elements are positioned relative to their parent containers.

Attributes:

Name Type Description
Center

Center position

TopLeft

Top-left corner

TopMiddle

Top center

TopRight

Top-right corner

LeftMiddle

Left center

RightMiddle

Right center

BottomLeft

Bottom-left corner

BottomMiddle

Bottom center

BottomRight

Bottom-right corner

UIAnimType

Bases: StrEnum

Enumeration of animation types.

Defines the different types of animations that can be applied to UI elements.

Attributes:

Name Type Description
Alpha

Transparency/opacity animation

Clip

Clipping animation

Color

Color transition animation

Flip_book

Frame-based flipbook animation

Offset

Position offset animation

Size

Size scaling animation

UV

Texture coordinate animation

Wait

Pause/delay animation

Aseprite_flip_book

Aseprite-based flipbook animation

UIBindingType

Bases: StrEnum

Enumeration of UI binding types for data connections.

Binding types determine how UI elements connect to data sources and how they respond to data changes.

Attributes:

Name Type Description
View

Binds to view-level data (element properties)

Global

Binds to global game data

Collection

Binds to collection data (arrays, lists)

CollectionDetails

Binds to specific collection item details

NONE

No binding applied

UIEasing

Bases: StrEnum

Enumeration of easing functions for animations.

Easing functions control the rate of change in animations, providing smooth transitions and natural motion effects.

Attributes:

Name Type Description
Linear

Constant rate of change

Spring

Spring-like motion

InQuad, (OutQuad, InOutQuad)

Quadratic easing variations

InCubic, (OutCubic, InOutCubic)

Cubic easing variations

InQuart, (OutQuart, InOutQuart)

Quartic easing variations

InQuint, (OutQuint, InOutQuint)

Quintic easing variations

InSine, (OutSine, InOutSine)

Sinusoidal easing variations

InExpo, (OutExpo, InOutExpo)

Exponential easing variations

InCirc, (OutCirc, InOutCirc)

Circular easing variations

InBounce, (OutBounce, InOutBounce)

Bouncing easing variations

InBack, (OutBack, InOutBack)

Back easing variations

InElastic, (OutElastic, InOutElastic)

Elastic easing variations

UIElementTrigger

Bases: StrEnum

Enumeration of trigger types for UI element activation.

Defines when and how UI elements are triggered to appear or activate.

Attributes:

Name Type Description
Title

Triggered by title/subtitle display

Actionbar

Triggered by actionbar message display

NONE

No trigger (always active or manually controlled)

UIElementType

Bases: StrEnum

Enumeration of UI element types.

Defines the different types of UI elements that can be created within the framework.

Attributes:

Name Type Description
Image

Image element for displaying textures

Panel

Container element for grouping other elements

Label

Text display element

Screen

Top-level screen container

Factory

Dynamic element generator

StackPanel

Container that arranges children in a stack

Grid

Container that arranges children in a grid layout

Custom

Custom renderer element

Button

Interactive button element

CollectionPanel

A stack panel for collections that does not stack its children

InputPanel

A panel that accepts input

Toggle

A toggle with a checked and an unchecked state

Dropdown

A toggle that opens a dropdown

Slider

A range input

SliderBox

The handle of a slider

EditBox

A text field

ScrollView

A scrolling panel

ScrollbarTrack

The track of a scrollbar

ScrollbarBox

The handle of a scrollbar

SelectionWheel

A selection wheel

UIFontSize

Bases: StrEnum

Enumeration of font size options.

Defines the available font sizes for text elements.

Attributes:

Name Type Description
Normal

Standard font size

Small

Smaller font size

Large

Larger font size

ExtraLarge

Extra large font size

UITextAlignment

Bases: StrEnum

Enumeration of text alignment options.

Defines how text content is aligned within text elements.

Attributes:

Name Type Description
Center

Center-aligned text

Left

Left-aligned text

Right

Right-aligned text

Weather

Bases: StrEnum

Enumeration representing the different types of weather that can be set in Minecraft.

expand_block_face_sides(faces)

Expand BlockFaceValues.Side and BlockFaceValues.All into explicit face lists.

Side expands to the four cardinal directions (North, South, East, West). All expands to all six faces. The input list is not mutated; a new list is returned.