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

项目:BlazeLoader    文件:EventHandlerClient.java   
public static void eventHandleHeldItemChange(EventInfo<NetHandlerPlayClient> event, S09PacketHeldItemChange packet) {
    try {
    if (inventoryEventHandlers.size() > 0) {
    if (packet.func_149385_c() >= 0 && packet.func_149385_c() < InventoryPlayer.getHotbarSize()) {
        Minecraft mc = Minecraft.getMinecraft();
        if (mc != null && mc.thePlayer != null) {
        if (!inventoryEventHandlers.all().onSlotSelectionChanged(mc.thePlayer, mc.thePlayer.inventory.getCurrentItem(), mc.thePlayer.inventory.currentItem)) {
            event.cancel();
        }
        }
    }
    }
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP playerIn)
{
    playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
    playerIn.setPlayerHealthUpdated();
    playerIn.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem));
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(S09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getHeldItemHotbarIndex() >= 0 && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize())
    {
        this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
    }
}
项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP playerIn)
{
    playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
    playerIn.setPlayerHealthUpdated();
    playerIn.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem));
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(S09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getHeldItemHotbarIndex() >= 0 && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize())
    {
        this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP playerIn)
{
    playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
    playerIn.setPlayerHealthUpdated();
    playerIn.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem));
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(S09PacketHeldItemChange packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getHeldItemHotbarIndex() >= 0
            && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize()) {
        this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP playerIn)
{
    playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
    playerIn.setPlayerHealthUpdated();
    playerIn.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem));
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
public void handleHeldItemChange(S09PacketHeldItemChange p_147257_1_)
{
    if (p_147257_1_.func_149385_c() >= 0 && p_147257_1_.func_149385_c() < InventoryPlayer.getHotbarSize())
    {
        this.gameController.thePlayer.inventory.currentItem = p_147257_1_.func_149385_c();
    }
}
项目:Resilience-Client-Source    文件:ServerConfigurationManager.java   
/**
 * sends the players inventory to himself
 */
