Java 类net.minecraft.network.play.client.CPacketCustomPayload 实例源码

项目:ForgeHax    文件:BookBot.java   
private void sendBook(ItemStack stack) {
    NBTTagList pages = new NBTTagList(); // page tag list

    // copy pages into NBT
    for(int i = 0; i < MAX_PAGES && parser.hasNext(); i++) {
        pages.appendTag(new NBTTagString(parser.next().trim()));
        page++;
    }

    // set our client side book
    if(stack.hasTagCompound())
        stack.getTagCompound().setTag("pages", pages);
    else
        stack.setTagInfo("pages", pages);

    // publish the book
    stack.setTagInfo("author", new NBTTagString(getLocalPlayer().getName()));
    stack.setTagInfo("title", new NBTTagString(parent.name.get().replaceAll(NUMBER_TOKEN, "" + getBook()).trim()));

    PacketBuffer buff = new PacketBuffer(Unpooled.buffer());
    buff.writeItemStack(stack);
    MC.getConnection().sendPacket(new CPacketCustomPayload("MC|BSign", buff));
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
 * WorldClient and sets the player initial dimension
 */
public void handleJoinGame(SPacketJoinGame packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
    this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.player.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    this.gameController.player.setEntityId(packetIn.getPlayerId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.player.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
 * WorldClient and sets the player initial dimension
 */
public void handleJoinGame(SPacketJoinGame packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
    this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.player.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    this.gameController.player.setEntityId(packetIn.getPlayerId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.player.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
项目:CustomWorldGen    文件:NetworkDispatcher.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet<?> msg) throws Exception
{
    boolean handled = false;
    if (msg instanceof CPacketCustomPayload)
    {
        handled = handleServerSideCustomPacket((CPacketCustomPayload) msg, ctx);
    }
    else if (msg instanceof SPacketCustomPayload)
    {
        handled = handleClientSideCustomPacket((SPacketCustomPayload)msg, ctx);
    }
    else if (state != ConnectionState.CONNECTED && state != ConnectionState.HANDSHAKECOMPLETE)
    {
        handled = handleVanilla(msg);
    }
    if (!handled)
    {
        ctx.fireChannelRead(msg);
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
 * WorldClient and sets the player initial dimension
 */
public void handleJoinGame(SPacketJoinGame packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
    this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.thePlayer.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    this.gameController.thePlayer.setEntityId(packetIn.getPlayerId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
项目:LiteSpongeClient    文件:MessageChannelHandler.java   
@SuppressWarnings("unchecked")
@Override
public void sendToServer(Message message) {
    Optional<MessageRegistration<?>> registration = (Optional) this.messageRegistry.getRegistration(message.getClass());
    if (registration.isPresent()) {
        PacketBuffer content = new PacketBuffer(Unpooled.buffer());

        try {
            message.writeTo(content);
        } catch (IOException e) {
            this.logger.error("Unable to serialize the message of type {}", registration.get().getType().getName(), e);
            return;
        }

        PacketBuffer buf = new PacketBuffer(Unpooled.buffer(content.array().length + 1));
        buf.writeByte(registration.get().getOpcode());
        buf.writeBytes(content);

        CPacketCustomPayload packet = new CPacketCustomPayload(this.channel, buf);
        Minecraft.getMinecraft().thePlayer.connection.sendPacket(packet);
    } else {
        this.logger.warn("Attempted to send a message type {} that wasn't registered", registration.get().getType().getName());
    }
}
项目:pycode-minecraft    文件:GuiPythonBook.java   
private void sendBookToServer() throws IOException {
    if (!this.bookIsModified || this.bookPages == null) {
        return;
    }
    while (this.bookPages.tagCount() > 1) {
        String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1);
        if (!s.trim().isEmpty()) {
            break;
        }
        this.bookPages.removeTag(this.bookPages.tagCount() - 1);
    }
    this.bookObj.setTagInfo("pages", this.bookPages);
    String title = this.bookTitle;
    if (title.equals(TITLE_PLACEHOLDER)) title = "";
    this.bookObj.setTagInfo("title", new NBTTagString(title));

    PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
    packetbuffer.writeItemStackToBuffer(this.bookObj);
    this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|BEdit", packetbuffer));
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public void handleJoinGame(SPacketJoinGame packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.mc);
    if (clientWorldController == null) super.handleJoinGame(packetIn);
       this.mc.playerController = new PlayerControllerMP(this.mc, this); //Replaces the playerController with my own patched PlayerControllerMP
       ReflectionHelper.set(ObfuscatedField.NetHandlerPlayClient_clientWorldController, clientWorldController, this, new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.mc.mcProfiler));
       this.mc.gameSettings.difficulty = packetIn.getDifficulty();
       this.mc.loadWorld(ReflectionHelper.get(ObfuscatedField.NetHandlerPlayClient_clientWorldController, clientWorldController, this));
       this.mc.player.dimension = packetIn.getDimension();
       this.mc.displayGuiScreen(new GuiDownloadTerrain());
       this.mc.player.setEntityId(packetIn.getPlayerId());
       this.currentServerMaxPlayers = packetIn.getMaxPlayers();
       this.mc.player.setReducedDebug(packetIn.isReducedDebugInfo());
       this.mc.playerController.setGameType(packetIn.getGameType());
       this.mc.gameSettings.sendSettingsToServer();
       this.getNetworkManager().sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
   }
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
 * WorldClient and sets the player initial dimension
 */
public void handleJoinGame(SPacketJoinGame packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
    this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.thePlayer.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    this.gameController.thePlayer.setEntityId(packetIn.getPlayerId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
项目:ForgeHax    文件:PayloadSpoofer.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onOutgoingPacket(PacketEvent.Outgoing.Pre event) {
    if(event.getPacket() instanceof CPacketCustomPayload) {
        String channel = ((CPacketCustomPayload) event.getPacket()).getChannelName();
        PacketBuffer packetBuffer = ((CPacketCustomPayload) event.getPacket()).getBufferData();
        if(isBlockedPacket(channel, packetBuffer)) event.setCanceled(true);
    }
}
项目:Wurst-MC-1.12    文件:LogSpammerMod.java   
@Override
public void onUpdate()
{
    updateMS();
    if(hasTimePassedM(100))
    {
        WConnection.sendPacket(new CPacketCustomPayload(
            vulnerableChannels[random.nextInt(vulnerableChannels.length)],
            payload));
        updateLastMS();
    }
}
项目:Backmemed    文件:GuiRepair.java   
private void renameItem()
{
    String s = this.nameField.getText();
    Slot slot = this.anvil.getSlot(0);

    if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
    {
        s = "";
    }

    this.anvil.updateItemName(s);
    this.mc.player.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
}
项目:Backmemed    文件:GuiMerchant.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.player);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
项目:Backmemed    文件:GuiEditStructure.java   
private boolean sendToServer(int p_189820_1_)
{
    try
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        this.tileStructure.writeCoordinates(packetbuffer);
        packetbuffer.writeByte(p_189820_1_);
        packetbuffer.writeString(this.tileStructure.getMode().toString());
        packetbuffer.writeString(this.nameEdit.getText());
        packetbuffer.writeInt(this.parseCoordinate(this.posXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posZEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeZEdit.getText()));
        packetbuffer.writeString(this.tileStructure.getMirror().toString());
        packetbuffer.writeString(this.tileStructure.getRotation().toString());
        packetbuffer.writeString(this.dataEdit.getText());
        packetbuffer.writeBoolean(this.tileStructure.ignoresEntities());
        packetbuffer.writeBoolean(this.tileStructure.showsAir());
        packetbuffer.writeBoolean(this.tileStructure.showsBoundingBox());
        packetbuffer.writeFloat(this.parseIntegrity(this.integrityEdit.getText()));
        packetbuffer.writeVarLong(this.parseSeed(this.seedEdit.getText()));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Struct", packetbuffer));
        return true;
    }
    catch (Exception exception)
    {
        LOGGER.warn((String)"Could not send structure block info", (Throwable)exception);
        return false;
    }
}
项目:Backmemed    文件:GuiEditCommandBlockMinecart.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 1)
        {
            this.commandBlockLogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeByte(this.commandBlockLogic.getCommandBlockType());
            this.commandBlockLogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandField.getText());
            packetbuffer.writeBoolean(this.commandBlockLogic.shouldTrackOutput());
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AdvCmd", packetbuffer));

            if (!this.commandBlockLogic.shouldTrackOutput())
            {
                this.commandBlockLogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            this.commandBlockLogic.setTrackOutput(!this.commandBlockLogic.shouldTrackOutput());
            this.updateCommandOutput();
        }
    }
}
项目:CustomWorldGen    文件:GuiRepair.java   
private void renameItem()
{
    String s = this.nameField.getText();
    Slot slot = this.anvil.getSlot(0);

    if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
    {
        s = "";
    }

    this.anvil.updateItemName(s);
    this.mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
}
项目:CustomWorldGen    文件:GuiMerchant.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
项目:CustomWorldGen    文件:GuiEditStructure.java   
private boolean sendToServer(int p_189820_1_)
{
    try
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        this.tileStructure.writeCoordinates(packetbuffer);
        packetbuffer.writeByte(p_189820_1_);
        packetbuffer.writeString(this.tileStructure.getMode().toString());
        packetbuffer.writeString(this.nameEdit.getText());
        packetbuffer.writeInt(this.parseCoordinate(this.posXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posZEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeZEdit.getText()));
        packetbuffer.writeString(this.tileStructure.getMirror().toString());
        packetbuffer.writeString(this.tileStructure.getRotation().toString());
        packetbuffer.writeString(this.dataEdit.getText());
        packetbuffer.writeBoolean(this.tileStructure.ignoresEntities());
        packetbuffer.writeBoolean(this.tileStructure.showsAir());
        packetbuffer.writeBoolean(this.tileStructure.showsBoundingBox());
        packetbuffer.writeFloat(this.parseIntegrity(this.integrityEdit.getText()));
        packetbuffer.writeVarLong(this.parseSeed(this.seedEdit.getText()));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Struct", packetbuffer));
        return true;
    }
    catch (Exception exception)
    {
        LOGGER.warn((String)"Could not send structure block info", (Throwable)exception);
        return false;
    }
}
项目:CustomWorldGen    文件:GuiEditCommandBlockMinecart.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 1)
        {
            this.commandBlockLogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeByte(this.commandBlockLogic.getCommandBlockType());
            this.commandBlockLogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandField.getText());
            packetbuffer.writeBoolean(this.commandBlockLogic.shouldTrackOutput());
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AdvCmd", packetbuffer));

            if (!this.commandBlockLogic.shouldTrackOutput())
            {
                this.commandBlockLogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            this.commandBlockLogic.setTrackOutput(!this.commandBlockLogic.shouldTrackOutput());
            this.updateCommandOutput();
        }
    }
}
项目:TaleCraft    文件:GuiNPCMerchant.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
@Override
    protected void actionPerformed(GuiButton button) throws IOException{
    boolean flag = false;

    if (button == this.nextButton){
        ++this.selectedMerchantRecipe;
        List<NPCTrade> trades = merchant.getTrades();

        if (trades != null && this.selectedMerchantRecipe >= trades.size()){
            this.selectedMerchantRecipe = trades.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton){
        selectedMerchantRecipe--;

        if (selectedMerchantRecipe < 0){
            selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag){
        ((ContainerNPCMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
项目:ExpandedRailsMod    文件:GuiRepair.java   
private void renameItem()
{
    String s = this.nameField.getText();
    Slot slot = this.anvil.getSlot(0);

    if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
    {
        s = "";
    }

    this.anvil.updateItemName(s);
    this.mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
}
项目:ExpandedRailsMod    文件:GuiMerchant.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
项目:ExpandedRailsMod    文件:GuiEditStructure.java   
private boolean func_189820_b(int p_189820_1_)
{
    try
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        this.field_189846_f.func_189705_a(packetbuffer);
        packetbuffer.writeByte(p_189820_1_);
        packetbuffer.writeString(this.field_189846_f.func_189700_k().toString());
        packetbuffer.writeString(this.field_189853_u.getText());
        packetbuffer.writeInt(this.func_189817_c(this.field_189854_v.getText()));
        packetbuffer.writeInt(this.func_189817_c(this.field_189855_w.getText()));
        packetbuffer.writeInt(this.func_189817_c(this.field_189856_x.getText()));
        packetbuffer.writeInt(this.func_189817_c(this.field_189857_y.getText()));
        packetbuffer.writeInt(this.func_189817_c(this.field_189858_z.getText()));
        packetbuffer.writeInt(this.func_189817_c(this.field_189825_A.getText()));
        packetbuffer.writeString(this.field_189846_f.func_189716_h().toString());
        packetbuffer.writeString(this.field_189846_f.func_189726_i().toString());
        packetbuffer.writeString(this.field_189828_D.getText());
        packetbuffer.writeBoolean(this.field_189846_f.func_189713_m());
        packetbuffer.writeBoolean(this.field_189846_f.func_189707_H());
        packetbuffer.writeBoolean(this.field_189846_f.func_189721_I());
        packetbuffer.writeFloat(this.func_189819_b(this.field_189826_B.getText()));
        packetbuffer.writeVarLong(this.func_189821_a(this.field_189827_C.getText()));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Struct", packetbuffer));
        return true;
    }
    catch (Exception exception)
    {
        field_189845_a.warn((String)"Could not send structure block info", (Throwable)exception);
        return false;
    }
}
项目:ExpandedRailsMod    文件:GuiEditCommandBlockMinecart.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        if (button.id == 1)
        {
            this.commandBlockLogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeByte(this.commandBlockLogic.getCommandBlockType());
            this.commandBlockLogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandField.getText());
            packetbuffer.writeBoolean(this.commandBlockLogic.shouldTrackOutput());
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AdvCmd", packetbuffer));

            if (!this.commandBlockLogic.shouldTrackOutput())
            {
                this.commandBlockLogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            this.commandBlockLogic.setTrackOutput(!this.commandBlockLogic.shouldTrackOutput());
            this.updateCommandOutput();
        }
    }
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
public void pickItem(int index)
{
    this.connection.sendPacket(new CPacketCustomPayload("MC|PickItem", (new PacketBuffer(Unpooled.buffer())).writeVarIntToBuffer(index)));
}
项目:Backmemed    文件:PlayerControllerMP.java   
public void pickItem(int index)
{
    this.connection.sendPacket(new CPacketCustomPayload("MC|PickItem", (new PacketBuffer(Unpooled.buffer())).writeVarIntToBuffer(index)));
}
项目:Backmemed    文件:GuiScreenBook.java   
private void sendBookToServer(boolean publish) throws IOException
{
    if (this.bookIsUnsigned && this.bookIsModified)
    {
        if (this.bookPages != null)
        {
            while (this.bookPages.tagCount() > 1)
            {
                String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1);

                if (!s.isEmpty())
                {
                    break;
                }

                this.bookPages.removeTag(this.bookPages.tagCount() - 1);
            }

            if (this.bookObj.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = this.bookObj.getTagCompound();
                nbttagcompound.setTag("pages", this.bookPages);
            }
            else
            {
                this.bookObj.setTagInfo("pages", this.bookPages);
            }

            String s1 = "MC|BEdit";

            if (publish)
            {
                s1 = "MC|BSign";
                this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName()));
                this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim()));
            }

            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeItemStackToBuffer(this.bookObj);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload(s1, packetbuffer));
        }
    }
}
项目:Backmemed    文件:GuiBeacon.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == -2)
    {
        this.mc.player.connection.sendPacket(new CPacketCloseWindow(this.mc.player.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button.id == -1)
    {
        String s = "MC|Beacon";
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.tileBeacon.getField(1));
        packetbuffer.writeInt(this.tileBeacon.getField(2));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Beacon", packetbuffer));
        this.mc.player.connection.sendPacket(new CPacketCloseWindow(this.mc.player.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button instanceof GuiBeacon.PowerButton)
    {
        GuiBeacon.PowerButton guibeacon$powerbutton = (GuiBeacon.PowerButton)button;

        if (guibeacon$powerbutton.isSelected())
        {
            return;
        }

        int i = Potion.getIdFromPotion(guibeacon$powerbutton.effect);

        if (guibeacon$powerbutton.tier < 3)
        {
            this.tileBeacon.setField(1, i);
        }
        else
        {
            this.tileBeacon.setField(2, i);
        }

        this.buttonList.clear();
        this.initGui();
        this.updateScreen();
    }
}
项目:Backmemed    文件:GuiCommandBlock.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}
项目:CustomWorldGen    文件:FMLProxyPacket.java   
public FMLProxyPacket(CPacketCustomPayload original)
{
    this(original.getBufferData(), original.getChannelName());
    this.target = Side.SERVER;
}
项目:CustomWorldGen    文件:FMLProxyPacket.java   
public Packet<INetHandlerPlayServer> toC17Packet()
{
    return new CPacketCustomPayload(channel, payload);
}
项目:CustomWorldGen    文件:PlayerControllerMP.java   
public void pickItem(int index)
{
    this.connection.sendPacket(new CPacketCustomPayload("MC|PickItem", (new PacketBuffer(Unpooled.buffer())).writeVarIntToBuffer(index)));
}
项目:CustomWorldGen    文件:GuiScreenBook.java   
private void sendBookToServer(boolean publish) throws IOException
{
    if (this.bookIsUnsigned && this.bookIsModified)
    {
        if (this.bookPages != null)
        {
            while (this.bookPages.tagCount() > 1)
            {
                String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1);

                if (!s.isEmpty())
                {
                    break;
                }

                this.bookPages.removeTag(this.bookPages.tagCount() - 1);
            }

            if (this.bookObj.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = this.bookObj.getTagCompound();
                nbttagcompound.setTag("pages", this.bookPages);
            }
            else
            {
                this.bookObj.setTagInfo("pages", this.bookPages);
            }

            String s1 = "MC|BEdit";

            if (publish)
            {
                s1 = "MC|BSign";
                this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName()));
                this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim()));
            }

            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeItemStackToBuffer(this.bookObj);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload(s1, packetbuffer));
        }
    }
}
项目:CustomWorldGen    文件:GuiBeacon.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == -2)
    {
        this.mc.thePlayer.connection.sendPacket(new CPacketCloseWindow(this.mc.thePlayer.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button.id == -1)
    {
        String s = "MC|Beacon";
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.tileBeacon.getField(1));
        packetbuffer.writeInt(this.tileBeacon.getField(2));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Beacon", packetbuffer));
        this.mc.thePlayer.connection.sendPacket(new CPacketCloseWindow(this.mc.thePlayer.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button instanceof GuiBeacon.PowerButton)
    {
        GuiBeacon.PowerButton guibeacon$powerbutton = (GuiBeacon.PowerButton)button;

        if (guibeacon$powerbutton.isSelected())
        {
            return;
        }

        int i = Potion.getIdFromPotion(guibeacon$powerbutton.effect);

        if (guibeacon$powerbutton.tier < 3)
        {
            this.tileBeacon.setField(1, i);
        }
        else
        {
            this.tileBeacon.setField(2, i);
        }

        this.buttonList.clear();
        this.initGui();
        this.updateScreen();
    }
}
项目:CustomWorldGen    文件:GuiCommandBlock.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
@Override
public void processCustomPayload(CPacketCustomPayload packetIn)
{

}
项目:ExpandedRailsMod    文件:PlayerControllerMP.java   
public void pickItem(int index)
{
    this.connection.sendPacket(new CPacketCustomPayload("MC|PickItem", (new PacketBuffer(Unpooled.buffer())).writeVarIntToBuffer(index)));
}
项目:ExpandedRailsMod    文件:GuiScreenBook.java   
private void sendBookToServer(boolean publish) throws IOException
{
    if (this.bookIsUnsigned && this.bookIsModified)
    {
        if (this.bookPages != null)
        {
            while (this.bookPages.tagCount() > 1)
            {
                String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1);

                if (!s.isEmpty())
                {
                    break;
                }

                this.bookPages.removeTag(this.bookPages.tagCount() - 1);
            }

            if (this.bookObj.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = this.bookObj.getTagCompound();
                nbttagcompound.setTag("pages", this.bookPages);
            }
            else
            {
                this.bookObj.setTagInfo("pages", this.bookPages);
            }

            String s1 = "MC|BEdit";

            if (publish)
            {
                s1 = "MC|BSign";
                this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName()));
                this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim()));
            }

            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeItemStackToBuffer(this.bookObj);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload(s1, packetbuffer));
        }
    }
}
项目:ExpandedRailsMod    文件:GuiBeacon.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == -2)
    {
        this.mc.thePlayer.connection.sendPacket(new CPacketCloseWindow(this.mc.thePlayer.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button.id == -1)
    {
        String s = "MC|Beacon";
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.tileBeacon.getField(1));
        packetbuffer.writeInt(this.tileBeacon.getField(2));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Beacon", packetbuffer));
        this.mc.thePlayer.connection.sendPacket(new CPacketCloseWindow(this.mc.thePlayer.openContainer.windowId));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button instanceof GuiBeacon.PowerButton)
    {
        GuiBeacon.PowerButton guibeacon$powerbutton = (GuiBeacon.PowerButton)button;

        if (guibeacon$powerbutton.isSelected())
        {
            return;
        }

        int i = Potion.getIdFromPotion(guibeacon$powerbutton.effect);

        if (guibeacon$powerbutton.tier < 3)
        {
            this.tileBeacon.setField(1, i);
        }
        else
        {
            this.tileBeacon.setField(2, i);
        }

        this.buttonList.clear();
        this.initGui();
        this.updateScreen();
    }
}
项目:ExpandedRailsMod    文件:GuiCommandBlock.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}