use of net.silentchaos512.gear.api.material.IMaterialInstance in project Silent-Gear by SilentChaos512.
the class CompoundMaterial method getPartTypes.
@Override
public Set<PartType> getPartTypes(IMaterialInstance material) {
List<IMaterialInstance> subMaterials = getMaterials(material);
if (subMaterials.isEmpty()) {
return Collections.emptySet();
} else if (subMaterials.size() == 1) {
return subMaterials.get(0).getPartTypes();
}
Set<PartType> set = new LinkedHashSet<>(subMaterials.get(0).getPartTypes());
for (int i = 1; i < subMaterials.size(); ++i) {
Set<PartType> set1 = subMaterials.get(i).getPartTypes();
Set<PartType> toRemove = new HashSet<>();
for (PartType type : set) {
if (!set1.contains(type)) {
toRemove.add(type);
}
}
set.removeAll(toRemove);
}
return set;
}
use of net.silentchaos512.gear.api.material.IMaterialInstance in project Silent-Gear by SilentChaos512.
the class CompoundMaterial method getTraits.
@Override
public Collection<TraitInstance> getTraits(IMaterialInstance material, PartGearKey partKey, ItemStack gear) {
List<IMaterialInstance> materials = new ArrayList<>(getMaterials(material));
List<TraitInstance> traits = TraitHelper.getTraits(materials, partKey, ItemStack.EMPTY);
Collection<TraitInstance> ret = new ArrayList<>();
for (TraitInstance inst : traits) {
if (inst.conditionsMatch(partKey, ItemStack.EMPTY, materials)) {
ret.add(inst);
}
}
return ret;
}
use of net.silentchaos512.gear.api.material.IMaterialInstance in project Silent-Gear by SilentChaos512.
the class CraftedMaterial method getTraits.
@Override
public Collection<TraitInstance> getTraits(IMaterialInstance material, PartGearKey partKey, ItemStack gear) {
Collection<TraitInstance> ret = super.getTraits(material, partKey, gear);
IMaterialInstance base = getBaseMaterial(material);
ret.addAll(base.getTraits(partKey, gear));
return ret;
}
use of net.silentchaos512.gear.api.material.IMaterialInstance in project Silent-Gear by SilentChaos512.
the class CraftedMaterial method getStatKeys.
@Override
public Collection<StatGearKey> getStatKeys(IMaterialInstance material, PartType type) {
Collection<StatGearKey> ret = new LinkedHashSet<>(super.getStatKeys(material, type));
IMaterialInstance base = getBaseMaterial(material);
ret.addAll(base.getStatKeys(type));
return ret;
}
use of net.silentchaos512.gear.api.material.IMaterialInstance in project Silent-Gear by SilentChaos512.
the class CompoundMaterialItem method appendHoverText.
@Override
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
if (Config.Client.showMaterialTooltips.get()) {
Collection<IMaterialInstance> materials = getSubMaterials(stack);
TextListBuilder statsBuilder = new TextListBuilder();
for (IMaterialInstance material : materials) {
int nameColor = material.getNameColor(PartType.MAIN, GearType.ALL);
statsBuilder.add(TextUtil.withColor(material.getDisplayName(PartType.MAIN).copy(), nameColor));
}
tooltip.addAll(statsBuilder.build());
}
}
Aggregations