Tutorial: "Mob hijacker" item - pantonshire/Vulcan GitHub Wiki

NOTE: This tutorial was made for Vulcan Alpha 0.2.0 and is not guaranteed to work in other versions.


In this tutorial, I'll assume that you've already made an item. If you haven't, try this tutorial first.
This is a very fun item that allows you to ride whatever entity you want by just left-clicking it! Creeper? Sure! Wither Boss? No problem! And the best part is: you'll have made it yourself!

Setting up the file

  • First, make a new Vulcan file.
  • Set up a basic item like so:
type: item

attributes:
   set name to "Mob Hijacker"
   set description to "Left-click a mob to hijack it!"

Adding a hit_entity behaviour

  • This should all look familiar. Now to start doing some new stuff. Below what you've written, add the following line:
    hit_entity:
  • This line tells Vulcan that whatever code you write next, it should be run every time a mob is hit with the item.
  • Below this, write:
    tell attacker to ride target
  • This line will tell your player character to start riding whatever you hit with the item. It doesn't matter whether it's a pig, a zombie, or even the wither boss!
  • By hitting the entity, we've been mean to it; we've taken some of its health away! Let's be generous and give it its health back.
  • Write tell target to heal 1 health to give the mob its health back.

That's it! You just made a really cool item!

Finished code
Here's the completed code I wrote:

type: item

attributes:
    set name to "Mob Hijacker"
    set description to "Left-click a mob to hijack it!"
    set texture to "example_texture"

hit_entity:
    tell attacker to ride target
    tell target to heal 1 health