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


Java EntityPlayerMP.takeStat方法代码示例

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


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

示例1: onEntityDeath

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@HarshenEvent
public void onEntityDeath(LivingDeathEvent event)
{
	event.setCanceled(true);
	World world = event.getEntityLiving().world;
	if(!world.isRemote)
	{
		boolean flag = world.getGameRules().getBoolean("showDeathMessages");
		EntityPlayerMP player = (EntityPlayerMP) event.getEntity();
		player.connection.sendPacket(new SPacketCombatEvent(player.getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, flag));
        if (flag)
        {
            Team team = player.getTeam();
            if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS)
                if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS)
                	player.mcServer.getPlayerList().sendMessageToAllTeamMembers(player, player.getCombatTracker().getDeathMessage());
                else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM)
                	player.mcServer.getPlayerList().sendMessageToTeamOrAllPlayers(player, player.getCombatTracker().getDeathMessage());
            else
            	player.mcServer.getPlayerList().sendMessage(player.getCombatTracker().getDeathMessage());
        }

        for (ScoreObjective scoreobjective : world.getScoreboard().getObjectivesFromCriteria(IScoreCriteria.DEATH_COUNT))
            player.getWorldScoreboard().getOrCreateScore(player.getName(), scoreobjective).incrementScore();

        EntityLivingBase entitylivingbase = player.getAttackingEntity();

        if (entitylivingbase != null)
        {
            EntityList.EntityEggInfo entitylist$entityegginfo = EntityList.ENTITY_EGGS.get(EntityList.getKey(entitylivingbase));
            if (entitylist$entityegginfo != null)
            	player.addStat(entitylist$entityegginfo.entityKilledByStat);
        }
        player.addStat(StatList.DEATHS);
        player.takeStat(StatList.TIME_SINCE_DEATH);
        player.extinguish();
        HarshenUtils.setFlag(player, 0, false);
        player.getCombatTracker().reset();
        INVENTORY_MAP.put(event.getEntity().getUniqueID(), ((EntityPlayer)event.getEntity()).inventory.writeToNBT(new NBTTagList()));
        HarshenUtils.damageOccuringItemNoPacket(player, HarshenItems.SOUL_BINDING_PENDANT, 1);
        if(HarshenUtils.getFirstOccuringItem(player, HarshenItems.SOUL_BINDING_PENDANT).getItemDamage() == 
        		HarshenUtils.getFirstOccuringItem(player, HarshenItems.SOUL_BINDING_PENDANT).getMaxDamage())
        			HarshenUtils.damageOccuringItemNoPacket(player, HarshenItems.SOUL_BINDING_PENDANT, 1);    	
	}	
	new HandlerHarshenInventory().onPlayerDeath(event);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:47,代码来源:SoulBindingPendant.java


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