Search in sources :

Example 1 with ScoreCriteria

use of net.minecraft.scoreboard.ScoreCriteria in project takumicraft by TNTModders.

the class TakumiEvents method onPlayerUpdate.

@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent event) {
    if (TakumiConfigCore.useTP && event.getEntityLiving() instanceof EntityPlayer) {
        Scoreboard scoreboard = event.getEntityLiving().world.getScoreboard();
        ScoreObjective objective = scoreboard.getObjective("tp") == null ? scoreboard.addScoreObjective("tp", new ScoreCriteria("tp_crit")) : scoreboard.getObjective("tp");
        Score score = scoreboard.getOrCreateScore(event.getEntityLiving().getName(), objective);
        scoreboard.setObjectiveInDisplaySlot(1, objective);
    }
}
Also used : Score(net.minecraft.scoreboard.Score) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) Scoreboard(net.minecraft.scoreboard.Scoreboard) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ScoreCriteria(net.minecraft.scoreboard.ScoreCriteria) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Score (net.minecraft.scoreboard.Score)1 ScoreCriteria (net.minecraft.scoreboard.ScoreCriteria)1 ScoreObjective (net.minecraft.scoreboard.ScoreObjective)1 Scoreboard (net.minecraft.scoreboard.Scoreboard)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1