-
Notifications
You must be signed in to change notification settings - Fork 755
/
TieredMaterialSectionTransformer.java
39 lines (34 loc) · 1.71 KB
/
TieredMaterialSectionTransformer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package slimeknights.tconstruct.library.client.book.sectiontransformer.materials;
import com.google.common.collect.ImmutableSet;
import slimeknights.tconstruct.library.materials.MaterialRegistry;
import slimeknights.tconstruct.library.materials.definition.IMaterial;
import slimeknights.tconstruct.library.materials.stats.IMaterialStats;
import slimeknights.tconstruct.library.materials.stats.MaterialStatsId;
import slimeknights.tconstruct.tools.stats.HandleMaterialStats;
import slimeknights.tconstruct.tools.stats.HeadMaterialStats;
import slimeknights.tconstruct.tools.stats.StatlessMaterialStats;
import java.util.Set;
/** @deprecated use {@link TierRangeMaterialSectionTransformer} */
@Deprecated
public class TieredMaterialSectionTransformer extends AbstractMaterialSectionTransformer {
private static final Set<MaterialStatsId> VISIBLE_STATS = ImmutableSet.of(HeadMaterialStats.ID, HandleMaterialStats.ID, StatlessMaterialStats.BINDING.getIdentifier());
private final int materialTier;
public TieredMaterialSectionTransformer(String sectionName, int materialTier, boolean detailed) {
super(sectionName, detailed);
this.materialTier = materialTier;
}
@Override
protected boolean isValidMaterial(IMaterial material) {
if (material.getTier() != this.materialTier) {
return false;
}
// only show material stats for types with the proper stat types, as otherwise the page will be empty
// if you want to show another stat type, just override this method/implement the parent class
for (IMaterialStats stats : MaterialRegistry.getInstance().getAllStats(material.getIdentifier())) {
if (VISIBLE_STATS.contains(stats.getIdentifier())) {
return true;
}
}
return false;
}
}