Guía YAML uis/

Diseñar UIs

Las pantallas de EventUI se definen como archivos .yml en plugins/EventUI/uis/. Cada archivo describe una pantalla completa con elementos, posiciones, sonidos y transiciones.

Estructura de una pantalla

uis/mi-pantalla.yml — estructura completa
id: "mi-pantalla"
title: ""
screen_width: 1366       # escala automáticamente a la resolución del cliente
screen_height: 720

screen_properties:
  pause_game: "false"
  blur: false                           # booleano sin comillas
  transition_in: "scale_up"
  transition_out: "none"
  transition_duration: "300"            # milisegundos
  transition_easing: "ease_in_out_quad"
  open_sound: "minecraft:ui.toast.in"   # vacío = sin sonido
  open_sound_volume: "1.0"
  open_sound_pitch: "1.0"
  close_sound: ""
  close_sound_volume: "0.5"

elements:
  - id: "mi-elemento"
    type: IMAGE
    x: 0
    y: 0
    width: 200
    height: 200
    properties:
      texture: "eventui:textures/ui/fondo.png"

screen_properties disponibles

PropiedadTipoDescripción
pause_game"true" / "false"Si la pantalla pausa el juego al abrirse.
blurtrue / falseBlur del mundo de fondo. Sin comillas.
transition_inStringAnimación de entrada: scale_up, slide_left, slide_right, fade, none.
transition_outStringAnimación de salida. Mismos valores.
transition_duration"300"Duración de la transición en milisegundos.
transition_easingStringlinear, ease_in, ease_out, ease_in_out, ease_in_out_quad.
open_soundStringSonido al abrir la pantalla. Vacío = sin sonido.
open_sound_volume"1.0"Volumen de apertura (0.0 – 2.0).
open_sound_pitch"1.0"Tono de apertura.
close_soundStringSonido al cerrar.
close_sound_volume"0.5"Volumen de cierre.

Campos comunes de todos los elementos

CampoObligatorioDescripción
id✅ SíIdentificador único dentro del archivo.
type✅ SíTipo en mayúsculas: IMAGE, IMAGE_BUTTON, BUTTON, TEXT, PROGRESS_BAR, ENTITY_RENDER, TOOLTIP, ITEM_RENDER, BLOCK_RENDER, PANEL, ICON.
x✅ SíPosición X. Con anchor activo funciona como offset adicional.
y✅ SíPosición Y.
widthNoAncho. Default: 100.
heightNoAlto. Default: 20.
z_indexNoOrden de capas — mayor = encima. Default: 0.
visibleNoVisibilidad estática. Default: true.
propertiesVaríaPropiedades específicas del tipo.
childrenNoElementos hijos: tooltips, sub-botones, renders de entidades.

Sistema de anclas

Con anchor en properties, el elemento se posiciona relativo a un punto de la pantalla. Los campos x e y pasan a ser offsets desde ese punto, y anchor_offset_x / anchor_offset_y dan un desplazamiento adicional.

Ejemplo con anchor
- id: "btn-volver"
  type: IMAGE_BUTTON
  x: 0
  y: 0
  width: 65
  height: 65
  properties:
    anchor: "bottom_center"
    anchor_offset_x: 0
    anchor_offset_y: -50      # 50px hacia arriba desde el borde inferior
    texture: "eventui:textures/ui/logo/logo.png"
    action: "open:main-menu"
ValorPosición
top_leftEsquina superior izquierda
top_centerCentro superior
top_rightEsquina superior derecha
center_leftCentro izquierdo
centerCentro de la pantalla
center_rightCentro derecho
bottom_leftEsquina inferior izquierda
bottom_centerCentro inferior
bottom_rightEsquina inferior derecha

Visibilidad condicional — visible_if

Muestra u oculta un elemento según el valor de una variable de estado del servidor. Perfecto para mostrar contenido bloqueado o desbloqueado según el progreso del jugador.

Ejemplo — carta bloqueada vs desbloqueada
# Solo visible si zombie_card_unlocked NO es "true"
- id: "carta-bloqueada"
  type: IMAGE_BUTTON
  x: 0
  y: 0
  width: 250
  height: 250
  properties:
    anchor: "center_left"
    anchor_offset_x: 0
    anchor_offset_y: -125
    visible_if: "zombie_card_unlocked != true"
    texture: "eventui:textures/ui/widgets/tarjeta_bloqueada.png"
    hover_animation: "zoom_in"
    hover_animation_intensity: "1.03"
    hover_hitbox: "texture_alpha"
    action: ""

