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

项目:harshencastle    文件:HarshenUtils.java   
public static void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, BlockPos pos, IBlockState state)
{
    int i = player.dimension;
    WorldServer worldserver = player.mcServer.getWorld(player.dimension);
    player.dimension = dimensionIn;
    WorldServer worldserver1 = player.mcServer.getWorld(player.dimension);
    player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    player.mcServer.getPlayerList().updatePermissionLevel(player);
    worldserver.removeEntityDangerously(player);
    player.isDead = false;
    transferPlayerToWorld(player, i, worldserver, worldserver1, pos, state);
    player.mcServer.getPlayerList().preparePlayer(player, worldserver);
    player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(worldserver1);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    player.mcServer.getPlayerList().updateTimeAndWeatherForPlayer(player, worldserver1);
    player.mcServer.getPlayerList().syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects())
    {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn);
}
项目:Backmemed    文件:PlayerList.java   
public void changePlayerDimension(EntityPlayerMP player, int dimensionIn)
{
    int i = player.dimension;
    WorldServer worldserver = this.mcServer.worldServerForDimension(player.dimension);
    player.dimension = dimensionIn;
    WorldServer worldserver1 = this.mcServer.worldServerForDimension(player.dimension);
    player.connection.sendPacket(new SPacketRespawn(player.dimension, player.world.getDifficulty(), player.world.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    this.updatePermissionLevel(player);
    worldserver.removeEntityDangerously(player);
    player.isDead = false;
    this.transferEntityToWorld(player, i, worldserver, worldserver1);
    this.preparePlayer(player, worldserver);
    player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(worldserver1);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    this.updateTimeAndWeatherForPlayer(player, worldserver1);
    this.syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects())
    {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
}
项目:CustomWorldGen    文件:PlayerList.java   
public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, net.minecraft.world.Teleporter teleporter)
{
    int i = player.dimension;
    WorldServer worldserver = this.mcServer.worldServerForDimension(player.dimension);
    player.dimension = dimensionIn;
    WorldServer worldserver1 = this.mcServer.worldServerForDimension(player.dimension);
    player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    this.updatePermissionLevel(player);
    worldserver.removeEntityDangerously(player);
    player.isDead = false;
    this.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter);
    this.preparePlayer(player, worldserver);
    player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(worldserver1);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    this.updateTimeAndWeatherForPlayer(player, worldserver1);
    this.syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects())
    {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn);
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Sends the player's abilities to the server (if there is one).
 */
