Java 类net.minecraft.network.packet.Packet16BlockItemSwitch 实例源码

项目:RuneCraftery    文件:NetServerHandler.java   
public void func_72502_a(Packet16BlockItemSwitch p_72502_1_) {
   if(p_72502_1_.field_73386_a >= 0 && p_72502_1_.field_73386_a < InventoryPlayer.func_70451_h()) {
      this.field_72574_e.field_71071_by.field_70461_c = p_72502_1_.field_73386_a;
      this.field_72574_e.func_143004_u();
   } else {
      this.field_72573_d.func_98033_al().func_98236_b(this.field_72574_e.func_70005_c_() + " tried to set an invalid carried item");
   }
}
项目:RuneCraftery    文件:PlayerControllerMP.java   
private void func_78750_j() {
   int var1 = this.field_78776_a.field_71439_g.field_71071_by.field_70461_c;
   if(var1 != this.field_78777_l) {
      this.field_78777_l = var1;
      this.field_78774_b.func_72552_c(new Packet16BlockItemSwitch(this.field_78777_l));
   }

}
项目:RuneCraftery    文件:NetServerHandler.java   
public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch)
{
    if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
        this.playerEntity.func_143004_u();
    }
    else
    {
        this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
    }
}
项目:RuneCraftery    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new Packet16BlockItemSwitch(this.currentPlayerItem));
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch)
{
    if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize())
    {
        this.mc.thePlayer.inventory.currentItem = par1Packet16BlockItemSwitch.id;
    }
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP par1EntityPlayerMP)
{
    par1EntityPlayerMP.sendContainerToPlayer(par1EntityPlayerMP.inventoryContainer);
    par1EntityPlayerMP.setPlayerHealthUpdated();
    par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par1EntityPlayerMP.inventory.currentItem));
}
项目:BetterNutritionMod    文件:NetServerHandler.java   
public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch)
{
    if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
        this.playerEntity.func_143004_u();
    }
    else
    {
        this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
    }
}
项目:BetterNutritionMod    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new Packet16BlockItemSwitch(this.currentPlayerItem));
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch)
{
    if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize())
    {
        this.mc.thePlayer.inventory.currentItem = par1Packet16BlockItemSwitch.id;
    }
}
项目:BetterNutritionMod    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP par1EntityPlayerMP)
{
    par1EntityPlayerMP.sendContainerToPlayer(par1EntityPlayerMP.inventoryContainer);
    par1EntityPlayerMP.setPlayerHealthUpdated();
    par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par1EntityPlayerMP.inventory.currentItem));
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch)
{
    nch.handleBlockItemSwitch(par1Packet16BlockItemSwitch);     
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72502_a(Packet16BlockItemSwitch p_72502_1_) {
   this.func_72509_a(p_72502_1_);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72502_a(Packet16BlockItemSwitch p_72502_1_) {
   if(p_72502_1_.field_73386_a >= 0 && p_72502_1_.field_73386_a < InventoryPlayer.func_70451_h()) {
      this.field_72563_h.field_71439_g.field_71071_by.field_70461_c = p_72502_1_.field_73386_a;
   }

}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void func_72355_a(INetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) {
   NBTTagCompound var3 = this.func_72380_a(p_72355_2_);
   p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
   p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
   String var4 = "local";
   if(p_72355_1_.func_74430_c() != null) {
      var4 = p_72355_1_.func_74430_c().toString();
   }

   this.field_72400_f.func_98033_al().func_98233_a(p_72355_2_.func_70005_c_() + "[" + var4 + "] logged in with entity id " + p_72355_2_.field_70157_k + " at (" + p_72355_2_.field_70165_t + ", " + p_72355_2_.field_70163_u + ", " + p_72355_2_.field_70161_v + ")");
   WorldServer var5 = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
   ChunkCoordinates var6 = var5.func_72861_E();
   this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, var5);
   NetServerHandler var7 = new NetServerHandler(this.field_72400_f, p_72355_1_, p_72355_2_);
   var7.func_72567_b(new Packet1Login(p_72355_2_.field_70157_k, var5.func_72912_H().func_76067_t(), p_72355_2_.field_71134_c.func_73081_b(), var5.func_72912_H().func_76093_s(), var5.field_73011_w.field_76574_g, var5.field_73013_u, var5.func_72800_K(), this.func_72352_l()));
   var7.func_72567_b(new Packet250CustomPayload("MC|Brand", this.func_72365_p().getServerModName().getBytes(Charsets.UTF_8)));
   var7.func_72567_b(new Packet6SpawnPosition(var6.field_71574_a, var6.field_71572_b, var6.field_71573_c));
   var7.func_72567_b(new Packet202PlayerAbilities(p_72355_2_.field_71075_bZ));
   var7.func_72567_b(new Packet16BlockItemSwitch(p_72355_2_.field_71071_by.field_70461_c));
   this.func_96456_a((ServerScoreboard)var5.func_96441_U(), p_72355_2_);
   this.func_72354_b(p_72355_2_, var5);
   this.func_92062_k(ChatMessageComponent.func_111082_b("multiplayer.player.joined", new Object[]{p_72355_2_.func_96090_ax()}).func_111059_a(EnumChatFormatting.YELLOW));
   this.func_72377_c(p_72355_2_);
   var7.func_72569_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
   this.field_72400_f.func_71212_ac().func_71745_a(var7);
   var7.func_72567_b(new Packet4UpdateTime(var5.func_82737_E(), var5.func_72820_D(), var5.func_82736_K().func_82766_b("doDaylightCycle")));
   if(this.field_72400_f.func_71202_P().length() > 0) {
      p_72355_2_.func_71115_a(this.field_72400_f.func_71202_P(), this.field_72400_f.func_71227_R());
   }

   Iterator var8 = p_72355_2_.func_70651_bq().iterator();

   while(var8.hasNext()) {
      PotionEffect var9 = (PotionEffect)var8.next();
      var7.func_72567_b(new Packet41EntityEffect(p_72355_2_.field_70157_k, var9));
   }

   p_72355_2_.func_71116_b();
   if(var3 != null && var3.func_74764_b("Riding")) {
      Entity var10 = EntityList.func_75615_a(var3.func_74775_l("Riding"), var5);
      if(var10 != null) {
         var10.field_98038_p = true;
         var5.func_72838_d(var10);
         p_72355_2_.func_70078_a(var10);
         var10.field_98038_p = false;
      }
   }

}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void func_72385_f(EntityPlayerMP p_72385_1_) {
   p_72385_1_.func_71120_a(p_72385_1_.field_71069_bz);
   p_72385_1_.func_71118_n();
   p_72385_1_.field_71135_a.func_72567_b(new Packet16BlockItemSwitch(p_72385_1_.field_71071_by.field_70461_c));
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String s = "local";

    if (par1INetworkManager.getSocketAddress() != null)
    {
        s = par1INetworkManager.getSocketAddress().toString();
    }

    this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + s + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer worldserver = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, worldserver);
    NetServerHandler netserverhandler = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    netserverhandler.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, worldserver.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, worldserver.getHeight(), this.getMaxPlayers()));
    netserverhandler.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    netserverhandler.sendPacketToPlayer(new Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));
    netserverhandler.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities));
    netserverhandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem));
    this.func_96456_a((ServerScoreboard)worldserver.getScoreboard(), par2EntityPlayerMP);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, worldserver);
    this.sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW));
    this.playerLoggedIn(par2EntityPlayerMP);
    netserverhandler.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.mcServer.getNetworkThread().addPlayer(netserverhandler);
    netserverhandler.sendPacketToPlayer(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (this.mcServer.getTexturePack().length() > 0)
    {
        par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize());
    }

    Iterator iterator = par2EntityPlayerMP.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        netserverhandler.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, potioneffect));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    FMLNetworkHandler.handlePlayerLogin(par2EntityPlayerMP, netserverhandler, par1INetworkManager);

    if (nbttagcompound != null && nbttagcompound.hasKey("Riding"))
    {
        Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver);

        if (entity != null)
        {
            entity.forceSpawn = true;
            worldserver.spawnEntityInWorld(entity);
            par2EntityPlayerMP.mountEntity(entity);
            entity.forceSpawn = false;
        }
    }
}
项目:TeamCore    文件:DimensionTeleporter.java   
public static void syncPlayerInventory(EntityPlayerMP par1EntityPlayerMP)
{
    par1EntityPlayerMP.sendContainerToPlayer(par1EntityPlayerMP.inventoryContainer);
    par1EntityPlayerMP.setPlayerHealthUpdated();
    par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par1EntityPlayerMP.inventory.currentItem));
}
项目:BetterNutritionMod    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String s = "local";

    if (par1INetworkManager.getSocketAddress() != null)
    {
        s = par1INetworkManager.getSocketAddress().toString();
    }

    this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + s + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer worldserver = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, worldserver);
    NetServerHandler netserverhandler = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    netserverhandler.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, worldserver.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, worldserver.getHeight(), this.getMaxPlayers()));
    netserverhandler.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    netserverhandler.sendPacketToPlayer(new Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));
    netserverhandler.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities));
    netserverhandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem));
    this.func_96456_a((ServerScoreboard)worldserver.getScoreboard(), par2EntityPlayerMP);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, worldserver);
    this.sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW));
    this.playerLoggedIn(par2EntityPlayerMP);
    netserverhandler.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.mcServer.getNetworkThread().addPlayer(netserverhandler);
    netserverhandler.sendPacketToPlayer(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (this.mcServer.getTexturePack().length() > 0)
    {
        par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize());
    }

    Iterator iterator = par2EntityPlayerMP.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        netserverhandler.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, potioneffect));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    FMLNetworkHandler.handlePlayerLogin(par2EntityPlayerMP, netserverhandler, par1INetworkManager);

    if (nbttagcompound != null && nbttagcompound.hasKey("Riding"))
    {
        Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver);

        if (entity != null)
        {
            entity.forceSpawn = true;
            worldserver.spawnEntityInWorld(entity);
            par2EntityPlayerMP.mountEntity(entity);
            entity.forceSpawn = false;
        }
    }
}