本文整理汇总了Java中net.minecraft.scoreboard.IScoreCriteria类的典型用法代码示例。如果您正苦于以下问题:Java IScoreCriteria类的具体用法?Java IScoreCriteria怎么用?Java IScoreCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IScoreCriteria类属于net.minecraft.scoreboard包,在下文中一共展示了IScoreCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
}
示例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});
}
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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();
}
示例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());
}
}
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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();
}