Search in sources :

Example 1 with EntityStatistic

use of org.spongepowered.api.statistic.EntityStatistic in project SpongeCommon by SpongePowered.

the class SpongeGameRegistry method getEntityStatistic.

@Override
public Optional<EntityStatistic> getEntityStatistic(StatisticType statType, EntityType entityType) {
    checkNotNull(statType, "null stat type");
    checkNotNull(entityType, "null entity type");
    EntityList.EntityEggInfo eggInfo = EntityList.ENTITY_EGGS.get(new ResourceLocation(entityType.getId()));
    if (statType.equals(StatisticTypes.ENTITIES_KILLED)) {
        return Optional.of((EntityStatistic) eggInfo.killEntityStat);
    } else if (statType.equals(StatisticTypes.KILLED_BY_ENTITY)) {
        return Optional.of((EntityStatistic) eggInfo.entityKilledByStat);
    }
    throw new IllegalArgumentException("invalid entity stat type");
}
Also used : EntityStatistic(org.spongepowered.api.statistic.EntityStatistic) ResourceLocation(net.minecraft.util.ResourceLocation) EntityList(net.minecraft.entity.EntityList)

Aggregations

EntityList (net.minecraft.entity.EntityList)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 EntityStatistic (org.spongepowered.api.statistic.EntityStatistic)1