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


Java S2BPacketChangeGameState类代码示例

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


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

示例1: setGameType

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:EntityPlayerMP.java

示例2: setPlayerWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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));
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:24,代码来源:EntityPlayerMP.java

示例3: updateWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:34,代码来源:WorldServer.java

示例4: travelToDimension

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:EntityPlayerMP.java

示例5: updateAITasks

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:EntityGuardian.java

示例6: updateTimeAndWeatherForPlayer

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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)));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:ServerConfigurationManager.java

示例7: fixWorldWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:WorldServerOF.java

示例8: updateTimeAndWeatherForPlayer

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
@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())));
}
 
开发者ID:Cybermaxke,项目名称:Weathers,代码行数:14,代码来源:MixinServerConfigurationManager.java

示例9: updateWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:40,代码来源:WorldServer.java

示例10: applyEntityHitEffects

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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));
		}
	}
}
 
开发者ID:Archiving,项目名称:ARKCraft-Code,代码行数:32,代码来源:EntityProjectile.java

示例11: updateWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:34,代码来源:WorldServer.java

示例12: travelToDimension

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:38,代码来源:EntityPlayerMP.java

示例13: updateTimeAndWeatherForPlayer

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
/**
 * 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)));
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:15,代码来源:ServerConfigurationManager.java

示例14: fixWorldWeather

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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));
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:16,代码来源:WorldServerOF.java

示例15: applyEntityHitEffects

import net.minecraft.network.play.server.S2BPacketChangeGameState; //导入依赖的package包/类
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));
		}
	}
}
 
开发者ID:Ckathode,项目名称:balkons-weaponmod,代码行数:29,代码来源:EntityProjectile.java


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