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

项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Sets the player's game mode and sends it to them.
 */
public void setGameType(WorldSettings.GameType gameType)
{
    this.theItemInWorldManager.setGameType(gameType);
    this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID()));

    if (gameType == WorldSettings.GameType.SPECTATOR)
    {
        this.mountEntity((Entity)null);
    }
    else
    {
        this.setSpectatingEntity(this);
    }

    this.sendPlayerAbilities();
    this.markPotionsDirty();
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Sets the player's game mode and sends it to them.
 */
public void setGameType(WorldSettings.GameType gameType)
{
    this.theItemInWorldManager.setGameType(gameType);
    this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID()));

    if (gameType == WorldSettings.GameType.SPECTATOR)
    {
        this.mountEntity((Entity)null);
    }
    else
    {
        this.setSpectatingEntity(this);
    }

    this.sendPlayerAbilities();
    this.markPotionsDirty();
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Sets the player's game mode and sends it to them.
 */
public void setGameType(WorldSettings.GameType gameType)
{
    this.theItemInWorldManager.setGameType(gameType);
    this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID()));

    if (gameType == WorldSettings.GameType.SPECTATOR)
    {
        this.mountEntity((Entity)null);
    }
    else
    {
        this.setSpectatingEntity(this);
    }

    this.sendPlayerAbilities();
    this.markPotionsDirty();
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Sets the player's game mode and sends it to them.
 */
