use of net.silentchaos512.gear.api.part.PartType in project Silent-Gear by SilentChaos512.
the class IStatModProvider method getStat.
default float getStat(D instance, PartType partType, StatGearKey key, ItemStack gear) {
ItemStat stat = ItemStats.get(key.getStat());
if (stat == null)
return key.getStat().getDefaultValue();
Collection<StatInstance> mods = getStatModifiers(instance, partType, key, gear);
return stat.compute(mods);
}
use of net.silentchaos512.gear.api.part.PartType in project Silent-Gear by SilentChaos512.
the class PartGearKey method read.
public static PartGearKey read(String key) {
String[] parts = key.split("/");
if (parts.length != 2) {
throw new JsonParseException("invalid key: " + key);
}
PartType partType = PartType.getNonNull(Objects.requireNonNull(SilentGear.getIdWithDefaultNamespace(parts[0])));
if (partType.isInvalid()) {
throw new JsonParseException("Unknown part type: " + parts[0]);
}
GearType gearType = GearType.get(parts[1]);
if (gearType.isInvalid()) {
throw new JsonParseException("Unknown gear type: " + parts[1]);
}
return new PartGearKey(gearType, partType);
}
Aggregations