• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IScoreCriteria类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IScoreCriteria类属于net.minecraft.scoreboard包,在下文中一共展示了IScoreCriteria类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addToPlayerScore

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
/**
 * Adds to the players score.
 */
public void addToPlayerScore(Entity entityIn, int amount)
{
    if (entityIn != this)
    {
        this.addScore(amount);
        Collection<ScoreObjective> collection = this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.TOTAL_KILL_COUNT);

        if (entityIn instanceof EntityPlayer)
        {
            this.addStat(StatList.PLAYER_KILLS);
            collection.addAll(this.getWorldScoreboard().getObjectivesFromCriteria(IScoreCriteria.PLAYER_KILL_COUNT));
        }
        else
        {
            this.addStat(StatList.MOB_KILLS);
        }

        collection.addAll(this.giveTeamKillScores(entityIn));

        for (ScoreObjective scoreobjective : collection)
        {
            this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).incrementScore();
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:29,代码来源:EntityPlayer.java


示例2: enablePlayerTrigger

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:CommandScoreboard.java


示例3: getTabCompletionOptions

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    if (args.length == 1)
    {
        Scoreboard scoreboard = server.worldServerForDimension(0).getScoreboard();
        List<String> list = Lists.<String>newArrayList();

        for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
        {
            if (scoreobjective.getCriteria() == IScoreCriteria.TRIGGER)
            {
                list.add(scoreobjective.getName());
            }
        }

        return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
    }
    else
    {
        return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): Collections.<String>emptyList();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:CommandTrigger.java


示例4: getTabCompletionOptions

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    if (args.length == 1)
    {
        Scoreboard scoreboard = server.worldServerForDimension(0).getScoreboard();
        List<String> list = Lists.<String>newArrayList();

        for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
        {
            if (scoreobjective.getCriteria() == IScoreCriteria.TRIGGER)
            {
                list.add(scoreobjective.getName());
            }
        }

        /**
         * Returns a List of strings (chosen from the given strings) which the last word in the given string array
         * is a beginning-match for. (Tab completion).
         */
        return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
    }
    else
    {
        return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): Collections.<String>emptyList();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:CommandTrigger.java


示例5: EditableScore

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public EditableScore(ScoreObjective original) {
	this.originalScore = original;
	nameTextField = new GuiTextField(0, Minecraft.getMinecraft().fontRendererObj, 80, 0, VIRTUAL_WIDTH / 2 - 70,
			20);
	nameTextField.setMaxStringLength(16);
	if (original != null) {
		nameTextField.setText(original.getName());
	}
	displayNameTextField = new GuiTextField(0, Minecraft.getMinecraft().fontRendererObj, 80, 0,
			VIRTUAL_WIDTH / 2 - 70, 20);
	displayNameTextField.setMaxStringLength(32);
	if (original != null) {
		displayNameTextField.setText(original.getDisplayName());
	}
	if (original == null) {
		scoreCriteria = IScoreCriteria.DUMMY;
	} else {
		scoreCriteria = original.getCriteria();
	}
	scoreCriteriaButton = new GuiButton(0, VIRTUAL_WIDTH / 2 + 20, 0, VIRTUAL_WIDTH / 2 - 20, 20,
			Translate.GUI_COMMANDEDITOR_SELECTSCORE_CHANGECRITERIA);
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:23,代码来源:GuiSelectScore.java


示例6: updateScorePoints

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
private void updateScorePoints(IScoreCriteria criteria, int points)
{
    for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(criteria))
    {
        Score score = this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective);
        score.setScorePoints(points);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:9,代码来源:EntityPlayerMP.java


示例7: giveTeamKillScores

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的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


示例8: handleScoreboardObjective

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
/**
 * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname
 */
public void handleScoreboardObjective(SPacketScoreboardObjective packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();

    if (packetIn.getAction() == 0)
    {
        ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.getObjectiveName(), IScoreCriteria.DUMMY);
        scoreobjective.setDisplayName(packetIn.getObjectiveValue());
        scoreobjective.setRenderType(packetIn.getRenderType());
    }
    else
    {
        ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.getObjectiveName());

        if (packetIn.getAction() == 1)
        {
            scoreboard.removeObjective(scoreobjective1);
        }
        else if (packetIn.getAction() == 2)
        {
            scoreobjective1.setDisplayName(packetIn.getObjectiveValue());
            scoreobjective1.setRenderType(packetIn.getRenderType());
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:30,代码来源:NetHandlerPlayClient.java


示例9: readPacketData

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.objectiveName = buf.readStringFromBuffer(16);
    this.action = buf.readByte();

    if (this.action == 0 || this.action == 2)
    {
        this.objectiveValue = buf.readStringFromBuffer(32);
        this.type = IScoreCriteria.EnumRenderType.getByName(buf.readStringFromBuffer(16));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:SPacketScoreboardObjective.java


示例10: StatBase

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public StatBase(String statIdIn, ITextComponent statNameIn, IStatType formatterIn)
{
    this.statId = statIdIn;
    this.statName = statNameIn;
    this.formatter = formatterIn;
    this.objectiveCriteria = new ScoreCriteriaStat(this);
    IScoreCriteria.INSTANCES.put(this.objectiveCriteria.getName(), this.objectiveCriteria);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:StatBase.java


示例11: getTriggerNames

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
protected List<String> getTriggerNames(MinecraftServer server)
{
    Collection<ScoreObjective> collection = this.getScoreboard(server).getScoreObjectives();
    List<String> list = Lists.<String>newArrayList();

    for (ScoreObjective scoreobjective : collection)
    {
        if (scoreobjective.getCriteria() == IScoreCriteria.TRIGGER)
        {
            list.add(scoreobjective.getName());
        }
    }

    return list;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:CommandScoreboard.java


示例12: readFromArgs

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
@Override
public int readFromArgs(String[] args, int index) throws CommandSyntaxException {
	if (args.length == index) {
		throw new CommandSyntaxException();
	}
	IScoreCriteria criteria = IScoreCriteria.INSTANCES.get(args[index]);
	if (criteria == null) {
		throw new CommandSyntaxException();
	}
	setCriteria(criteria);
	return 1;
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:13,代码来源:CommandSlotScoreCriteria.java


示例13: GuiSelectScoreCriteria

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public GuiSelectScoreCriteria(GuiScreen prevScreen, ICallback<IScoreCriteria> callback) {
	this.prevScreen = prevScreen;
	this.callback = callback;

	IScoreCriteria callbackValue = callback.getCallbackValue();
	if (callbackValue != null) {
		String topLevelType = null;
		if (callbackValue instanceof ScoreCriteriaStat) {
			StatBase stat = StatList.getOneShotStat(callbackValue.getName());
			if (stat != null) {
				if (stat instanceof Achievement) {
					topLevelType = "achievement";
				} else {
					topLevelType = "stat";
				}
				this.stat = stat;
			}
		} else {
			String criteriaName = callbackValue.getName();
			if (criteriaName.startsWith("teamkill.") || criteriaName.startsWith("killedByTeam.")) {
				topLevelType = criteriaName.startsWith("teamkill.") ? "teamkill" : "killedByTeam";
				String colorName = criteriaName.substring(criteriaName.startsWith("teamkill.") ? 9 : 13);
				for (int i = 0; i < 16; i++) {
					TextFormatting color = TextFormatting.fromColorIndex(i);
					if (color.getFriendlyName().equals(colorName)) {
						this.color = color;
						break;
					}
				}
			} else {
				topLevelType = criteriaName;
			}
		}
		if (topLevelType != null) {
			this.currentTopLevelType = topLevelTypes.indexOf(topLevelType);
		}
	}
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:39,代码来源:GuiSelectScoreCriteria.java


示例14: onEntityDeath

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的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


示例15: onDeath

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的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


示例16: onDeath

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的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


示例17: getRenderType

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
public IScoreCriteria.EnumRenderType getRenderType()
{
    return this.type;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:SPacketScoreboardObjective.java


示例18: getCriteria

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
/**
 * 1.8.9
 */
public IScoreCriteria getCriteria()
{
    return this.objectiveCriteria;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:StatBase.java


示例19: addObjective

import net.minecraft.scoreboard.IScoreCriteria; //导入依赖的package包/类
protected void addObjective(ICommandSender sender, String[] commandArgs, int argStartIndex, MinecraftServer server) throws CommandException
{
    String s = commandArgs[argStartIndex++];
    String s1 = commandArgs[argStartIndex++];
    Scoreboard scoreboard = this.getScoreboard(server);
    IScoreCriteria iscorecriteria = (IScoreCriteria)IScoreCriteria.INSTANCES.get(s1);

    if (iscorecriteria == null)
    {
        throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {s1});
    }
    else if (scoreboard.getObjective(s) != null)
    {
        throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {s});
    }
    else if (s.length() > 16)
    {
        throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {s, Integer.valueOf(16)});
    }
    else if (s.isEmpty())
    {
        throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]);
    }
    else
    {
        if (commandArgs.length > argStartIndex)
        {
            String s2 = getChatComponentFromNthArg(sender, commandArgs, argStartIndex).getUnformattedText();

            if (s2.length() > 32)
            {
                throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {s2, Integer.valueOf(32)});
            }

            if (s2.isEmpty())
            {
                scoreboard.addScoreObjective(s, iscorecriteria);
            }
            else
            {
                scoreboard.addScoreObjective(s, iscorecriteria).setDisplayName(s2);
            }
        }
        else
        {
            scoreboard.addScoreObjective(s, iscorecriteria);
        }

        notifyCommandListener(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {s});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:52,代码来源:CommandScoreboard.java


示例20: onDeath

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RMFatalEventType类代码示例发布时间:2022-05-22
下一篇:
Java Constants类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap