Interface SulfurCube

All Superinterfaces:
AbstractCubeMob, Ageable, Attributable, Audience, Bucketable, CommandSender, Creature, Damageable, DataComponentView, Entity, Frictional, HoverEventSource<HoverEvent.ShowEntity>, Leashable, LivingEntity, Lootable, Metadatable, Mob, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ProjectileSource, ServerOperator, Shearable, Sound.Emitter, Sound.Source.Provider

@NullMarked public interface SulfurCube extends AbstractCubeMob, Shearable, Bucketable, Ageable
Represents a Sulfur Cube.
  • Method Details

    • getFuseTicks

      int getFuseTicks()
      Gets the amount of ticks until this sulfur cube explode.
      Returns:
      the fuse ticks or -1 if not exploding
    • setFuseTicks

      void setFuseTicks(int ticks)
      Sets the amount of ticks until this sulfur cube explode.
      Parameters:
      ticks - the new fuse ticks
    • canExplode

      boolean canExplode()
      Determines whether this sulfur cube is capable of exploding.
      Returns:
      true if the sulfur cube can explode, false otherwise
    • ignite

      boolean ignite(boolean imminent)
      Ignites this sulfur cube, beginning its fuse if canExplode() is true.

      The amount of time the sulfur cube takes to explode is defined in the SulfurCube.Archetype of the entity and further controlled by the imminent parameter.

      This action can be cancelled using EntityIgniteEvent. The resulting explosion can also be cancelled by an ExplosionPrimeEvent and obeys the mob griefing gamerule.

      Parameters:
      imminent - if true the fuse time is shortened but still depends on the SulfurCube.Archetype
      Returns:
      whether the sulfur cube got ignited
      See Also:
    • ignite

      default boolean ignite()
      Ignites this sulfur cube, beginning its fuse if canExplode() is true.

      The amount of time the sulfur cube takes to explode is defined in the SulfurCube.Archetype of the entity.

      This action can be cancelled using EntityIgniteEvent. The resulting explosion can also be cancelled by an ExplosionPrimeEvent and obeys the mob griefing gamerule.

      Returns:
      whether the sulfur cube got ignited
      See Also:
    • swallow

      boolean swallow(ItemStack itemStack)
      Makes this sulfur cube swallow the provided item, following any Vanilla logic.

      This method will:

      • not equip the item to a baby sulfur cube,
      • if present, drop a previously swallowed item, and
      • play the swallow sound.

      If the currently swallowed item is changed, a EntityEquipmentChangedEvent is called. May also call a EntityAddToWorldEvent for the newly dropped Item entity.

      Parameters:
      itemStack - the item to swallow. Use ItemStack.empty() to unset the item. Items not in the ItemTypeTagKeys.SULFUR_CUBE_SWALLOWABLE tag will not be properly rendered inside the sulfur cube
      Returns:
      whether the sulfur cube's absorbed item was updated
      See Also:
    • setEquipped

      default void setEquipped(ItemStack itemStack)
      Sets the swallowed item stack for this sulfur cube.

      This method acts as a simple utility method to set the EquipmentSlot.BODY equipment slot of this sulfur cube, which holds the sulfur cube's swallowed item.

      Different to swallow(ItemStack), this method does not play a sound or drop the previously equipped item on the ground.

      This method will call a EntityEquipmentChangedEvent.

      Parameters:
      itemStack - the item stack to be equipped, use ItemStack.empty() to unset the item
      See Also:
    • getEquipped

      default ItemStack getEquipped()
      Retrieves the item stack currently swallowed by this sulfur cube.

      This method acts as a simple utility method to get the EquipmentSlot.BODY equipment slot of this sulfur cube, which holds the sulfur cube's swallowed item.

      Returns:
      the item stack in the EquipmentSlot.BODY equipment slot, returns ItemStack.empty() if no item is present