Search in sources :

Example 1 with ItemStatistic

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

the class SpongeGameRegistry method getItemStatistic.

@SuppressWarnings("ConstantConditions")
@Override
public Optional<ItemStatistic> getItemStatistic(StatisticType statType, ItemType itemType) {
    checkNotNull(statType, "null stat type");
    checkNotNull(itemType, "null item type");
    Item item = (Item) itemType;
    if (statType.equals(StatisticTypes.ITEMS_CRAFTED)) {
        return Optional.of((ItemStatistic) StatList.getCraftStats(item));
    } else if (statType.equals(StatisticTypes.ITEMS_USED)) {
        return Optional.of((ItemStatistic) StatList.getObjectUseStats(item));
    } else if (statType.equals(StatisticTypes.ITEMS_BROKEN)) {
        return Optional.of((ItemStatistic) StatList.getObjectBreakStats(item));
    } else if (statType.equals(StatisticTypes.ITEMS_PICKED_UP)) {
        return Optional.of((ItemStatistic) StatList.getObjectsPickedUpStats(item));
    } else if (statType.equals(StatisticTypes.ITEMS_DROPPED)) {
        return Optional.of((ItemStatistic) StatList.getDroppedObjectStats(item));
    }
    throw new IllegalArgumentException("invalid item stat type");
}
Also used : Item(net.minecraft.item.Item) ItemStatistic(org.spongepowered.api.statistic.ItemStatistic)

Aggregations

Item (net.minecraft.item.Item)1 ItemStatistic (org.spongepowered.api.statistic.ItemStatistic)1