Java 类net.minecraft.client.gui.GuiMerchant 实例源码

项目:Soot    文件:VillagerAntimonyHandler.java   
@SubscribeEvent
public static void onClientUpdate(TickEvent.ClientTickEvent event)
{
    if(event.side == Side.CLIENT && event.phase == TickEvent.Phase.END)
    {
        GuiScreen gui = Minecraft.getMinecraft().currentScreen;
        if (gui instanceof GuiMerchant) {
            //IMerchant merchant = ((GuiMerchant) gui).getMerchant();
            ContainerMerchant container = (ContainerMerchant) ((GuiMerchant) gui).inventorySlots;
            if (container != null && (clientContainer == null || clientContainer.container != container)) {
                clientContainer = new ContainerWrapper(container);
            }
            clientContainer.update();
        }
        else
        {
            clientContainer = null;
        }
    }
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
    if (Minecraft.getMinecraft().player != null) {
        if ((event.getGui() instanceof GuiInventory || event.getGui() instanceof GuiContainerCreative || event.getGui() instanceof GuiWearables)
                && !Minecraft.getMinecraft().player.getCapability(TF2weapons.INVENTORY_CAP, null).isEmpty()) {
            // GuiContainer gui = (GuiContainer) event.getGui();
            event.getButtonList().add(new GuiButton(97535627, event.getGui().width / 2 - 10, event.getGui().height / 2 + 95, 20, 20, "W"));
        }

        if (event.getGui() instanceof GuiMerchant)
            if (((GuiMerchant) event.getGui()).getMerchant().getDisplayName().getUnformattedText().equals(I18n.format("entity.hale.name"))) {
                event.getButtonList().add(new GuiButton(7578, event.getGui().width / 2 - 100, event.getGui().height / 2 - 110, 100, 20, "Change Team"));
                event.getButtonList().add(new GuiButton(7579, event.getGui().width / 2, event.getGui().height / 2 - 110, 100, 20, "Recover Lost Items"));
            }
        Minecraft.getMinecraft().player.getCapability(TF2weapons.WEAPONS_CAP, null).state &= 8;
    }
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void guiPostAction(GuiScreenEvent.ActionPerformedEvent.Post event) {

    if (event.getGui() instanceof GuiInventory || event.getGui() instanceof GuiContainerCreative)
        if (event.getButton().id == 97535627) {
            // Minecraft.getMinecraft().displayGuiScreen(null);
            TF2weapons.network.sendToServer(new TF2Message.ShowGuiMessage(0));
        }

    if (event.getGui() instanceof GuiWearables)
        if (event.getButton().id == 97535627) {
            event.getGui().mc.displayGuiScreen(new GuiInventory(event.getGui().mc.player));
        }
    // PacketHandler.INSTANCE.sendToServer(new
    // PacketOpenNormalInventory(event.getGui().mc.player));
    if (event.getGui() instanceof GuiMerchant && event.getButton().id == 7578) {
        ClientProxy.displayScreenJoinTeam();
    }
    else if (event.getGui() instanceof GuiMerchant && event.getButton().id == 7579) {
        TF2weapons.network.sendToServer(new TF2Message.ActionMessage(18));
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72501_a(Packet250CustomPayload p_72501_1_) {
   if("MC|TrList".equals(p_72501_1_.field_73630_a)) {
      DataInputStream var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));

      try {
         int var3 = var2.readInt();
         GuiScreen var4 = this.field_72563_h.field_71462_r;
         if(var4 != null && var4 instanceof GuiMerchant && var3 == this.field_72563_h.field_71439_g.field_71070_bA.field_75152_c) {
            IMerchant var5 = ((GuiMerchant)var4).func_74199_h();
            MerchantRecipeList var6 = MerchantRecipeList.func_77204_a(var2);
            var5.func_70930_a(var6);
         }
      } catch (IOException var7) {
         var7.printStackTrace();
      }
   } else if("MC|Brand".equals(p_72501_1_.field_73630_a)) {
      this.field_72563_h.field_71439_g.func_142020_c(new String(p_72501_1_.field_73629_c, Charsets.UTF_8));
   }

}
项目:RuneCraftery    文件:GuiButtonMerchant.java   
public void func_73737_a(Minecraft p_73737_1_, int p_73737_2_, int p_73737_3_) {
   if(this.field_73748_h) {
      p_73737_1_.func_110434_K().func_110577_a(GuiMerchant.func_110417_h());
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      boolean var4 = p_73737_2_ >= this.field_73746_c && p_73737_3_ >= this.field_73743_d && p_73737_2_ < this.field_73746_c + this.field_73747_a && p_73737_3_ < this.field_73743_d + this.field_73745_b;
      int var5 = 0;
      int var6 = 176;
      if(!this.field_73742_g) {
         var6 += this.field_73747_a * 2;
      } else if(var4) {
         var6 += this.field_73747_a;
      }

      if(!this.field_73749_j) {
         var5 += this.field_73745_b;
      }

      this.func_73729_b(this.field_73746_c, this.field_73743_d, var6, var5, this.field_73747_a, this.field_73745_b);
   }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla
 * implemented channels are "MC|TrList" to acquire a MerchantRecipeList trades
 * for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate
 * the identifier of the default server resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName())) {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant
                    && i == this.gameController.thePlayer.openContainer.windowId) {
                IMerchant imerchant = ((GuiMerchant) guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        } catch (IOException ioexception) {
            logger.error((String) "Couldn\'t load trade info", (Throwable) ioexception);
        } finally {
            packetbuffer.release();
        }
    } else if ("MC|Brand".equals(packetIn.getChannelName())) {
        this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    } else if ("MC|BOpen".equals(packetIn.getChannelName())) {
        ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

        if (itemstack != null && itemstack.getItem() == Items.written_book) {
            this.gameController
                    .displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
}
项目:itemscroller    文件:InventoryUtils.java   
public static boolean tryMoveItemsVillager(GuiMerchant gui, Slot slot, boolean moveToOtherInventory, boolean isShiftDown)
{
    if (isShiftDown)
    {
        // Try to fill the merchant's buy slots from the player inventory
        if (moveToOtherInventory == false)
        {
            tryMoveItemsToMerchantBuySlots(gui, true);
        }
        // Move items from sell slot to player inventory
        else if (slot.getHasStack())
        {
            tryMoveStacks(slot, gui, true, true, true);
        }
        // Scrolling over an empty output slot, clear the buy slots
        else
        {
            tryMoveStacks(slot, gui, false, true, false);
        }
    }
    else
    {
        // Scrolling items from player inventory into merchant buy slots
        if (moveToOtherInventory == false)
        {
            tryMoveItemsToMerchantBuySlots(gui, false);
        }
        // Scrolling items from this slot/inventory into the other inventory
        else if (slot.getHasStack())
        {
            moveOneSetOfItemsFromSlotToOtherInventory(gui, slot);
        }
    }

    return false;
}
项目:itemscroller    文件:InventoryUtils.java   
private static void tryMoveItemsToMerchantBuySlots(GuiMerchant gui, boolean fillStacks)
{
    MerchantRecipeList list = gui.getMerchant().getRecipes(gui.mc.player);
    int index = 0;

    try
    {
        index = fieldSelectedMerchantRecipe.getInt(gui);
    }
    catch (IllegalAccessException e)
    {
        ItemScroller.logger.warn("Failed to get the value of GuiMerchant.selectedMerchantRecipe");
    }

    if (list == null || list.size() <= index)
    {
        return;
    }

    MerchantRecipe recipe = list.get(index);
    if (recipe == null)
    {
        return;
    }

    ItemStack buy1 = recipe.getItemToBuy();
    ItemStack buy2 = recipe.getSecondItemToBuy();

    if (isStackEmpty(buy1) == false)
    {
        fillBuySlot(gui, 0, buy1, fillStacks);
    }

    if (isStackEmpty(buy2) == false)
    {
        fillBuySlot(gui, 1, buy2, fillStacks);
    }
}
项目:TaleCraft    文件:ClientProxy.java   
@SubscribeEvent
public void npcTradeOpen(GuiOpenEvent event){
    if(event.getGui() instanceof GuiMerchant){
        if(((GuiMerchant) event.getGui()).getMerchant() instanceof NPCShop){
            lastOpened = (NPCShop) ((GuiMerchant) event.getGui()).getMerchant();
        }else{
            Minecraft mc = Minecraft.getMinecraft();
            event.setGui(new GuiNPCMerchant(mc.player.inventory, lastOpened, mc.world));
        }
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void handleVanilla250Packet(Packet250CustomPayload par1Packet250CustomPayload)
{
    if ("MC|TrList".equals(par1Packet250CustomPayload.channel))
    {
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));

        try
        {
            int i = datainputstream.readInt();
            GuiScreen guiscreen = this.mc.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.mc.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getIMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readRecipiesFromStream(datainputstream);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }
    else if ("MC|Brand".equals(par1Packet250CustomPayload.channel))
    {
        this.mc.thePlayer.func_142020_c(new String(par1Packet250CustomPayload.data, Charsets.UTF_8));
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public void handleVanilla250Packet(Packet250CustomPayload par1Packet250CustomPayload)
{
    if ("MC|TrList".equals(par1Packet250CustomPayload.channel))
    {
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));

        try
        {
            int i = datainputstream.readInt();
            GuiScreen guiscreen = this.mc.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.mc.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getIMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readRecipiesFromStream(datainputstream);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }
    else if ("MC|Brand".equals(par1Packet250CustomPayload.channel))
    {
        this.mc.thePlayer.func_142020_c(new String(par1Packet250CustomPayload.data, Charsets.UTF_8));
    }
}
项目:McMod-CubicVillager    文件:MerchantButton.java   
/**
 * Draws this button to the screen.
 */
@Override
public void drawButton(Minecraft mc, int xCursor, int yCursor, float tick)
{
    if(this.visible)
    {
        mc.getTextureManager().bindTexture(GuiMerchant.MERCHANT_GUI_TEXTURE);

        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glColor4f(1F, 1F, 1F, 1F);

        boolean flag = (xCursor >= this.x) && (yCursor >= this.y) && (xCursor < this.x + this.width) && (yCursor < this.y + this.height);
        int yTexturePos = 0;
        int xTexturePos = 176;

        if(!this.enabled)
        {
            xTexturePos += this.width * 2;
        }
        else if(flag)
        {
            xTexturePos += this.width;
        }

        if(!this.isNextButton)
        {
            yTexturePos += this.height;
        }

        this.drawTexturedModalRect(this.x, this.y, xTexturePos, yTexturePos, this.width, this.height);

        GL11.glPopAttrib();
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj));
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

        if (itemstack != null && itemstack.getItem() == Items.written_book)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj));
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

        if (itemstack != null && itemstack.getItem() == Items.written_book)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager) {
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj));
}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.world));
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.player.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.player.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.player.getHeldItemOffhand() : this.gameController.player.getHeldItemMainhand();

        if (itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.player, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
项目:Backmemed    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.world));
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.player.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.player.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.player.getHeldItemOffhand() : this.gameController.player.getHeldItemMainhand();

        if (itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.player, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|DebugNeighborsUpdate".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        long k = packetbuffer2.readVarLong();
        BlockPos blockpos = packetbuffer2.readBlockPos();
        ((DebugRendererNeighborsUpdate)this.gameController.debugRenderer.field_191557_f).func_191553_a(k, blockpos);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer3 = packetIn.getBufferData();
        String s = packetbuffer3.readStringFromBuffer(32767);
        String s1 = packetbuffer3.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
项目:CustomWorldGen    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj));
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.thePlayer.getHeldItemOffhand() : this.gameController.thePlayer.getHeldItemMainhand();

        if (itemstack != null && itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
项目:Resilience-Client-Source    文件:EntityPlayerSP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, par1IMerchant, this.worldObj, par2Str));
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf var2 = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int var3 = var2.readInt();
            GuiScreen var4 = this.gameController.currentScreen;

            if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant var5 = ((GuiMerchant)var4).func_147035_g();
                MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(new PacketBuffer(var2));
                var5.setRecipes(var6);
            }
        }
        catch (IOException var7)
        {
            logger.error("Couldn\'t load trade info", var7);
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String var8 = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.gameSettings.serverTextures)
        {
            if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_147408_b())
            {
                this.gameController.getResourcePackRepository().func_148526_a(var8);
            }
            else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_147410_c())
            {
                this.gameController.displayGuiScreen(new GuiYesNo(new GuiScreen()
                {
                    private static final String __OBFID = "CL_00000879";
                    public void confirmClicked(boolean par1, int par2)
                    {
                        this.mc = Minecraft.getMinecraft();

                        if (this.mc.func_147104_D() != null)
                        {
                            this.mc.func_147104_D().setAcceptsTextures(par1);
                            ServerList.func_147414_b(this.mc.func_147104_D());
                        }

                        if (par1)
                        {
                            this.mc.getResourcePackRepository().func_148526_a(var8);
                        }

                        this.mc.displayGuiScreen((GuiScreen)null);
                    }
                }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
            }
        }
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerSP.java   
public void displayVillagerTradeGui(IMerchant villager)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj));
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.thePlayer.getHeldItemOffhand() : this.gameController.thePlayer.getHeldItemMainhand();

        if (itemstack != null && itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
项目:Cauldron    文件:EntityPlayerSP.java   
public void displayGUIMerchant(IMerchant p_71030_1_, String p_71030_2_)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, p_71030_1_, this.worldObj, p_71030_2_));
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf bytebuf = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int i = bytebuf.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).func_147035_g();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(bytebuf));
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t load trade info", ioexception);
        }
        finally
        {
            bytebuf.release();
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String s = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.ENABLED)
        {
            this.gameController.getResourcePackRepository().func_148526_a(s);
        }
        else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.PROMPT)
        {
            this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
            {
                private static final String __OBFID = "CL_00000879";
                public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
                {
                    NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();

                    if (NetHandlerPlayClient.this.gameController.func_147104_D() != null)
                    {
                        NetHandlerPlayClient.this.gameController.func_147104_D().func_152584_a(ServerData.ServerResourceMode.ENABLED);
                        ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.func_147104_D());
                    }

                    if (p_73878_1_)
                    {
                        NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_148526_a(s);
                    }

                    NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                }
            }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
        }
    }
}
项目:Cauldron    文件:EntityPlayerSP.java   
public void displayGUIMerchant(IMerchant p_71030_1_, String p_71030_2_)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, p_71030_1_, this.worldObj, p_71030_2_));
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf bytebuf = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int i = bytebuf.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).func_147035_g();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(bytebuf));
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t load trade info", ioexception);
        }
        finally
        {
            bytebuf.release();
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String s = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.ENABLED)
        {
            this.gameController.getResourcePackRepository().func_148526_a(s);
        }
        else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.PROMPT)
        {
            this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
            {
                private static final String __OBFID = "CL_00000879";
                public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
                {
                    NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();

                    if (NetHandlerPlayClient.this.gameController.func_147104_D() != null)
                    {
                        NetHandlerPlayClient.this.gameController.func_147104_D().func_152584_a(ServerData.ServerResourceMode.ENABLED);
                        ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.func_147104_D());
                    }

                    if (p_73878_1_)
                    {
                        NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_148526_a(s);
                    }

                    NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                }
            }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
        }
    }
}
项目:RuneCraftery    文件:EntityPlayerSP.java   
public void func_71030_a(IMerchant p_71030_1_, String p_71030_2_) {
   this.field_71159_c.func_71373_a(new GuiMerchant(this.field_71071_by, p_71030_1_, this.field_70170_p, p_71030_2_));
}
项目:RuneCraftery    文件:EntityPlayerSP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, par1IMerchant, this.worldObj, par2Str));
}
项目:BetterNutritionMod    文件:EntityPlayerSP.java   
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.mc.displayGuiScreen(new GuiMerchant(this.inventory, par1IMerchant, this.worldObj, par2Str));
}