Search in sources :

Example 1 with IMaterialModifier

use of net.silentchaos512.gear.api.material.modifier.IMaterialModifier in project Silent-Gear by SilentChaos512.

the class MaterialInstance method getStatModifiers.

@Override
public Collection<StatInstance> getStatModifiers(PartType partType, StatGearKey key, ItemStack gear) {
    List<StatInstance> mods = new ArrayList<>(material.getStatModifiers(this, partType, key, gear));
    ItemStat stat = ItemStats.get(key.getStat());
    if (stat == null) {
        SilentGear.LOGGER.warn("Unknown item stat: {}", key.getStat().getStatId());
        SilentGear.LOGGER.catching(new NullPointerException());
        return mods;
    }
    // Material modifiers (grades, starcharged, etc.)
    for (IMaterialModifier materialModifier : getModifiers()) {
        mods = materialModifier.modifyStats(partType, key, mods);
    }
    GetMaterialStatsEvent event = new GetMaterialStatsEvent(this, stat, partType, mods);
    MinecraftForge.EVENT_BUS.post(event);
    return event.getModifiers();
}
Also used : StatInstance(net.silentchaos512.gear.api.stats.StatInstance) IMaterialModifier(net.silentchaos512.gear.api.material.modifier.IMaterialModifier) GetMaterialStatsEvent(net.silentchaos512.gear.api.event.GetMaterialStatsEvent) ItemStat(net.silentchaos512.gear.api.stats.ItemStat)

Aggregations

GetMaterialStatsEvent (net.silentchaos512.gear.api.event.GetMaterialStatsEvent)1 IMaterialModifier (net.silentchaos512.gear.api.material.modifier.IMaterialModifier)1 ItemStat (net.silentchaos512.gear.api.stats.ItemStat)1 StatInstance (net.silentchaos512.gear.api.stats.StatInstance)1