java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
io.github.thebusybiscuit.slimefun4.implementation.items.blocks.AbstractMonsterSpawner
All Implemented Interfaces:
DistinctiveItem, ItemAttribute, Placeable
Direct Known Subclasses:
BrokenSpawner, RepairedSpawner

public abstract class AbstractMonsterSpawner extends SlimefunItem implements DistinctiveItem
This is a parent class for the BrokenSpawner and RepairedSpawner to provide some utility methods.
Author:
TheBusyBiscuit
See Also:
  • Method Details

    • getEntityType

      @Nonnull public Optional<org.bukkit.entity.EntityType> getEntityType(@Nonnull org.bukkit.inventory.ItemStack item)
      This method tries to obtain an EntityType from a given ItemStack. The provided ItemStack must be a RepairedSpawner item.
      Parameters:
      item - The ItemStack to extract the EntityType from
      Returns:
      An Optional describing the result
    • getItemForEntityType

      @Nonnull public org.bukkit.inventory.ItemStack getItemForEntityType(@Nullable org.bukkit.entity.EntityType type)
      This method returns a finished ItemStack of this SlimefunItem, modified to hold and represent the given EntityType. It updates the lore and BlockStateMeta to reflect the specified EntityType.
      Parameters:
      type - The EntityType to apply
      Returns:
      An ItemStack for this SlimefunItem holding that EntityType
    • canStack

      public boolean canStack(@Nonnull org.bukkit.inventory.meta.ItemMeta itemMetaOne, @Nonnull org.bukkit.inventory.meta.ItemMeta itemMetaTwo)
      Description copied from interface: DistinctiveItem
      This method is called by SlimefunUtils.isItemSimilar(org.bukkit.inventory.ItemStack, org.bukkit.inventory.ItemStack, boolean) when two SlimefunItemStack IDs match on a DistinctiveItem and should return if the two items can stack with one another.
      Specified by:
      canStack in interface DistinctiveItem
      Parameters:
      itemMetaOne - The ItemMeta of the first stack being compared.
      itemMetaTwo - The ItemMeta of the second stack being compared.
      Returns:
      Whether the two ItemMetas are stackable