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


Java EntityLivingBase.addToPlayerScore方法代码示例

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


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

示例1: onDeath

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@Override
public void onDeath(DamageSource dmg)
   {
       if (ForgeHooks.onLivingDeath(this, dmg)) return;
       Entity entity = dmg.getEntity();
       EntityLivingBase entitylivingbase = this.func_94060_bK();

       if (this.scoreValue >= 0 && entitylivingbase != null) { entitylivingbase.addToPlayerScore(this, this.scoreValue); }

       if (entity != null) { entity.onKillEntity(this); }	// Informing the killer about this
       
       this.worldObj.playSoundAtEntity(this, "random.break", 0.8f, 0.3f);

       if (!this.worldObj.isRemote)	// Spill it all (server-side)
       {
       	AI_Storage.dropFirstWeapon(this);
       	if (this.hasWeaponUpgrade) { AI_Storage.dropSecondWeapon(this); }
       	AI_Storage.dropParts(this);
       	AI_Storage.dropStoredItems(this);
       	
       	if (this.hasCommunicationUpgrade && AI_Targeting.isNameOnWhitelist(this, Commands.cmdTellDeath))
       	{
       		AI_Communication.tellOwnerAboutDeath(this);	// Whelp, you should probably know about this
       	}
       }
       
       this.dead = true;
       this.func_110142_aN().func_94549_h();

       this.worldObj.setEntityState(this, (byte) 3);
   }
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:32,代码来源:Entity_AA.java

示例2: onDeath

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    if (this.worldObj.getGameRules().getBoolean("showDeathMessages"))
    {
        Team team = this.getTeam();

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

    if (!this.worldObj.getGameRules().getBoolean("keepInventory"))
    {
        this.inventory.dropAllItems();
    }

    for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount))
    {
        Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective);
        score.func_96648_a();
    }

    EntityLivingBase entitylivingbase = this.func_94060_bK();

    if (entitylivingbase != null)
    {
        EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase)));

        if (entitylist$entityegginfo != null)
        {
            this.triggerAchievement(entitylist$entityegginfo.field_151513_e);
        }

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

    this.triggerAchievement(StatList.deathsStat);
    this.func_175145_a(StatList.timeSinceDeathStat);
    this.getCombatTracker().reset();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:56,代码来源:EntityPlayerMP.java

示例3: onDeath

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的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

示例4: onDeath

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的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

示例5: onDeath

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的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.entity.EntityLivingBase.addToPlayerScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。