public void setGameType(WorldSettings.GameType gameType)
{
    this.theItemInWorldManager.setGameType(gameType);
    this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID()));

    if (gameType == WorldSettings.GameType.SPECTATOR)
    {
        this.mountEntity((Entity)null);
    }
    else
    {
        this.setSpectatingEntity(this);
    }

    this.sendPlayerAbilities();
    this.markPotionsDirty();
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void setPlayerWeather(WeatherType type, boolean plugin)
{
    if (!plugin && this.weather != null)
    {
        return;
    }

    if (plugin)
    {
        this.weather = type;
    }

    if (type == WeatherType.DOWNFALL)
    {
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(2, 0));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F)));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F)));
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0));
    }
}
项目:DecompiledMinecraft    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionId());
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId());
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (this.dimension == 1 && dimensionId == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && dimensionId == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate();

            if (blockpos != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F);
            }

            dimensionId = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:DecompiledMinecraft    文件:EntityGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();

    if (this.isElder())
    {
        int i = 1200;
        int j = 1200;
        int k = 6000;
        int l = 2;

        if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
        {
            Potion potion = Potion.digSlowdown;

            for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(EntityPlayerMP p_apply_1_)
                {
                    return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure();
                }
            }))
            {
                if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
                {
                    entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
                    entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
                }
            }
        }

        if (!this.hasHome())
        {
            this.setHomePosAndDistance(new BlockPos(this), 16);
        }
    }
}
项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
    WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
    playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
    playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));

    if (worldIn.isRaining())
    {
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
    }
}
项目:DecompiledMinecraft    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionId());
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId());
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (this.dimension == 1 && dimensionId == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && dimensionId == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate();

            if (blockpos != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F);
            }

            dimensionId = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:DecompiledMinecraft    文件:EntityGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();

    if (this.isElder())
    {
        int i = 1200;
        int j = 1200;
        int k = 6000;
        int l = 2;

        if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
        {
            Potion potion = Potion.digSlowdown;

            for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(EntityPlayerMP p_apply_1_)
                {
                    return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure();
                }
            }))
            {
                if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
                {
                    entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
                    entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
                }
            }
        }

        if (!this.hasHome())
        {
            this.setHomePosAndDistance(new BlockPos(this), 16);
        }
    }
}
项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
    WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
    playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
    playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));

    if (worldIn.isRaining())
    {
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
    }
}
项目:BaseClient    文件:WorldServerOF.java   
private void fixWorldWeather()
{
    if (this.worldInfo.isRaining() || this.worldInfo.isThundering())
    {
        this.worldInfo.setRainTime(0);
        this.worldInfo.setRaining(false);
        this.setRainStrength(0.0F);
        this.worldInfo.setThunderTime(0);
        this.worldInfo.setThundering(false);
        this.setThunderStrength(0.0F);
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, 0.0F));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, 0.0F));
    }
}
项目:BaseClient    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionId());
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId());
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (this.dimension == 1 && dimensionId == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && dimensionId == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate();

            if (blockpos != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F);
            }

            dimensionId = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:BaseClient    文件:EntityGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();

    if (this.isElder())
    {
        int i = 1200;
        int j = 1200;
        int k = 6000;
        int l = 2;

        if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
        {
            Potion potion = Potion.digSlowdown;

            for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(EntityPlayerMP p_apply_1_)
                {
                    return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure();
                }
            }))
            {
                if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
                {
                    entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
                    entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
                }
            }
        }

        if (!this.hasHome())
        {
            this.setHomePosAndDistance(new BlockPos(this), 16);
        }
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
    WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
    playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
    playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));

    if (worldIn.isRaining())
    {
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
    }
}
项目:BaseClient    文件:WorldServerOF.java   
private void fixWorldWeather()
{
    if (this.worldInfo.isRaining() || this.worldInfo.isThundering())
    {
        this.worldInfo.setRainTime(0);
        this.worldInfo.setRaining(false);
        this.setRainStrength(0.0F);
        this.worldInfo.setThunderTime(0);
        this.worldInfo.setThundering(false);
        this.setThunderStrength(0.0F);
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, 0.0F));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, 0.0F));
    }
}
项目:BaseClient    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionId());
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId());
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (this.dimension == 1 && dimensionId == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && dimensionId == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate();

            if (blockpos != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F);
            }

            dimensionId = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:BaseClient    文件:EntityGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();

    if (this.isElder())
    {
        int i = 1200;
        int j = 1200;
        int k = 6000;
        int l = 2;

        if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
        {
            Potion potion = Potion.digSlowdown;

            for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(EntityPlayerMP p_apply_1_)
                {
                    return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure();
                }
            }))
            {
                if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
                {
                    entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
                    entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
                }
            }
        }

        if (!this.hasHome())
        {
            this.setHomePosAndDistance(new BlockPos(this), 16);
        }
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
    WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
    playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
    playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));

    if (worldIn.isRaining())
    {
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
        playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
    }
}
项目:Weathers    文件:MixinServerConfigurationManager.java   
@Overwrite
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn) {
    final WorldBorder worldborder = worldIn.getWorldBorder();
    playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
    playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(),
            worldIn.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    final IMixinWorld world = (IMixinWorld) worldIn;
    playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7,
            getRainStrengthValue(world.getRainStrength())));
    playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8,
            getThunderStrengthValue(world.getRainStrength(), world.getDarkness())));
}
项目:Jiffy    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather() {
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength) {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
    }

    if (this.prevThunderingStrength != this.thunderingStrength) {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
    }

    /*
     * The function in use here has been replaced in order to only send the
     * weather info to players in the correct dimension, rather than to all
     * players on the server. This is what causes the client-side rain, as
     * the client believes that it has started raining locally, rather than
     * in another dimension.
     */
    if (flag != this.isRaining()) {
        if (flag) {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                    new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId);
        } else {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                    new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId);
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(
                new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
    }
}
项目:ARKCraft-Code    文件:EntityProjectile.java   
protected void applyEntityHitEffects(Entity entityHit)
{
    if (isBurning() && !(entityHit instanceof EntityEnderman))
    {
        entityHit.setFire(5);
    }
    if (entityHit instanceof EntityLivingBase)
    {
        EntityLivingBase entityliving = (EntityLivingBase) entityHit;
        if (knockbackStrength > 0)
        {
            float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
            if (f > 0.0F)
            {
                entityHit.addVelocity(motionX * knockbackStrength * 0.6D / f, 0.1D,
                        motionZ * knockbackStrength * 0.6D / f);
            }
        }
        if (shootingEntity instanceof EntityLivingBase)
        {
            EnchantmentHelper.func_151384_a(entityliving, this.shootingEntity);
            EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity,
                    entityliving);
        }
        if (shootingEntity instanceof EntityPlayerMP && shootingEntity != entityHit && entityHit instanceof EntityPlayer)
        {
            ((EntityPlayerMP) shootingEntity).playerNetServerHandler
                    .sendPacket(new S2BPacketChangeGameState(6, 0));
        }
    }
}
项目:Resilience-Client-Source    文件:WorldServer.java   
/**
 * Updates all weather states.
 */
