Class SpawnerCoreItem.SpawnerCoreStats

java.lang.Object
me.desht.pneumaticcraft.common.item.SpawnerCoreItem.SpawnerCoreStats
All Implemented Interfaces:
ISpawnerCoreStats
Enclosing class:
SpawnerCoreItem

public static class SpawnerCoreItem.SpawnerCoreStats extends Object implements ISpawnerCoreStats
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addAmount(net.minecraft.world.entity.EntityType<?> type, int toAdd)
    Update the percentage level for the given entity type.
    Set<net.minecraft.world.entity.EntityType<?>>
    Get the entity types stored in this spawner core
    int
    getPercentage(net.minecraft.world.entity.EntityType<?> entityType)
    Get the percentage of the core that the given entity type occupies
    int
    Get the unoccupied percentage of the core
    net.minecraft.world.entity.EntityType<?>
    pickEntity(boolean includeUnused)
    Pick a weighted random entity from the core.
    void
    serialize(net.minecraft.world.item.ItemStack stack)
    Serialize the current stats onto the given ItemStack, which must be a Spawner Core

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • serialize

      public void serialize(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: ISpawnerCoreStats
      Serialize the current stats onto the given ItemStack, which must be a Spawner Core
      Specified by:
      serialize in interface ISpawnerCoreStats
      Parameters:
      stack - an ItemStack
    • getEntities

      public Set<net.minecraft.world.entity.EntityType<?>> getEntities()
      Description copied from interface: ISpawnerCoreStats
      Get the entity types stored in this spawner core
      Specified by:
      getEntities in interface ISpawnerCoreStats
      Returns:
      a set of entity types
    • getPercentage

      public int getPercentage(net.minecraft.world.entity.EntityType<?> entityType)
      Description copied from interface: ISpawnerCoreStats
      Get the percentage of the core that the given entity type occupies
      Specified by:
      getPercentage in interface ISpawnerCoreStats
      Parameters:
      entityType - an entity type
      Returns:
      a percentage level
    • getUnusedPercentage

      public int getUnusedPercentage()
      Description copied from interface: ISpawnerCoreStats
      Get the unoccupied percentage of the core
      Specified by:
      getUnusedPercentage in interface ISpawnerCoreStats
      Returns:
      a percentage level
    • addAmount

      public boolean addAmount(net.minecraft.world.entity.EntityType<?> type, int toAdd)
      Description copied from interface: ISpawnerCoreStats
      Update the percentage level for the given entity type. The update level will be clamped so that does not go below zero, or leaves the total occupation of the core greater than 100%.

      The updated level is not automatically serialized to an ItemStack; see ISpawnerCoreStats.serialize(ItemStack) for that.

      Specified by:
      addAmount in interface ISpawnerCoreStats
      Parameters:
      type - an entity type
      toAdd - the amount to adjust by, may be negative
      Returns:
      true if any change was made, false otherwise
    • pickEntity

      public net.minecraft.world.entity.EntityType<?> pickEntity(boolean includeUnused)
      Description copied from interface: ISpawnerCoreStats
      Pick a weighted random entity from the core.
      Specified by:
      pickEntity in interface ISpawnerCoreStats
      Parameters:
      includeUnused - if true, the unused percentage will be taken into account, leading to a possible null return value
      Returns:
      an entity type, or null if no entity type was selected