当前位置: 首页>>代码示例>>Java>>正文


Java Score.incrementScore方法代码示例

本文整理汇总了Java中net.minecraft.scoreboard.Score.incrementScore方法的典型用法代码示例。如果您正苦于以下问题:Java Score.incrementScore方法的具体用法?Java Score.incrementScore怎么用?Java Score.incrementScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.scoreboard.Score的用法示例。


在下文中一共展示了Score.incrementScore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: giveTeamKillScores

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
private Collection<ScoreObjective> giveTeamKillScores(Entity p_175137_1_)
{
    String s = p_175137_1_ instanceof EntityPlayer ? p_175137_1_.getName() : p_175137_1_.getCachedUniqueIdString();
    ScorePlayerTeam scoreplayerteam = this.getWorldScoreboard().getPlayersTeam(this.getName());

    if (scoreplayerteam != null)
    {
        int i = scoreplayerteam.getChatFormat().getColorIndex();

        if (i >= 0 && i < IScoreCriteria.KILLED_BY_TEAM.length)
        {
            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.KILLED_BY_TEAM[i]))
            {
                Score score = this.getWorldScoreboard().getOrCreateScore(s, scoreobjective);
                score.incrementScore();
            }
        }
    }

    ScorePlayerTeam scoreplayerteam1 = this.getWorldScoreboard().getPlayersTeam(s);

    if (scoreplayerteam1 != null)
    {
        int j = scoreplayerteam1.getChatFormat().getColorIndex();

        if (j >= 0 && j < IScoreCriteria.TEAM_KILL.length)
        {
            return this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.TEAM_KILL[j]);
        }
    }

    return Lists.<ScoreObjective>newArrayList();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:34,代码来源:EntityPlayer.java

示例2: onDeath

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    //-ZMod-Death---------------------------------------------------------
    ZHandle.handle("onPlayerDeath", this);
    //--------------------------------------------------------------------
 
    boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
    this.connection.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag));

    if (flag)
    {
        Team team = this.getTeam();

        if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS)
        {
            if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS)
            {
                this.mcServer.getPlayerList().sendMessageToAllTeamMembers(this, this.getCombatTracker().getDeathMessage());
            }
            else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM)
            {
                this.mcServer.getPlayerList().sendMessageToTeamOrAllPlayers(this, this.getCombatTracker().getDeathMessage());
            }
        }
        else
        {
            this.mcServer.getPlayerList().sendChatMsg(this.getCombatTracker().getDeathMessage());
        }
    }

    if (!this.world.getGameRules().getBoolean("keepInventory") && !this.isSpectator())
    {
        this.func_190776_cN();
        this.inventory.dropAllItems();
    }

    for (ScoreObjective scoreobjective : this.world.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.DEATH_COUNT))
    {
        Score score = this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective);
        score.incrementScore();
    }

    EntityLivingBase entitylivingbase = this.getAttackingEntity();

    if (entitylivingbase != null)
    {
        EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.ENTITY_EGGS.get(EntityList.func_191301_a(entitylivingbase));

        if (entitylist$entityegginfo != null)
        {
            this.addStat(entitylist$entityegginfo.entityKilledByStat);
        }

        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    this.addStat(StatList.DEATHS);
    this.takeStat(StatList.TIME_SINCE_DEATH);
    this.extinguish();
    this.setFlag(0, false);
    this.getCombatTracker().reset();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:66,代码来源:EntityPlayerMP.java

示例3: onDeath

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
    this.connection.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag));

    if (flag)
    {
        Team team = this.getTeam();

        if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS)
        {
            if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS)
            {
                this.mcServer.getPlayerList().sendMessageToAllTeamMembers(this, this.getCombatTracker().getDeathMessage());
            }
            else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM)
            {
                this.mcServer.getPlayerList().sendMessageToTeamOrAllPlayers(this, this.getCombatTracker().getDeathMessage());
            }
        }
        else
        {
            this.mcServer.getPlayerList().sendChatMsg(this.getCombatTracker().getDeathMessage());
        }
    }

    if (!this.world.getGameRules().getBoolean("keepInventory") && !this.isSpectator())
    {
        this.func_190776_cN();
        this.inventory.dropAllItems();
    }

    for (ScoreObjective scoreobjective : this.world.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.DEATH_COUNT))
    {
        Score score = this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective);
        score.incrementScore();
    }

    EntityLivingBase entitylivingbase = this.getAttackingEntity();

    if (entitylivingbase != null)
    {
        EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.ENTITY_EGGS.get(EntityList.func_191301_a(entitylivingbase));

        if (entitylist$entityegginfo != null)
        {
            this.addStat(entitylist$entityegginfo.entityKilledByStat);
        }

        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    this.addStat(StatList.DEATHS);
    this.takeStat(StatList.TIME_SINCE_DEATH);
    this.extinguish();
    this.setFlag(0, false);
    this.getCombatTracker().reset();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:62,代码来源:EntityPlayerMP.java

示例4: onDeath

import net.minecraft.scoreboard.Score; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return;
    boolean flag = this.worldObj.getGameRules().getBoolean("showDeathMessages");
    this.connection.sendPacket(new SPacketCombatEvent(this.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag));

    if (flag)
    {
        Team team = this.getTeam();

        if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS)
        {
            if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS)
            {
                this.mcServer.getPlayerList().sendMessageToAllTeamMembers(this, this.getCombatTracker().getDeathMessage());
            }
            else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM)
            {
                this.mcServer.getPlayerList().sendMessageToTeamOrAllPlayers(this, this.getCombatTracker().getDeathMessage());
            }
        }
        else
        {
            this.mcServer.getPlayerList().sendChatMsg(this.getCombatTracker().getDeathMessage());
        }
    }

    if (!this.worldObj.getGameRules().getBoolean("keepInventory") && !this.isSpectator())
    {
        captureDrops = true;
        capturedDrops.clear();

        this.inventory.dropAllItems();

        captureDrops = false;
        net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0);
        if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
        {
            for (net.minecraft.entity.item.EntityItem item : capturedDrops)
            {
                this.worldObj.spawnEntityInWorld(item);
            }
        }
    }

    for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.DEATH_COUNT))
    {
        Score score = this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective);
        score.incrementScore();
    }

    EntityLivingBase entitylivingbase = this.getAttackingEntity();

    if (entitylivingbase != null)
    {
        EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.ENTITY_EGGS.get(EntityList.getEntityString(entitylivingbase));

        if (entitylist$entityegginfo != null)
        {
            this.addStat(entitylist$entityegginfo.entityKilledByStat);
        }

        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    this.addStat(StatList.DEATHS);
    this.takeStat(StatList.TIME_SINCE_DEATH);
    this.getCombatTracker().reset();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:73,代码来源:EntityPlayerMP.java


注:本文中的net.minecraft.scoreboard.Score.incrementScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。