protected void updateWeather()
{
    boolean var1 = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().func_148537_a(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().func_148537_a(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
    }

    if (var1 != this.isRaining())
    {
        if (var1)
        {
            this.mcServer.getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:Resilience-Client-Source    文件:EntityPlayerMP.java   
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int par1)
{
    if (this.dimension == 1 && par1 == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && par1 == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            ChunkCoordinates var2 = this.mcServer.worldServerForDimension(par1).getEntrancePortalLocation();

            if (var2 != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)var2.posX, (double)var2.posY, (double)var2.posZ, 0.0F, 0.0F);
            }

            par1 = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, par1);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:Resilience-Client-Source    文件:ServerConfigurationManager.java   
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP par1EntityPlayerMP, WorldServer par2WorldServer)
{
    par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(par2WorldServer.getTotalWorldTime(), par2WorldServer.getWorldTime(), par2WorldServer.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (par2WorldServer.isRaining())
    {
        par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, par2WorldServer.getRainStrength(1.0F)));
        par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, par2WorldServer.getWeightedThunderStrength(1.0F)));
    }
}
项目:Resilience-Client-Source    文件:WorldServerOF.java   
private void fixWorldWeather()
{
    if (this.worldInfo.isRaining() || this.worldInfo.isThundering())
    {
        this.worldInfo.setRainTime(0);
        this.worldInfo.setRaining(false);
        this.setRainStrength(0.0F);
        this.worldInfo.setThunderTime(0);
        this.worldInfo.setThundering(false);
        this.setThunderStrength(0.0F);
        this.func_73046_m().getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(2, 0.0F));
        this.func_73046_m().getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(7, 0.0F));
        this.func_73046_m().getConfigurationManager().func_148540_a(new S2BPacketChangeGameState(8, 0.0F));
    }
}
项目:balkons-weaponmod    文件:EntityProjectile.java   
public void applyEntityHitEffects(Entity entity)
{
    if (isBurning() && !(entity instanceof EntityEnderman))
    {
        entity.setFire(5);
    }
    if (entity instanceof EntityLivingBase)
    {
        EntityLivingBase entityliving = (EntityLivingBase) entity;
        if (knockBack > 0)
        {
            float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
            if (f > 0.0F)
            {
                entity.addVelocity(motionX * knockBack * 0.6D / f, 0.1D, motionZ * knockBack * 0.6D / f);
            }
        }
        if (shootingEntity instanceof EntityLivingBase)
        {
            EnchantmentHelper.func_151384_a(entityliving, this.shootingEntity);
            EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entityliving);
        }
        if (shootingEntity instanceof EntityPlayerMP && shootingEntity != entity && entity instanceof EntityPlayer)
        {
            ((EntityPlayerMP) shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0));
        }
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void travelToDimension(int p_71027_1_)
{
    if (this.dimension == 1 && p_71027_1_ == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && p_71027_1_ == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            ChunkCoordinates chunkcoordinates = this.mcServer.worldServerForDimension(p_71027_1_).getEntrancePortalLocation();

            if (chunkcoordinates != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, 0.0F, 0.0F);
            }

            p_71027_1_ = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        // CraftBukkit start
        TeleportCause cause = (this.dimension == 1 || p_71027_1_ == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, p_71027_1_, cause); // Cauldron
        // CraftBukkit end
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:Cauldron    文件:ServerConfigurationManager.java   
public void updateTimeAndWeatherForPlayer(EntityPlayerMP p_72354_1_, WorldServer p_72354_2_)
{
    p_72354_1_.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(p_72354_2_.getTotalWorldTime(), p_72354_2_.getWorldTime(), p_72354_2_.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (p_72354_2_.isRaining())
    {
        // CraftBukkit start - handle player weather
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, p_72354_2_.getRainStrength(1.0F)));
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F)));
        p_72354_1_.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false);
        // CraftBukkit end
    }
}
项目:Cauldron    文件:WorldServer.java   
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void travelToDimension(int p_71027_1_)
{
    if (this.dimension == 1 && p_71027_1_ == 1)
    {
        this.triggerAchievement(AchievementList.theEnd2);
        this.worldObj.removeEntity(this);
        this.playerConqueredTheEnd = true;
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F));
    }
    else
    {
        if (this.dimension == 0 && p_71027_1_ == 1)
        {
            this.triggerAchievement(AchievementList.theEnd);
            ChunkCoordinates chunkcoordinates = this.mcServer.worldServerForDimension(p_71027_1_).getEntrancePortalLocation();

            if (chunkcoordinates != null)
            {
                this.playerNetServerHandler.setPlayerLocation((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, 0.0F, 0.0F);
            }

            p_71027_1_ = 1;
        }
        else
        {
            this.triggerAchievement(AchievementList.portal);
        }

        this.mcServer.getConfigurationManager().transferPlayerToDimension(this, p_71027_1_);
        this.lastExperience = -1;
        this.lastHealth = -1.0F;
        this.lastFoodLevel = -1;
    }
}
项目:Cauldron    文件:ServerConfigurationManager.java   
public void updateTimeAndWeatherForPlayer(EntityPlayerMP p_72354_1_, WorldServer p_72354_2_)
{
    p_72354_1_.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(p_72354_2_.getTotalWorldTime(), p_72354_2_.getWorldTime(), p_72354_2_.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (p_72354_2_.isRaining())
    {
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, p_72354_2_.getRainStrength(1.0F)));
        p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F)));
    }
}
项目:ZeldaSwordSkills    文件:EntityArrowCustom.java   
/**
 * Called when custom arrow impacts another entity
 */
