Class SpawnerCoreItem.SpawnerCoreStats
java.lang.Object
me.desht.pneumaticcraft.common.item.SpawnerCoreItem.SpawnerCoreStats
- All Implemented Interfaces:
ISpawnerCoreStats
- Enclosing class:
- SpawnerCoreItem
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAmount(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 coreintgetPercentage(net.minecraft.world.entity.EntityType<?> entityType) Get the percentage of the core that the given entity type occupiesintGet the unoccupied percentage of the corenet.minecraft.world.entity.EntityType<?>pickEntity(boolean includeUnused) Pick a weighted random entity from the core.voidserialize(net.minecraft.world.item.ItemStack stack) Serialize the current stats onto the given ItemStack, which must be a Spawner Core
-
Method Details
-
serialize
public void serialize(net.minecraft.world.item.ItemStack stack) Description copied from interface:ISpawnerCoreStatsSerialize the current stats onto the given ItemStack, which must be a Spawner Core- Specified by:
serializein interfaceISpawnerCoreStats- Parameters:
stack- an ItemStack
-
getEntities
Description copied from interface:ISpawnerCoreStatsGet the entity types stored in this spawner core- Specified by:
getEntitiesin interfaceISpawnerCoreStats- Returns:
- a set of entity types
-
getPercentage
public int getPercentage(net.minecraft.world.entity.EntityType<?> entityType) Description copied from interface:ISpawnerCoreStatsGet the percentage of the core that the given entity type occupies- Specified by:
getPercentagein interfaceISpawnerCoreStats- Parameters:
entityType- an entity type- Returns:
- a percentage level
-
getUnusedPercentage
public int getUnusedPercentage()Description copied from interface:ISpawnerCoreStatsGet the unoccupied percentage of the core- Specified by:
getUnusedPercentagein interfaceISpawnerCoreStats- Returns:
- a percentage level
-
addAmount
public boolean addAmount(net.minecraft.world.entity.EntityType<?> type, int toAdd) Description copied from interface:ISpawnerCoreStatsUpdate 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:
addAmountin interfaceISpawnerCoreStats- Parameters:
type- an entity typetoAdd- 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:ISpawnerCoreStatsPick a weighted random entity from the core.- Specified by:
pickEntityin interfaceISpawnerCoreStats- 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
-