# Solo visible si zombie_card_unlocked ES "true"
- id: "carta-desbloqueada"
  type: IMAGE_BUTTON
  x: 0
  y: 0
  width: 250
  height: 250
  properties:
    anchor: "center_left"
    anchor_offset_x: 0
    anchor_offset_y: -125
    visible_if: "zombie_card_unlocked == true"
    texture: "eventui:textures/ui/widgets/tarjeta_desbloqueada.png"
    hover_animation: "zoom_in"
    hover_animation_intensity: "1.03"
    hover_hitbox: "texture_alpha"
    action: ""
  children:
    - id: "render-zombie"
      type: ENTITY_RENDER
      x: 100
      y: 100
      width: 50
      height: 50
      properties:
        entity: "minecraft:zombie"
        scale: "35"
        rotation_mode: "spin"
        spin_speed: "0.5"
        y_offset: "0"

Las variables se establecen desde el servidor con /eventui setuivar <jugador> <clave> <valor>. Los operadores disponibles son == y !=.

Tipos de elementos

IMAGE

Imagen estática para fondos, títulos y decoraciones.

IMAGE
- id: "titulo"
  type: IMAGE
  x: 0
  y: 0
  width: 500
  height: 100
  properties:
    anchor: "top_center"
    anchor_offset_x: 0
    anchor_offset_y: 75
    texture: "eventui:textures/ui/titles/mi_titulo.png"

IMAGE_BUTTON

El elemento más completo. Botón con textura personalizada, ícono, animación hover, sonidos, hitbox preciso y texturas de estado por evento.

IMAGE_BUTTON — todas las propiedades
- id: "mi-boton"
  type: IMAGE_BUTTON
  x: 0
  y: 0
  width: 100
  height: 100
  properties:
    anchor: "center"
    anchor_offset_x: -100
    anchor_offset_y: -125

    # Texturas
    texture: "eventui:textures/ui/books/blue_book.png"
    hover_texture: "eventui:textures/ui/books/hovers/blue_book_hover.png"
    in_progress_texture: "eventui:textures/ui/widgets/icon_in_progress.png"
    completed_texture: "eventui:textures/ui/widgets/icon_completed.png"

    # Ícono de ítem encima de la textura
    icon: "minecraft:diamond"
    icon_scale: "0.7"              # escala del ícono (default: "1")

    # Animación de hover
    hover_animation: "zoom_in"
    hover_animation_intensity: "1.15"

    # Sonidos
    hover_sound: "minecraft:ui.toast.in"
    hover_sound_volume: "1.8"
    hover_sound_pitch: "1.3"
    click_sound: "minecraft:item.book.page_turn"
    click_sound_volume: "1.0"
    click_sound_pitch: "1.0"

    # Hitbox del hover
    hover_hitbox: "texture_alpha"  # "box" (default) | "texture_alpha"

    # Visibilidad condicional
    visible_if: "mi_variable == true"

    # Acción al clic
    action: "open:otra-pantalla"
PropiedadDescripción
textureTextura base.
hover_textureTextura al pasar el cursor. Opcional.
in_progress_textureTextura cuando el evento vinculado está en progreso.
completed_textureTextura cuando el evento está completado.
iconResourceLocation del ítem renderizado encima.
icon_scaleEscala del ícono. "1" = normal, "0.7" = 70%.
hover_animationAnimación al hacer hover. Ver referencia de animaciones.
hover_animation_intensityIntensidad de la animación.
hover_soundSonido al pasar el cursor. Vacío = sin sonido.
hover_sound_volumeVolumen hover (0.0 – 2.0).
hover_sound_pitchTono hover.
click_soundSonido al clic. Vacío = sonido por defecto del sistema.
click_sound_volumeVolumen clic.
click_sound_pitchTono clic.
hover_hitbox"box": rectángulo completo (default). "texture_alpha": solo píxeles opacos — ideal para formas irregulares.
visible_ifCondición de visibilidad. Operadores: == y !=.
actionAcción al clic. Ver tabla de acciones abajo.