protected void onImpactEntity(MovingObjectPosition mop) {
    if (mop.entityHit != null) {
        // make sure shootingEntity is correct, e.g. if loaded from NBT
        shootingEntity = getShooter();
        float dmg = calculateDamage(mop.entityHit);
        if (dmg > 0) {
            if (isBurning() && canTargetEntity(mop.entityHit)) {
                mop.entityHit.setFire(5);
            }
            if (mop.entityHit.attackEntityFrom(getDamageSource(mop.entityHit), dmg)) {
                if (mop.entityHit instanceof EntityLivingBase) {
                    handlePostDamageEffects((EntityLivingBase) mop.entityHit);
                    if (shootingEntity instanceof EntityPlayerMP && mop.entityHit != shootingEntity && mop.entityHit instanceof EntityPlayer) {
                        ((EntityPlayerMP) shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
                    }
                }
                playSound(Sounds.BOW_HIT, 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
                if (canTargetEntity(mop.entityHit)) {
                    setDead();
                }
            } else {
                motionX *= -0.10000000149011612D;
                motionY *= -0.10000000149011612D;
                motionZ *= -0.10000000149011612D;
                rotationYaw += 180.0F;
                prevRotationYaw += 180.0F;
                ticksInAir = 0;
            }
        }
    }
}
项目:DecompiledMinecraft    文件:DemoWorldManager.java   
public void updateBlockRemoving()
{
    super.updateBlockRemoving();
    ++this.field_73102_f;
    long i = this.theWorld.getTotalWorldTime();
    long j = i / 24000L + 1L;

    if (!this.field_73105_c && this.field_73102_f > 20)
    {
        this.field_73105_c = true;
        this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 0.0F));
    }

    this.demoTimeExpired = i > 120500L;

    if (this.demoTimeExpired)
    {
        ++this.field_73104_e;
    }

    if (i % 24000L == 500L)
    {
        if (j <= 6L)
        {
            this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day." + j, new Object[0]));
        }
    }
    else if (j == 1L)
    {
        if (i == 100L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 101.0F));
        }
        else if (i == 175L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 102.0F));
        }
        else if (i == 250L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 103.0F));
        }
    }
    else if (j == 5L && i % 24000L == 22000L)
    {
        this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day.warning", new Object[0]));
    }
}
项目:DecompiledMinecraft    文件:DemoWorldManager.java   
public void updateBlockRemoving()
{
    super.updateBlockRemoving();
    ++this.field_73102_f;
    long i = this.theWorld.getTotalWorldTime();
    long j = i / 24000L + 1L;

    if (!this.field_73105_c && this.field_73102_f > 20)
    {
        this.field_73105_c = true;
        this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 0.0F));
    }

    this.demoTimeExpired = i > 120500L;

    if (this.demoTimeExpired)
    {
        ++this.field_73104_e;
    }

    if (i % 24000L == 500L)
    {
        if (j <= 6L)
        {
            this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day." + j, new Object[0]));
        }
    }
    else if (j == 1L)
    {
        if (i == 100L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 101.0F));
        }
        else if (i == 175L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 102.0F));
        }
        else if (i == 250L)
        {
            this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 103.0F));
        }
    }
    else if (j == 5L && i % 24000L == 22000L)
    {
        this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day.warning", new Object[0]));
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleChangeGameState(S2BPacketChangeGameState packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;
    int i = packetIn.getGameState();
    float f = packetIn.func_149137_d();
    int j = MathHelper.floor_float(f + 0.5F);

    if (i >= 0 && i < S2BPacketChangeGameState.MESSAGE_NAMES.length && S2BPacketChangeGameState.MESSAGE_NAMES[i] != null)
    {
        entityplayer.addChatComponentMessage(new ChatComponentTranslation(S2BPacketChangeGameState.MESSAGE_NAMES[i], new Object[0]));
    }

    if (i == 1)
    {
        this.clientWorldController.getWorldInfo().setRaining(true);
        this.clientWorldController.setRainStrength(0.0F);
    }
    else if (i == 2)
    {
        this.clientWorldController.getWorldInfo().setRaining(false);
        this.clientWorldController.setRainStrength(1.0F);
    }
    else if (i == 3)
    {
        this.gameController.playerController.setGameType(WorldSettings.GameType.getByID(j));
    }
    else if (i == 4)
    {
        this.gameController.displayGuiScreen(new GuiWinGame());
    }
    else if (i == 5)
    {
        GameSettings gamesettings = this.gameController.gameSettings;

        if (f == 0.0F)
        {
            this.gameController.displayGuiScreen(new GuiScreenDemo());
        }
        else if (f == 101.0F)
        {
            this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.movement", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())}));
        }
        else if (f == 102.0F)
        {
            this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())}));
        }
        else if (f == 103.0F)
        {
            this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())}));
        }
    }
    else if (i == 6)
    {
        this.clientWorldController.playSound(entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, "random.successful_hit", 0.18F, 0.45F, false);
    }
    else if (i == 7)
    {
        this.clientWorldController.setRainStrength(f);
    }
    else if (i == 8)
    {
        this.clientWorldController.setThunderStrength(f);
    }
    else if (i == 10)
    {
        this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
        this.clientWorldController.playSound(entityplayer.posX, entityplayer.posY, entityplayer.posZ, "mob.guardian.curse", 1.0F, 1.0F, false);
    }
}