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


Java StatBase.isAchievement方法代码示例

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


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

示例1: addStat

import net.minecraft.stats.StatBase; //导入方法依赖的package包/类
/**
 * Adds a value to a statistic field.
 */
public void addStat(StatBase stat, int amount)
{
    if (stat != null)
    {
        if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return;
        this.statsFile.increaseStat(this, stat, amount);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.getCriteria()))
        {
            this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).increaseScore(amount);
        }

        if (this.statsFile.hasUnsentAchievement())
        {
            this.statsFile.sendStats(this);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:EntityPlayerMP.java

示例2: handleStatistics

import net.minecraft.stats.StatBase; //导入方法依赖的package包/类
/**
 * Updates the players statistics or achievements
 */
public void handleStatistics(S37PacketStatistics packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	boolean flag = false;

	for (Entry<StatBase, Integer> entry : packetIn.func_148974_c().entrySet()) {
		StatBase statbase = (StatBase) entry.getKey();
		int i = ((Integer) entry.getValue()).intValue();

		if (statbase.isAchievement() && i > 0) {
			if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().readStat(statbase) == 0) {
				Achievement achievement = (Achievement) statbase;
				this.gameController.guiAchievement.displayAchievement(achievement);
				this.gameController.getTwitchStream().func_152911_a(new MetadataAchievement(achievement), 0L);

				if (statbase == AchievementList.openInventory) {
					this.gameController.gameSettings.showInventoryAchievementHint = false;
					this.gameController.gameSettings.saveOptions();
				}
			}

			flag = true;
		}

		this.gameController.thePlayer.getStatFileWriter().unlockAchievement(this.gameController.thePlayer, statbase,
				i);
	}

	if (!this.field_147308_k && !flag && this.gameController.gameSettings.showInventoryAchievementHint) {
		this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.openInventory);
	}

	this.field_147308_k = true;

	if (this.gameController.currentScreen instanceof IProgressMeter) {
		((IProgressMeter) this.gameController.currentScreen).doneLoading();
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:41,代码来源:NetHandlerPlayClient.java

示例3: handleStatistics

import net.minecraft.stats.StatBase; //导入方法依赖的package包/类
/**
 * Updates the players statistics or achievements
 */
public void handleStatistics(S37PacketStatistics packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    boolean flag = false;

    for (Entry<StatBase, Integer> entry : packetIn.func_148974_c().entrySet())
    {
        StatBase statbase = (StatBase)entry.getKey();
        int i = ((Integer)entry.getValue()).intValue();

        if (statbase.isAchievement() && i > 0)
        {
            if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().readStat(statbase) == 0)
            {
                Achievement achievement = (Achievement)statbase;
                this.gameController.guiAchievement.displayAchievement(achievement);
                this.gameController.getTwitchStream().func_152911_a(new MetadataAchievement(achievement), 0L);

                if (statbase == AchievementList.openInventory)
                {
                    this.gameController.gameSettings.showInventoryAchievementHint = false;
                    this.gameController.gameSettings.saveOptions();
                }
            }

            flag = true;
        }

        this.gameController.thePlayer.getStatFileWriter().unlockAchievement(this.gameController.thePlayer, statbase, i);
    }

    if (!this.field_147308_k && !flag && this.gameController.gameSettings.showInventoryAchievementHint)
    {
        this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.openInventory);
    }

    this.field_147308_k = true;

    if (this.gameController.currentScreen instanceof IProgressMeter)
    {
        ((IProgressMeter)this.gameController.currentScreen).doneLoading();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:47,代码来源:NetHandlerPlayClient.java

示例4: handleStatistics

import net.minecraft.stats.StatBase; //导入方法依赖的package包/类
/**
 * Updates the players statistics or achievements
 */
public void handleStatistics(SPacketStatistics packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    boolean flag = false;

    for (Entry<StatBase, Integer> entry : packetIn.getStatisticMap().entrySet())
    {
        StatBase statbase = (StatBase)entry.getKey();
        int i = ((Integer)entry.getValue()).intValue();

        if (statbase.isAchievement() && i > 0)
        {
            if (this.hasStatistics && this.gameController.player.getStatFileWriter().readStat(statbase) == 0)
            {
                Achievement achievement = (Achievement)statbase;
                this.gameController.guiAchievement.displayAchievement(achievement);

                if (statbase == AchievementList.OPEN_INVENTORY)
                {
                    this.gameController.gameSettings.showInventoryAchievementHint = false;
                    this.gameController.gameSettings.saveOptions();
                }
            }

            flag = true;
        }

        this.gameController.player.getStatFileWriter().unlockAchievement(this.gameController.player, statbase, i);
    }

    if (!this.hasStatistics && !flag && this.gameController.gameSettings.showInventoryAchievementHint)
    {
        this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.OPEN_INVENTORY);
    }

    this.hasStatistics = true;

    if (this.gameController.currentScreen instanceof IProgressMeter)
    {
        ((IProgressMeter)this.gameController.currentScreen).doneLoading();
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:46,代码来源:NetHandlerPlayClient.java

示例5: handleStatistics

import net.minecraft.stats.StatBase; //导入方法依赖的package包/类
/**
 * Updates the players statistics or achievements
 */
public void handleStatistics(SPacketStatistics packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    boolean flag = false;

    for (Entry<StatBase, Integer> entry : packetIn.getStatisticMap().entrySet())
    {
        StatBase statbase = (StatBase)entry.getKey();
        int i = ((Integer)entry.getValue()).intValue();

        if (statbase.isAchievement() && i > 0)
        {
            if (this.hasStatistics && this.gameController.thePlayer.getStatFileWriter().readStat(statbase) == 0)
            {
                Achievement achievement = (Achievement)statbase;
                this.gameController.guiAchievement.displayAchievement(achievement);

                if (statbase == AchievementList.OPEN_INVENTORY)
                {
                    this.gameController.gameSettings.showInventoryAchievementHint = false;
                    this.gameController.gameSettings.saveOptions();
                }
            }

            flag = true;
        }

        this.gameController.thePlayer.getStatFileWriter().unlockAchievement(this.gameController.thePlayer, statbase, i);
    }

    if (!this.hasStatistics && !flag && this.gameController.gameSettings.showInventoryAchievementHint)
    {
        this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.OPEN_INVENTORY);
    }

    this.hasStatistics = true;

    if (this.gameController.currentScreen instanceof IProgressMeter)
    {
        ((IProgressMeter)this.gameController.currentScreen).doneLoading();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:46,代码来源:NetHandlerPlayClient.java


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