BUTTON

Botón de texto estilo vanilla.

BUTTON
- id: "btn-cerrar"
  type: BUTTON
  x: 150
  y: 260
  width: 100
  height: 22
  properties:
    text: "§7← Cerrar"
    action: "close"

TEXT

Texto con colores, alineación y sombra.

TEXT
- id: "nombre"
  type: TEXT
  x: 110
  y: 50
  width: 0
  height: 0
  properties:
    content: "§6Zombie"
    shadow: true
    align: "center"    # left | center | right

PROGRESS_BAR

PROGRESS_BAR
- id: "barra"
  type: PROGRESS_BAR
  x: 68
  y: 190
  width: 128
  height: 8
  properties:
    event_id: "matar-zombies"
    objective_id: "kill-zombies"
    color: "5cb85c"
    background_color: "2a2a2a"

ENTITY_RENDER

Renderiza una entidad viva en 3D. Compatible con entidades de mods.

ENTITY_RENDER
- id: "render-zombie"
  type: ENTITY_RENDER
  x: 100
  y: 100
  width: 50
  height: 50
  properties:
    entity: "minecraft:zombie"    # mods: "modid:nombre_entidad"
    scale: "35"
    rotation_mode: "spin"         # spin | fixed | follow_mouse
    spin_speed: "0.5"
    y_offset: "0"

TOOLTIP

Siempre como hijo (children) de otro elemento. Se muestra al pasar el cursor sobre el padre.

render_type: "standard" — fondo vanilla
children:
  - id: "tooltip-libro"
    type: TOOLTIP
    x: 0
    y: 0
    width: 0
    height: 0
    properties:
      render_type: "standard"
      content: "§1Árbol Tecnológico\n§7Consulta las recetas disponibles"
      shadow: "true"
render_type: "text" — texto flotante sin fondo
children:
  - id: "tooltip-mision"
    type: TOOLTIP
    x: 0
    y: 0
    width: 0
    height: 0
    properties:
      render_type: "text"
      content: "Consigue un casco de diamante."
      shadow: "true"
render_type: "advanced" — receta de crafting
children:
  - id: "tooltip-receta"
    type: TOOLTIP
    x: 0
    y: 0
    width: 0
    height: 0
    properties:
      render_type: "advanced"
      content: |
        recipe: minecraft:diamond_chestplate [frame:eventui:textures/ui/widgets/crafting_frame.png]
El formato del tooltip advanced con receta es recipe: namespace:id [frame:ruta_textura]. El parámetro frame es opcional y define la textura del marco del crafteo.
render_typeDescripción
standardFondo estilo vanilla. Soporta \n y códigos §.
textTexto flotante sin fondo. Soporta shadow y saltos de línea.
advancedTooltip enriquecido con recetas, ítems, entidades, imágenes y separadores.

Acciones de botones

AcciónDescripción
open:<id>Abre otra pantalla. Ejemplo: open:main-menu
closeCierra la pantalla actual.
backVuelve a la pantalla anterior en la pila de navegación.
start_event:<id>Inicia el evento indicado.
abandon_event:<id>Abandona el evento. Pide confirmación si no es repetible.
none o vacíoSin acción — botón decorativo.

Sonidos

Todos los sonidos usan ResourceLocation estándar. Puedes usar sonidos de vanilla o de tu resource pack:

Ejemplos de sonidos
# Vanilla
"minecraft:ui.toast.in"
"minecraft:ui.button.click"
"minecraft:item.book.page_turn"

# Resource pack personalizado
"eventui:ui.hover"
"eventui:ui.click"
Deja el campo del sonido en blanco ("") para desactivarlo. Si omites el campo por completo, los botones usarán el sonido de clic por defecto del sistema.

Data binding

Los textos soportan variables dinámicas con la sintaxis {variable}:

Variables disponibles
# Variable de estado del servidor (establecida con /eventui setuivar)
content: "Puntos: {state.puntos_totales}"

# Progreso de un objetivo
content: "Zombies: {event.matar-zombies.kill-zombies.current}/{event.matar-zombies.kill-zombies.target}"
Debug overlay: presiona F3 + Shift con la pantalla abierta para ver posiciones, dimensiones e IDs de todos los elementos. Esencial para ajustar layouts con anclas.