use of net.silentchaos512.gear.util.DataResource in project Silent-Gear by SilentChaos512.
the class PartBuilder method trait.
public PartBuilder trait(DataResource<ITrait> trait, int level, ITraitCondition... conditions) {
ITraitInstance inst = TraitInstance.of(trait, level, conditions);
this.traits.add(inst);
return this;
}
use of net.silentchaos512.gear.util.DataResource in project Silent-Gear by SilentChaos512.
the class CuriosCompat method getHighestTraitLevel.
public static int getHighestTraitLevel(LivingEntity entity, DataResource<ITrait> trait) {
LazyOptional<IItemHandlerModifiable> lazy = CuriosApi.getCuriosHelper().getEquippedCurios(entity);
int max = 0;
if (lazy.isPresent()) {
IItemHandlerModifiable handler = lazy.orElseThrow(IllegalStateException::new);
for (int i = 0; i < handler.getSlots(); ++i) {
ItemStack stack = handler.getStackInSlot(i);
if (stack.getItem() instanceof ICoreItem) {
max = Math.max(max, TraitHelper.getTraitLevel(stack, trait));
}
}
}
return max;
}
use of net.silentchaos512.gear.util.DataResource in project Silent-Gear by SilentChaos512.
the class MaterialBuilder method trait.
public MaterialBuilder trait(PartType partType, DataResource<ITrait> trait, int level, ITraitCondition... conditions) {
ITraitInstance inst = TraitInstance.of(trait, level, conditions);
List<ITraitInstance> list = traits.computeIfAbsent(partType, pt -> new ArrayList<>());
list.add(inst);
return this;
}
Aggregations