public void syncPlayerInventory(EntityPlayerMP par1EntityPlayerMP)
{
    par1EntityPlayerMP.sendContainerToPlayer(par1EntityPlayerMP.inventoryContainer);
    par1EntityPlayerMP.setPlayerHealthUpdated();
    par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(par1EntityPlayerMP.inventory.currentItem));
}
项目:Cauldron    文件:NetHandlerPlayServer.java   
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_)
{
    // CraftBukkit start
    if (this.playerEntity.isDead)
    {
        return;
    }

    if (p_147355_1_.func_149614_c() >= 0 && p_147355_1_.func_149614_c() < InventoryPlayer.getHotbarSize())
    {
        PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayerB(), this.playerEntity.inventory.currentItem, p_147355_1_.func_149614_c());
        this.server.getPluginManager().callEvent(event);

        if (event.isCancelled())
        {
            this.sendPacket(new S09PacketHeldItemChange(this.playerEntity.inventory.currentItem));
            this.playerEntity.func_143004_u();
            return;
        }

        // CraftBukkit end
        this.playerEntity.inventory.currentItem = p_147355_1_.func_149614_c();
        this.playerEntity.func_143004_u();
    }
    else
    {
        logger.warn(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
        this.kickPlayerFromServer("Nope!"); // CraftBukkit
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleHeldItemChange(S09PacketHeldItemChange p_147257_1_)
{
    if (p_147257_1_.func_149385_c() >= 0 && p_147257_1_.func_149385_c() < InventoryPlayer.getHotbarSize())
    {
        this.gameController.thePlayer.inventory.currentItem = p_147257_1_.func_149385_c();
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleHeldItemChange(S09PacketHeldItemChange p_147257_1_)
{
    if (p_147257_1_.func_149385_c() >= 0 && p_147257_1_.func_149385_c() < InventoryPlayer.getHotbarSize())
    {
        this.gameController.thePlayer.inventory.currentItem = p_147257_1_.func_149385_c();
    }
}
项目:Resilience-Client-Source    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(NetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String var4 = "local";

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

    logger.info(par2EntityPlayerMP.getCommandSenderName() + "[" + var4 + "] logged in with entity id " + par2EntityPlayerMP.getEntityId() + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer var5 = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates var6 = var5.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, var5);
    NetHandlerPlayServer var7 = new NetHandlerPlayServer(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    var7.sendPacket(new S01PacketJoinGame(par2EntityPlayerMP.getEntityId(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), var5.getWorldInfo().isHardcoreModeEnabled(), var5.provider.dimensionId, var5.difficultySetting, this.getMaxPlayers(), var5.getWorldInfo().getTerrainType()));
    var7.sendPacket(new S3FPacketCustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    var7.sendPacket(new S05PacketSpawnPosition(var6.posX, var6.posY, var6.posZ));
    var7.sendPacket(new S39PacketPlayerAbilities(par2EntityPlayerMP.capabilities));
    var7.sendPacket(new S09PacketHeldItemChange(par2EntityPlayerMP.inventory.currentItem));
    par2EntityPlayerMP.func_147099_x().func_150877_d();
    par2EntityPlayerMP.func_147099_x().func_150884_b(par2EntityPlayerMP);
    this.func_96456_a((ServerScoreboard)var5.getScoreboard(), par2EntityPlayerMP);
    this.mcServer.func_147132_au();
    ChatComponentTranslation var8 = new ChatComponentTranslation("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.func_145748_c_()});
    var8.getChatStyle().setColor(EnumChatFormatting.YELLOW);
    this.func_148539_a(var8);
    this.playerLoggedIn(par2EntityPlayerMP);
    var7.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, var5);

    if (this.mcServer.func_147133_T().length() > 0)
    {
        par2EntityPlayerMP.func_147095_a(this.mcServer.func_147133_T());
    }

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

    while (var9.hasNext())
    {
        PotionEffect var10 = (PotionEffect)var9.next();
        var7.sendPacket(new S1DPacketEntityEffect(par2EntityPlayerMP.getEntityId(), var10));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    if (var3 != null && var3.func_150297_b("Riding", 10))
    {
        Entity var11 = EntityList.createEntityFromNBT(var3.getCompoundTag("Riding"), var5);

        if (var11 != null)
        {
            var11.forceSpawn = true;
            var5.spawnEntityInWorld(var11);
            par2EntityPlayerMP.mountEntity(var11);
            var11.forceSpawn = false;
        }
    }
}
项目:NeptuneMod    文件:NeptunePacketFactory.java   
@Override
public Packet heldItemChange(int slot) {
    return (Packet) new S09PacketHeldItemChange(slot);
}
项目:Cauldron    文件:ServerConfigurationManager.java   
public void syncPlayerInventory(EntityPlayerMP p_72385_1_)
{
    p_72385_1_.sendContainerToPlayer(p_72385_1_.inventoryContainer);
    p_72385_1_.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
    p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
}
项目:Cauldron    文件:ServerConfigurationManager.java   
public void syncPlayerInventory(EntityPlayerMP p_72385_1_)
{
    p_72385_1_.sendContainerToPlayer(p_72385_1_.inventoryContainer);
    p_72385_1_.setPlayerHealthUpdated();
    p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
}
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
void handleHeldItemChange(S09PacketHeldItemChange packetIn);
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
void handleHeldItemChange(S09PacketHeldItemChange packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
void handleHeldItemChange(S09PacketHeldItemChange packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
void handleHeldItemChange(S09PacketHeldItemChange packetIn);
项目:Resilience-Client-Source    文件:INetHandlerPlayClient.java   
/**
 * Updates which hotbar slot of the player is currently selected
 */
void handleHeldItemChange(S09PacketHeldItemChange var1);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleHeldItemChange(S09PacketHeldItemChange p_147257_1_);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleHeldItemChange(S09PacketHeldItemChange p_147257_1_);