Custom Totems

A custom totem is a normal EcoItem with the vanilla death_protection component, which makes any item save the player from death while held: the item is used up, the player survives, and the effects you choose are applied. This page covers adding that behaviour on top of a standard item.

Quick start

  1. Open /plugins/EcoItems/items/ and create your totem's file, e.g. totem_of_rebirth.yml.

  2. Set up the item: section as you would for any item (see How to Make an Item).

  3. Add the minecraft:death_protection component with the death_effects you want.

  4. Run /ecoitems reload.

  5. Preview the use animation with /ecoitems totem totem_of_rebirth.

  6. Give yourself the totem with /ecoitems give <player> totem_of_rebirth, hold it, and take lethal damage in survival to confirm it saves you.

The structure of a totem

PartWhat it controls
ItemThe base item, display, and recipe, identical to any EcoItem
minecraft:death_protectionThe effects applied when it saves the player
minecraft:max_stack_sizeHow many can stack; vanilla totems don't stack
# === Item: a normal EcoItem ===
item:
  item: totem_of_undying
  name: "&6Totem of Rebirth"
  texture: item/totem_of_rebirth # Paid version; also shown in the use animation

  # === The death protection, as a vanilla component ===
  components:
    "minecraft:max_stack_size": 1

    # Read here: https://minecraft.wiki/w/Data_component_format#death_protection
    "minecraft:death_protection":
      death_effects: # Optional; applied in order when it saves the player
        - type: "minecraft:clear_all_effects" # Removes every effect first
        - type: "minecraft:apply_effects"
          effects:
            - id: "minecraft:regeneration" # The potion effect ID
              duration: 900 # Duration in ticks
              amplifier: 2 # The effect level, starting at 0
            - id: "minecraft:absorption"
              duration: 200
              amplifier: 3
            - id: "minecraft:fire_resistance"
              duration: 800
              amplifier: 0
          probability: 1.0 # Optional; chance the effects are applied, 0.0 to 1.0

Item

The item: section is the same as any other EcoItem; see How to Make an Item. The totem only works in the main hand or offhand, like a vanilla totem.

A totem is still a full EcoItem, so the top-level effects: and conditions: work too. For behaviour beyond potion effects, use the resurrect trigger, which fires when a totem saves the player:

effects:
  - id: send_message
    args:
      message: "&6The Totem of Rebirth saved you!"
    triggers:
      - resurrect

Death effects

death_effects takes the same consume effects as food, applied in order:

typeWhat it does
minecraft:apply_effectsApplies effects (a list of potion effects) with a probability
minecraft:remove_effectsRemoves the listed effects (effect IDs or a tag)
minecraft:clear_all_effectsRemoves every effect
minecraft:teleport_randomlyTeleports the player randomly within diameter blocks
minecraft:play_soundPlays a sound

The vanilla totem clears all effects, then applies Regeneration II for 45 seconds, Absorption II for 5 seconds, and Fire Resistance for 40 seconds.


Where to go next

  • Item types: Custom Foods for the same consume effects on food.

  • Commands: Commands and Permissions for /ecoitems totem.

  • The base item: How to Make an Item for the shared item, display, and recipe fields.