Example #1
0
 /** Displays the GUI for interacting with a beacon. */
 public void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon) {
   this.incrementWindowID();
   this.playerNetServerHandler.sendPacketToPlayer(
       new Packet100OpenWindow(
           this.currentWindowId,
           7,
           par1TileEntityBeacon.getInvName(),
           par1TileEntityBeacon.getSizeInventory(),
           par1TileEntityBeacon.isInvNameLocalized()));
   this.openContainer = new ContainerBeacon(this.inventory, par1TileEntityBeacon);
   this.openContainer.windowId = this.currentWindowId;
   this.openContainer.addCraftingToCrafters(this);
 }
  public void func_72501_a(Packet250CustomPayload p_72501_1_) {
    DataInputStream var2;
    ItemStack var3;
    ItemStack var4;
    if ("MC|BEdit".equals(p_72501_1_.field_73630_a)) {
      try {
        var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));
        var3 = Packet.func_73276_c(var2);
        if (!ItemWritableBook.func_77829_a(var3.func_77978_p())) {
          throw new IOException("Invalid book tag!");
        }

        var4 = this.field_72574_e.field_71071_by.func_70448_g();
        if (var3 != null
            && var3.field_77993_c == Item.field_77821_bF.field_77779_bT
            && var3.field_77993_c == var4.field_77993_c) {
          var4.func_77983_a("pages", var3.func_77978_p().func_74761_m("pages"));
        }
      } catch (Exception var14) {
        var14.printStackTrace();
      }
    } else if ("MC|BSign".equals(p_72501_1_.field_73630_a)) {
      try {
        var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));
        var3 = Packet.func_73276_c(var2);
        if (!ItemEditableBook.func_77828_a(var3.func_77978_p())) {
          throw new IOException("Invalid book tag!");
        }

        var4 = this.field_72574_e.field_71071_by.func_70448_g();
        if (var3 != null
            && var3.field_77993_c == Item.field_77823_bG.field_77779_bT
            && var4.field_77993_c == Item.field_77821_bF.field_77779_bT) {
          var4.func_77983_a(
              "author", new NBTTagString("author", this.field_72574_e.field_71092_bJ));
          var4.func_77983_a(
              "title", new NBTTagString("title", var3.func_77978_p().func_74779_i("title")));
          var4.func_77983_a("pages", var3.func_77978_p().func_74761_m("pages"));
          var4.field_77993_c = Item.field_77823_bG.field_77779_bT;
        }
      } catch (Exception var13) {
        var13.printStackTrace();
      }
    } else {
      int var5;
      if ("MC|TrSel".equals(p_72501_1_.field_73630_a)) {
        try {
          var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));
          var5 = var2.readInt();
          Container var6 = this.field_72574_e.field_71070_bA;
          if (var6 instanceof ContainerMerchant) {
            ((ContainerMerchant) var6).func_75175_c(var5);
          }
        } catch (Exception var12) {
          var12.printStackTrace();
        }
      } else {
        String var8;
        int var15;
        if ("MC|AdvCdm".equals(p_72501_1_.field_73630_a)) {
          if (!this.field_72573_d.func_82356_Z()) {
            this.field_72574_e.func_70006_a(
                this.field_72574_e.func_70004_a("advMode.notEnabled", new Object[0]));
          } else if (this.field_72574_e.func_70003_b(2, "")
              && this.field_72574_e.field_71075_bZ.field_75098_d) {
            try {
              var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));
              var5 = var2.readInt();
              var15 = var2.readInt();
              int var7 = var2.readInt();
              var8 = Packet.func_73282_a(var2, 256);
              TileEntity var9 = this.field_72574_e.field_70170_p.func_72796_p(var5, var15, var7);
              if (var9 != null && var9 instanceof TileEntityCommandBlock) {
                ((TileEntityCommandBlock) var9).func_82352_b(var8);
                this.field_72574_e.field_70170_p.func_72845_h(var5, var15, var7);
                this.field_72574_e.func_70006_a("Command set: " + var8);
              }
            } catch (Exception var11) {
              var11.printStackTrace();
            }
          } else {
            this.field_72574_e.func_70006_a(
                this.field_72574_e.func_70004_a("advMode.notAllowed", new Object[0]));
          }
        } else if ("MC|Beacon".equals(p_72501_1_.field_73630_a)) {
          if (this.field_72574_e.field_71070_bA instanceof ContainerBeacon) {
            try {
              var2 = new DataInputStream(new ByteArrayInputStream(p_72501_1_.field_73629_c));
              var5 = var2.readInt();
              var15 = var2.readInt();
              ContainerBeacon var16 = (ContainerBeacon) this.field_72574_e.field_71070_bA;
              Slot var18 = var16.func_75139_a(0);
              if (var18.func_75216_d()) {
                var18.func_75209_a(1);
                TileEntityBeacon var19 = var16.func_82863_d();
                var19.func_82128_d(var5);
                var19.func_82127_e(var15);
                var19.func_70296_d();
              }
            } catch (Exception var10) {
              var10.printStackTrace();
            }
          }
        } else if ("MC|ItemName".equals(p_72501_1_.field_73630_a)
            && this.field_72574_e.field_71070_bA instanceof ContainerRepair) {
          ContainerRepair var17 = (ContainerRepair) this.field_72574_e.field_71070_bA;
          if (p_72501_1_.field_73629_c != null && p_72501_1_.field_73629_c.length >= 1) {
            var8 = ChatAllowedCharacters.func_71565_a(new String(p_72501_1_.field_73629_c));
            if (var8.length() <= 30) {
              var17.func_82850_a(var8);
            }
          } else {
            var17.func_82850_a("");
          }
        } else {
          ModLoader.serverCustomPayload(this, p_72501_1_);
        }
      }
    }
  }