Score .java

net.minecraft.scoreboard.Score (class): members: getScoreScoreboard, theScoreObjective, scoreComparator, scorePlayerName, getScorePoints, setScorePoints.

net.minecraft.scoreboardclass117 linescommon3.0 KB

API Surface (12)

int compare(Score p_compare_1_, Score p_compare_2_)
void increseScore(int amount)
void decreaseScore(int amount)
void func_96648_a()
int getScorePoints()
void setScorePoints(int points)
ScoreObjective getObjective()
String getPlayerName()
Scoreboard getScoreScoreboard()
boolean isLocked()
void setLocked(boolean locked)
void func_96651_a(List<EntityPlayer> p_96651_1_)

Fields & Constants (7)

scoreComparator
theScoreboard
theScoreObjective
scorePlayerName
scorePoints
locked
forceUpdate

String literals (1)

"Cannot modify read-only score"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

Score.java117 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.scoreboard;
2
3
import java.util.Comparator;
4
import java.util.List;
5
import net.minecraft.entity.player.EntityPlayer;
6
7
public class Score
8
{
9
    public static final Comparator<Score> scoreComparator = new Comparator<Score>()
10
    {
11
        public int compare(Score p_compare_1_, Score p_compare_2_)
12
        {
13
            return p_compare_1_.getScorePoints() > p_compare_2_.getScorePoints() ? 1 : (p_compare_1_.getScorePoints() < p_compare_2_.getScorePoints() ? -1 : p_compare_2_.getPlayerName().compareToIgnoreCase(p_compare_1_.getPlayerName()));
14
        }
15
    };
16
    private final Scoreboard theScoreboard;
17
    private final ScoreObjective theScoreObjective;
18
    private final String scorePlayerName;
19
    private int scorePoints;
20
    private boolean locked;
21
    private boolean forceUpdate;
22
23
    public Score(Scoreboard theScoreboardIn, ScoreObjective theScoreObjectiveIn, String scorePlayerNameIn)
24
    {
25
        this.theScoreboard = theScoreboardIn;
26
        this.theScoreObjective = theScoreObjectiveIn;
27
        this.scorePlayerName = scorePlayerNameIn;
28
        this.forceUpdate = true;
29
    }
30
31
    public void increseScore(int amount)
32
    {
33
        if (this.theScoreObjective.getCriteria().isReadOnly())
34
        {
35
            throw new IllegalStateException("Cannot modify read-only score");
36
        }
37
        else
38
        {
39
            this.setScorePoints(this.getScorePoints() + amount);
40
        }
41
    }
42
43
    public void decreaseScore(int amount)
44
    {
45
        if (this.theScoreObjective.getCriteria().isReadOnly())
46
        {
47
            throw new IllegalStateException("Cannot modify read-only score");
48
        }
49
        else
50
        {
51
            this.setScorePoints(this.getScorePoints() - amount);
52
        }
53
    }
54
55
    public void func_96648_a()
56
    {
57
        if (this.theScoreObjective.getCriteria().isReadOnly())
58
        {
59
            throw new IllegalStateException("Cannot modify read-only score");
60
        }
61
        else
62
        {
63
            this.increseScore(1);
64
        }
65
    }
66
67
    public int getScorePoints()
68
    {
69
        return this.scorePoints;
70
    }
71
72
    public void setScorePoints(int points)
73
    {
74
        int i = this.scorePoints;
75
        this.scorePoints = points;
76
77
        if (i != points || this.forceUpdate)
78
        {
79
            this.forceUpdate = false;
80
            this.getScoreScoreboard().func_96536_a(this);
81
        }
82
    }
83
84
    public ScoreObjective getObjective()
85
    {
86
        return this.theScoreObjective;
87
    }
88
89
    /**
90
     * Returns the name of the player this score belongs to
91
     */
92
    public String getPlayerName()
93
    {
94
        return this.scorePlayerName;
95
    }
96
97
    public Scoreboard getScoreScoreboard()
98
    {
99
        return this.theScoreboard;
100
    }
101
102
    public boolean isLocked()
103
    {
104
        return this.locked;
105
    }
106
107
    public void setLocked(boolean locked)
108
    {
109
        this.locked = locked;
110
    }
111
112
    public void func_96651_a(List<EntityPlayer> p_96651_1_)
113
    {
114
        this.setScorePoints(this.theScoreObjective.getCriteria().setScore(p_96651_1_));
115
    }
116
}
117

Deobfuscated MCP 1.8.9 source of Score from Marcelektro/MavenMCP-1.8.9 (net/minecraft/scoreboard/Score.java), stored verbatim.