本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}