MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / StatBase

Class StatBase

src/main/java/net/minecraft/stats/StatBase.java:13–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import net.minecraft.util.IJsonSerializable;
12
13public class StatBase
14{
15 /** The Stat ID */
16 public final String statId;
17
18 /** The Stat name */
19 private final IChatComponent statName;
20 public boolean isIndependent;
21 private final IStatType type;
22 private final IScoreObjectiveCriteria field_150957_c;
23 private Class <? extends IJsonSerializable > field_150956_d;
24 private static NumberFormat numberFormat = NumberFormat.getIntegerInstance(Locale.US);
25 public static IStatType simpleStatType = new IStatType()
26 {
27 public String format(int p_75843_1_)
28 {
29 return StatBase.numberFormat.format(p_75843_1_);
30 }
31 };
32 private static DecimalFormat decimalFormat = new DecimalFormat("########0.00");
33 public static IStatType timeStatType = new IStatType()
34 {
35 public String format(int p_75843_1_)
36 {
37 double d0 = (double)p_75843_1_ / 20.0D;
38 double d1 = d0 / 60.0D;
39 double d2 = d1 / 60.0D;
40 double d3 = d2 / 24.0D;
41 double d4 = d3 / 365.0D;
42 return d4 > 0.5D ? StatBase.decimalFormat.format(d4) + " y" : (d3 > 0.5D ? StatBase.decimalFormat.format(d3) + " d" : (d2 > 0.5D ? StatBase.decimalFormat.format(d2) + " h" : (d1 > 0.5D ? StatBase.decimalFormat.format(d1) + " m" : d0 + " s")));
43 }
44 };
45 public static IStatType distanceStatType = new IStatType()
46 {
47 public String format(int p_75843_1_)
48 {
49 double d0 = (double)p_75843_1_ / 100.0D;
50 double d1 = d0 / 1000.0D;
51 return d1 > 0.5D ? StatBase.decimalFormat.format(d1) + " km" : (d0 > 0.5D ? StatBase.decimalFormat.format(d0) + " m" : p_75843_1_ + " cm");
52 }
53 };
54 public static IStatType field_111202_k = new IStatType()
55 {
56 public String format(int p_75843_1_)
57 {
58 return StatBase.decimalFormat.format((double)p_75843_1_ * 0.1D);
59 }
60 };
61
62 public StatBase(String statIdIn, IChatComponent statNameIn, IStatType typeIn)
63 {
64 this.statId = statIdIn;
65 this.statName = statNameIn;
66 this.type = typeIn;
67 this.field_150957_c = new ObjectiveStat(this);
68 IScoreObjectiveCriteria.INSTANCES.put(this.field_150957_c.getName(), this.field_150957_c);
69 }
70

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected