Java 类net.minecraft.network.play.server.SPacketStatistics 实例源码

项目:Backmemed    文件:StatisticsManagerServer.java   
public void sendStats(EntityPlayerMP player)
{
    int i = this.mcServer.getTickCounter();
    Map<StatBase, Integer> map = Maps.<StatBase, Integer>newHashMap();

    if (this.hasUnsentAchievement || i - this.lastStatRequest > 300)
    {
        this.lastStatRequest = i;

        for (StatBase statbase : this.getDirty())
        {
            map.put(statbase, Integer.valueOf(this.readStat(statbase)));
        }
    }

    player.connection.sendPacket(new SPacketStatistics(map));
}
项目:CustomWorldGen    文件:StatisticsManagerServer.java   
public void sendStats(EntityPlayerMP player)
{
    int i = this.mcServer.getTickCounter();
    Map<StatBase, Integer> map = Maps.<StatBase, Integer>newHashMap();

    if (this.hasUnsentAchievement || i - this.lastStatRequest > 300)
    {
        this.lastStatRequest = i;

        for (StatBase statbase : this.getDirty())
        {
            map.put(statbase, Integer.valueOf(this.readStat(statbase)));
        }
    }

    player.connection.sendPacket(new SPacketStatistics(map));
}
项目:Backmemed    文件:StatisticsManagerServer.java   
public void sendAchievements(EntityPlayerMP player)
{
    Map<StatBase, Integer> map = Maps.<StatBase, Integer>newHashMap();

    for (Achievement achievement : AchievementList.ACHIEVEMENTS)
    {
        if (this.hasAchievementUnlocked(achievement))
        {
            map.put(achievement, Integer.valueOf(this.readStat(achievement)));
            this.dirty.remove(achievement);
        }
    }

    player.connection.sendPacket(new SPacketStatistics(map));
}
项目:CustomWorldGen    文件:StatisticsManagerServer.java   
public void sendAchievements(EntityPlayerMP player)
{
    Map<StatBase, Integer> map = Maps.<StatBase, Integer>newHashMap();

    for (Achievement achievement : AchievementList.ACHIEVEMENTS)
    {
        if (this.hasAchievementUnlocked(achievement))
        {
            map.put(achievement, Integer.valueOf(this.readStat(achievement)));
            this.dirty.remove(achievement);
        }
    }

    player.connection.sendPacket(new SPacketStatistics(map));
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * 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();
    }
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
/**
 * Updates the players statistics or achievements
 */
void handleStatistics(SPacketStatistics packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
/**
 * Updates the players statistics or achievements
 */
void handleStatistics(SPacketStatistics packetIn);