public void sendPlayerAbilities()
{
    if (this.connection != null)
    {
        this.connection.sendPacket(new SPacketPlayerAbilities(this.capabilities));
        this.updatePotionMetadata();
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.player;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:Backmemed    文件:EntityPlayerMP.java   
/**
 * Sends the player's abilities to the server (if there is one).
 */
public void sendPlayerAbilities()
{
    if (this.connection != null)
    {
        this.connection.sendPacket(new SPacketPlayerAbilities(this.capabilities));
        this.updatePotionMetadata();
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.player;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
/**
 * Sends the player's abilities to the server (if there is one).
 */
public void sendPlayerAbilities()
{
    if (this.connection != null)
    {
        this.connection.sendPacket(new SPacketPlayerAbilities(this.capabilities));
        this.updatePotionMetadata();
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
private static void transferPlayerToDimension(PlayerList playerList, net.minecraft.entity.player.EntityPlayerMP player, int dimension, Teleporter teleporter) {
    int i = player.dimension;
    WorldServer worldserver = playerList.getServerInstance().getWorld(player.dimension);
    player.dimension = dimension;
    WorldServer worldserver1 = playerList.getServerInstance().getWorld(player.dimension);
    player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));

    //MoreCommands Bug fix: client world has wrong spawn position, because WorldClient is recreated after receiving S07PacketRespawn
    //with default spawn coordinates 8, 64, 8. This causes e.g. the compass to point to a wrong direction. A possible solution is sending a S05PacketSpawnPosition.
    //Fixes https://bugs.mojang.com/browse/MC-679
    player.connection.sendPacket(new SPacketSpawnPosition(new BlockPos(worldserver1.getWorldInfo().getSpawnX(), worldserver1.getWorldInfo().getSpawnY(), worldserver1.getWorldInfo().getSpawnZ())));

    playerList.updatePermissionLevel(player);
    worldserver.removeEntityDangerously(player);
    player.isDead = false;
    playerList.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter);
    playerList.preparePlayer(player, worldserver);
    player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(worldserver1);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    playerList.updateTimeAndWeatherForPlayer(player, worldserver1);
    playerList.syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects())
    {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimension);
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
/**
 * Sends the player's abilities to the server (if there is one).
 */
public void sendPlayerAbilities()
{
    if (this.connection != null)
    {
        this.connection.sendPacket(new SPacketPlayerAbilities(this.capabilities));
        this.updatePotionMetadata();
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayer entityplayer = this.gameController.thePlayer;
    entityplayer.capabilities.isFlying = packetIn.isFlying();
    entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode();
    entityplayer.capabilities.disableDamage = packetIn.isInvulnerable();
    entityplayer.capabilities.allowFlying = packetIn.isAllowFlying();
    entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed());
    entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
}
项目:minecraft-territorialdealings    文件:Transition.java   
static void transferPlayerToDimension(EntityPlayerMP player, int dimensionTo, int targetHeight)
  {
if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(player, dimensionTo)) { return; } // Moving that here, to consolidate these functions.

net.minecraft.world.Teleporter teleporter = player.mcServer.worldServerForDimension(dimensionTo).getDefaultTeleporter();
PlayerList playerList = player.mcServer.getPlayerList();

      int dimensionFrom = player.dimension;

      // Changing dimensions...
      WorldServer wsPrev = player.mcServer.worldServerForDimension(player.dimension);

      player.dimension = dimensionTo;

      WorldServer wsNew = player.mcServer.worldServerForDimension(player.dimension);

      // Respawn? Used to recreate the player entity.
      player.connection.sendPacket(new SPacketRespawn(player.dimension, wsNew.getDifficulty(), wsNew.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));

      // Capabilities...
      playerList.updatePermissionLevel(player);

      // Begone from the old world?
      wsPrev.removeEntity(player);

      // Safety, I suppose.
      player.isDead = false;

      // We haven't reached the "set portal" level yet. Going deeper.
      transferEntityToWorld(player, dimensionFrom, wsPrev, wsNew, teleporter, targetHeight);

      // Getting chunks ready?
      playerList.preparePlayer(player, wsPrev);

      // Inserting their new position here? May not be necessary, since this is called by the drop and transfer, which sets the position beforehand and afterwards.
      player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);

      // More formalities...
      player.interactionManager.setWorld(wsNew);
      player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));

      playerList.updateTimeAndWeatherForPlayer(player, wsNew);
      playerList.syncPlayerInventory(player);

      // Reapplying potion effects
      for (PotionEffect potioneffect : player.getActivePotionEffects())
      {
          player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
      }

      // We're done.
      net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, dimensionFrom, dimensionTo);
  }
项目:CrystalMod    文件:TeleportUtil.java   
private static EntityPlayer teleportPlayerToDim(EntityPlayerMP player, MinecraftServer server, int sourceDim, int targetDim, double xCoord, double yCoord, double zCoord, float yaw, float pitch, Vector3d motion) {
    WorldServer sourceWorld = server.worldServerForDimension(sourceDim);
    WorldServer targetWorld = server.worldServerForDimension(targetDim);
    PlayerList playerList = server.getPlayerList();

    player.dimension = targetDim;
    player.connection.sendPacket(new SPacketRespawn(player.dimension, targetWorld.getDifficulty(), targetWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    playerList.updatePermissionLevel(player);
    sourceWorld.removeEntityDangerously(player);
    player.isDead = false;

    //region Transfer to world

    player.setLocationAndAngles(xCoord, yCoord, zCoord, yaw, pitch);
    player.connection.setPlayerLocation(xCoord, yCoord, zCoord, yaw, pitch);
    targetWorld.spawnEntity(player);
    targetWorld.updateEntityWithOptionalForce(player, false);
    player.setWorld(targetWorld);

    //endregion

    playerList.preparePlayer(player, sourceWorld);
    player.connection.setPlayerLocation(xCoord, yCoord, zCoord, yaw, pitch);
    player.interactionManager.setWorld(targetWorld);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));

    playerList.updateTimeAndWeatherForPlayer(player, targetWorld);
    playerList.syncPlayerInventory(player);

    for (PotionEffect potioneffect : player.getActivePotionEffects()) {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, sourceDim, targetDim);
    player.setLocationAndAngles(xCoord, yCoord, zCoord, yaw, pitch);

    player.motionX += motion.x; player.motionY += motion.y; player.motionZ += motion.z;
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setDouble("X", motion.x);
    nbt.setDouble("Y", motion.y);
    nbt.setDouble("Z", motion.z);
    CrystalModNetwork.sendToAll(new PacketEntityMessage(player, "AddMotion", nbt));

    return player;
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
void handlePlayerAbilities(SPacketPlayerAbilities packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handlePlayerAbilities(SPacketPlayerAbilities packetIn);