SummoningEggItem

An EffectiveItem that spawns a custom entity when right-clicked on a block, like a vanilla spawn egg.

A subclass provides getSpawnEffectiveEntity and optionally getSpawnPlacement. Usually you don't subclass this directly — ru.hukm.effectiveSpigot.minecraft.entities.EffectiveEntityWithSpawnEgg creates one automatically for an entity type.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Where the entity appears relative to the clicked block.

Functions

Link copied to clipboard
fun addBrewRecipe(inputIngredient: ItemStack, inputBasePotionMeta: PotionMeta, fuelUse: Int, cookingTime: Int)

Registers a brewing-stand recipe that yields this item.

Link copied to clipboard
fun addClickHandler(click: EffectiveAbstractInteract.Click, callback: InteractCallback, ifRightClickOpenContainer: Boolean = false, cooldownData: EffectiveAbstractInteract.CooldownData<EffectiveClickable.EventsCallOptions>? = null)

Registers a click handler for stacks of this custom item (matched by key). To instead handle a plain vanilla Material, register through EffectiveClickable.addClickHandler with a non-custom stack.

Link copied to clipboard
fun additionalKey(name: String): NamespacedKey

Resolves the persistent-data key for the declared additional arg name — use it to read the per-stack value via EffectiveDataContainerUtils. See getAdditionalArgs for the full flow.

Link copied to clipboard
fun addShapelessCraft(ingredients: List<Any>)

Registers a shapeless recipe that yields this item.

Link copied to clipboard
fun addToLoot(dropChance: (Player?) -> Double, lootTables: List<LootTables>?, blocks: List<Material>?, entities: List<EntityType>?, amount: (Player?) -> IntRange? = null)

Makes this item drop from the given sources.

Link copied to clipboard
fun createItemStack(): ItemStack

Creates a single stack of this item, fully finalized (meta, identity, behaviours).

fun createItemStack(amount: Int): ItemStack

Creates a stack of amount copies of this item.

fun createItemStack(additionalArgs: List<String>): ItemStack
fun createItemStack(amount: Int, additionalArgs: List<String>): ItemStack
Link copied to clipboard
open fun createItemStackCallback(item: ItemStack)

Hook run on the finished stack after meta, identity and behaviours are applied.

Link copied to clipboard
open override fun editMeta(meta: ItemMeta)

Configures the stack's meta (name, lore, model, …). Called during every createItemStack.

Link copied to clipboard
fun equalByNamespacedKey(item: ItemStack): Boolean

Whether item is a stack of this item (matched by namespaced key).

Whether effectiveItem is the same registered item as this one.

Link copied to clipboard
open override fun getAdditionalArgs(): AdditionalArgs?

Declares extra, per-stack parameters this item accepts — values baked into an individual stack's persistent data at creation time, so two stacks of the same item can carry different settings (e.g. a "radius" or "power" tuned per stack).

Link copied to clipboard
fun getAdditionalArgsNamespacedKeys(): List<Pair<NamespacedKey, PersistentDataType<*, *>>>?

Namespaced keys backing this item's getAdditionalArgs (key → PDC type), or null if none.

Link copied to clipboard
open override fun getMaterial(): Material

The base Material the item is built from.

Link copied to clipboard
abstract fun getNamespacedData(): Pair<JavaPlugin, String>

Owning plugin and a plugin-unique id; together they form the getNamespacedName.

Link copied to clipboard

Unique identity of the item as "<plugin-name>/<id>", both lowercased.

Link copied to clipboard

Optional resource-pack texture/model info for this item. When non-null, the framework generates the pack model/texture for it, and createItemStack automatically sets the stack's item_model to <plugin-namespace>:<id> so the custom texture shows — unless editMeta already set one.

Link copied to clipboard

The entity type spawned when the egg is used.

Link copied to clipboard

Placement of the spawned entity relative to the clicked block (default: vanilla).

Link copied to clipboard
fun makeDurable(maxUses: Int)

Gives this item a durability bar acting as a limited-use counter.

Link copied to clipboard
fun makeThrowable(velocity: Double = 1.5, consumeOnThrow: Boolean = true, throwSound: Sound? = Sound.ENTITY_SNOWBALL_THROW, onHit: (ProjectileHitEvent) -> Unit)

Makes this item throwable: right-clicking launches a snowball carrying the item, and onHit runs when it lands. The projectile is identified by the item stored inside it.

Link copied to clipboard

Prevents this item from being dropped, and keeps it in the inventory on death.

Link copied to clipboard

Allows this item to be equipped to the head slot (right-click or helmet-slot drag).

Link copied to clipboard
open override fun showAdditionArgsInLore(): Boolean

Whether the getAdditionalArgs values are appended to the item's lore automatically.