Пример #1
0
  /** replaces selected text, or inserts text at the position on the cursor */
  public void writeText(String par1Str) {
    String var2 = "";
    String var3 = ChatAllowedCharacters.filerAllowedCharacters(par1Str);
    int var4 = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int var5 = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int var6 = this.maxStringLength - this.text.length() - (var4 - this.selectionEnd);
    boolean var7 = false;

    if (this.text.length() > 0) {
      var2 = var2 + this.text.substring(0, var4);
    }

    int var8;

    if (var6 < var3.length()) {
      var2 = var2 + var3.substring(0, var6);
      var8 = var6;
    } else {
      var2 = var2 + var3;
      var8 = var3.length();
    }

    if (this.text.length() > 0 && var5 < this.text.length()) {
      var2 = var2 + this.text.substring(var5);
    }

    this.text = var2;
    this.moveCursorBy(var4 - this.selectionEnd + var8);
  }
  public void func_146191_b(String p_146191_1_) {
    String var2 = "";
    String var3 = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
    int var4 =
        this.field_146224_r < this.field_146223_s ? this.field_146224_r : this.field_146223_s;
    int var5 =
        this.field_146224_r < this.field_146223_s ? this.field_146223_s : this.field_146224_r;
    int var6 = this.field_146217_k - this.field_146216_j.length() - (var4 - this.field_146223_s);
    boolean var7 = false;

    if (this.field_146216_j.length() > 0) {
      var2 = var2 + this.field_146216_j.substring(0, var4);
    }

    int var8;

    if (var6 < var3.length()) {
      var2 = var2 + var3.substring(0, var6);
      var8 = var6;
    } else {
      var2 = var2 + var3;
      var8 = var3.length();
    }

    if (this.field_146216_j.length() > 0 && var5 < this.field_146216_j.length()) {
      var2 = var2 + this.field_146216_j.substring(var5);
    }

    this.field_146216_j = var2;
    this.func_146182_d(var4 - this.field_146223_s + var8);
  }
Пример #3
0
  private void func_74162_c(char p_74162_1_, int p_74162_2_) {
    switch (p_74162_2_) {
      case 14:
        if (!this.field_74176_t.isEmpty()) {
          this.field_74176_t = this.field_74176_t.substring(0, this.field_74176_t.length() - 1);
          this.func_74161_g();
        }

        return;
      case 28:
      case 156:
        if (!this.field_74176_t.isEmpty()) {
          this.func_74163_a(true);
          this.field_73882_e.func_71373_a((GuiScreen) null);
        }

        return;
      default:
        if (this.field_74176_t.length() < 16 && ChatAllowedCharacters.func_71566_a(p_74162_1_)) {
          this.field_74176_t = this.field_74176_t + Character.toString(p_74162_1_);
          this.func_74161_g();
          this.field_74166_d = true;
        }
    }
  }
Пример #4
0
 @Override
 void handleKeyInput(char ch, int kid) {
   if (ChatAllowedCharacters.isAllowedCharacter(ch)) {
     pass = pass + ch;
   } else if (kid == Keyboard.KEY_RETURN) {
     State state = new StateNotify("s1_1");
     setState(state);
     Syncs.authorizeMatrix(
         matrix,
         pass,
         Future.create(
             (Object o) -> {
               if (state == FreqTransmitterUI.this.current) {
                 boolean result = (boolean) o;
                 if (result) {
                   setState(new StateDoMatrixLink(matrix, pass));
                 } else {
                   setState(new StateNotifyAndQuit("e1"));
                 }
               }
             }));
   } else if (kid == Keyboard.KEY_BACK) {
     if (pass.length() > 0) pass = pass.substring(0, pass.length() - 1);
   }
 }
Пример #5
0
  private void func_74164_b(char p_74164_1_, int p_74164_2_) {
    switch (p_74164_1_) {
      case 22:
        this.func_74160_b(GuiScreen.func_73870_l());
        return;
      default:
        switch (p_74164_2_) {
          case 14:
            String var3 = this.func_74158_i();
            if (var3.length() > 0) {
              this.func_74159_a(var3.substring(0, var3.length() - 1));
            }

            return;
          case 28:
          case 156:
            this.func_74160_b("\n");
            return;
          default:
            if (ChatAllowedCharacters.func_71566_a(p_74164_1_)) {
              this.func_74160_b(Character.toString(p_74164_1_));
            }
        }
    }
  }
Пример #6
0
  /** Processes keystrokes when editing the text of a book */
  private boolean keyTypedInBook(char par1, int par2) {
    switch (par1) {
      case 22: // Ctrl + V
        if (im.reset()) {
          current = current + im.getCommited();
          preedit = "";
          this.setText(current);
        }
        return true;
      default:
        switch (par2) {
          case Keyboard.KEY_BACK:
            if (im.delete()) {
              preedit = im.getPreedit();
              this.setText(current + preedit);
            } else {
              if (current.length() > 0) {
                current = current.substring(0, current.length() - 1);
                this.setText(current);
              }
            }

            break;
          case Keyboard.KEY_RETURN:
          case Keyboard.KEY_NUMPADENTER:
            if (im.reset()) {
              current = current + im.getCommited();
              preedit = "";
            }
            if (current.length() < 256) {
              current = current + "\n";
            }
            this.setText(current);
            break;
          default:
            if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
              if (im.input(par1, isShiftKeyDown())) {
                current = current + im.getCommited();
              }
              int i =
                  this.fontRendererObj.splitStringWidth(
                      current + "" + EnumChatFormatting.BLACK + "_", 118);

              if (i <= 118 && current.length() < 256) {
                preedit = im.getPreedit();
              } else {
                if (im.reset()) {
                  im.getCommited();
                }
                preedit = "";
              }
              this.setText(current + preedit);
            }
        }
    }

    return false;
  }
Пример #7
0
  private boolean keyTypedInTitle(char par1, int par2) {
    switch (par2) {
      case Keyboard.KEY_BACK:
        if (im.delete()) {
          preedit = im.getPreedit();
          setBookTitle(current + preedit);
        } else {
          return true;
        }

        break;
      case Keyboard.KEY_RETURN:
      case Keyboard.KEY_NUMPADENTER:
        if (im.reset()) {
          current = current + im.getCommited();
          preedit = "";
          this.setBookTitle(current);
        }
        return true;
      default:
        if (current.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(par1)) {
          if (im.input(par1, isShiftKeyDown())) {
            current = current + im.getCommited();
          }

          if (current.length() < 16) {
            preedit = im.getPreedit();
          } else {
            if (im.reset()) {
              im.getCommited();
            }
            preedit = "";
          }

          this.setBookTitle(current + preedit);
          return true;
        }
    }

    return false;
  }
Пример #8
0
  public boolean keyTyped(char character, int key) {
    if (getTextField() != null) {
      if (key == 203) {
        cursorLeft(1);
      } else if (key == 205) {
        cursorRight(1);
      } else if (character == 22) {
        add(GuiScreen.getClipboardString());
      } else if (key == 14) {
        delete(-1);
      } else if (key == 211) {
        delete(0);
      } else if (key == 28 || key == 156) {
        add("\n");
      } else if (ChatAllowedCharacters.isAllowedCharacter(character)) {
        add(Character.toString(character));
      }
    }

    return false;
  }
Пример #9
0
  /** Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */
  protected void keyTyped(char p_73869_1_, int p_73869_2_) {
    if (p_73869_2_ == 200) {
      this.editLine = this.editLine - 1 & 3;
    }

    if (p_73869_2_ == 208 || p_73869_2_ == 28 || p_73869_2_ == 156) {
      this.editLine = this.editLine + 1 & 3;
    }

    if (p_73869_2_ == 14 && this.tileSign.signText[this.editLine].length() > 0) {
      this.tileSign.signText[this.editLine] =
          this.tileSign.signText[this.editLine].substring(
              0, this.tileSign.signText[this.editLine].length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(p_73869_1_)
        && this.tileSign.signText[this.editLine].length() < 15) {
      this.tileSign.signText[this.editLine] = this.tileSign.signText[this.editLine] + p_73869_1_;
    }

    if (p_73869_2_ == 1) {
      this.actionPerformed(this.doneBtn);
    }
  }
Пример #10
0
  /** Call this method from you GuiScreen to process the keys into textbox. */
  public boolean textboxKeyTyped(char par1, int par2) {
    if (this.isEnabled && this.isFocused) {
      switch (par1) {
        case 1:
          this.setCursorPositionEnd();
          this.setSelectionPos(0);
          return true;
        case 3:
          GuiScreen.setClipboardString(this.getSelectedtext());
          return true;
        case 22:
          this.writeText(GuiScreen.getClipboardString());
          return true;
        case 24:
          GuiScreen.setClipboardString(this.getSelectedtext());
          this.writeText("");
          return true;
        default:
          switch (par2) {
            case 14:
              if (GuiScreen.isCtrlKeyDown()) {
                this.deleteWords(-1);
              } else {
                this.deleteFromCursor(-1);
              }

              return true;
            case 199:
              if (GuiScreen.isShiftKeyDown()) {
                this.setSelectionPos(0);
              } else {
                this.setCursorPositionZero();
              }

              return true;
            case 203:
              if (GuiScreen.isShiftKeyDown()) {
                if (GuiScreen.isCtrlKeyDown()) {
                  this.setSelectionPos(this.getNthWordFromPos(-1, this.getSelectionEnd()));
                } else {
                  this.setSelectionPos(this.getSelectionEnd() - 1);
                }
              } else if (GuiScreen.isCtrlKeyDown()) {
                this.setCursorPosition(this.getNthWordFromCursor(-1));
              } else {
                this.moveCursorBy(-1);
              }

              return true;
            case 205:
              if (GuiScreen.isShiftKeyDown()) {
                if (GuiScreen.isCtrlKeyDown()) {
                  this.setSelectionPos(this.getNthWordFromPos(1, this.getSelectionEnd()));
                } else {
                  this.setSelectionPos(this.getSelectionEnd() + 1);
                }
              } else if (GuiScreen.isCtrlKeyDown()) {
                this.setCursorPosition(this.getNthWordFromCursor(1));
              } else {
                this.moveCursorBy(1);
              }

              return true;
            case 207:
              if (GuiScreen.isShiftKeyDown()) {
                this.setSelectionPos(this.text.length());
              } else {
                this.setCursorPositionEnd();
              }

              return true;
            case 211:
              if (GuiScreen.isCtrlKeyDown()) {
                this.deleteWords(1);
              } else {
                this.deleteFromCursor(1);
              }

              return true;
            default:
              if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
                this.writeText(Character.toString(par1));
                return true;
              } else {
                return false;
              }
          }
      }
    } else {
      return false;
    }
  }
  /** Call this method from your GuiScreen to process the keys into the textbox */
  public boolean textboxKeyTyped(char p_146201_1_, int p_146201_2_) {
    if (!this.field_146213_o) {
      return false;
    } else {
      switch (p_146201_1_) {
        case 1:
          this.func_146202_e();
          this.func_146199_i(0);
          return true;

        case 3:
          GuiScreen.setClipboardString(this.func_146207_c());
          return true;

        case 22:
          if (this.field_146226_p) {
            this.func_146191_b(GuiScreen.getClipboardString());
          }

          return true;

        case 24:
          GuiScreen.setClipboardString(this.func_146207_c());

          if (this.field_146226_p) {
            this.func_146191_b("");
          }

          return true;

        default:
          switch (p_146201_2_) {
            case 14:
              if (GuiScreen.isCtrlKeyDown()) {
                if (this.field_146226_p) {
                  this.func_146177_a(-1);
                }
              } else if (this.field_146226_p) {
                this.func_146175_b(-1);
              }

              return true;

            case 199:
              if (GuiScreen.isShiftKeyDown()) {
                this.func_146199_i(0);
              } else {
                this.func_146196_d();
              }

              return true;

            case 203:
              if (GuiScreen.isShiftKeyDown()) {
                if (GuiScreen.isCtrlKeyDown()) {
                  this.func_146199_i(this.func_146183_a(-1, this.func_146186_n()));
                } else {
                  this.func_146199_i(this.func_146186_n() - 1);
                }
              } else if (GuiScreen.isCtrlKeyDown()) {
                this.func_146190_e(this.func_146187_c(-1));
              } else {
                this.func_146182_d(-1);
              }

              return true;

            case 205:
              if (GuiScreen.isShiftKeyDown()) {
                if (GuiScreen.isCtrlKeyDown()) {
                  this.func_146199_i(this.func_146183_a(1, this.func_146186_n()));
                } else {
                  this.func_146199_i(this.func_146186_n() + 1);
                }
              } else if (GuiScreen.isCtrlKeyDown()) {
                this.func_146190_e(this.func_146187_c(1));
              } else {
                this.func_146182_d(1);
              }

              return true;

            case 207:
              if (GuiScreen.isShiftKeyDown()) {
                this.func_146199_i(this.field_146216_j.length());
              } else {
                this.func_146202_e();
              }

              return true;

            case 211:
              if (GuiScreen.isCtrlKeyDown()) {
                if (this.field_146226_p) {
                  this.func_146177_a(1);
                }
              } else if (this.field_146226_p) {
                this.func_146175_b(1);
              }

              return true;

            default:
              if (ChatAllowedCharacters.isAllowedCharacter(p_146201_1_)) {
                if (this.field_146226_p) {
                  this.func_146191_b(Character.toString(p_146201_1_));
                }

                return true;
              } else {
                return false;
              }
          }
      }
    }
  }
  // patch method
  @Overwrite
  public void processVanilla250Packet(C17PacketCustomPayload p_147349_1_) {
    PacketBuffer packetbuffer;
    ItemStack itemstack;
    ItemStack itemstack1;

    if ("MC|BEdit".equals(p_147349_1_.func_149559_c())) {
      packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));

      try {
        itemstack = packetbuffer.readItemStackFromBuffer();

        if (itemstack == null) {
          return;
        }

        if (!ItemWritableBook.func_150930_a(itemstack.getTagCompound())) {
          throw new IOException("Invalid book tag!");
        }

        itemstack1 = playerEntity.inventory.getCurrentItem();

        if (itemstack1 != null) {
          if (itemstack.getItem() == Items.writable_book
              && itemstack.getItem() == itemstack1.getItem()) {
            itemstack1.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8));
          }

          return;
        }
      } catch (Exception exception4) {
        logger.error("Couldn\'t handle book info", exception4);
        return;
      } finally {
        packetbuffer.release();
      }

      return;
    } else if ("MC|BSign".equals(p_147349_1_.func_149559_c())) {
      packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));

      try {
        itemstack = packetbuffer.readItemStackFromBuffer();

        if (itemstack != null) {
          if (!ItemEditableBook.validBookTagContents(itemstack.getTagCompound())) {
            throw new IOException("Invalid book tag!");
          }

          itemstack1 = playerEntity.inventory.getCurrentItem();

          if (itemstack1 == null) {
            return;
          }

          if (itemstack.getItem() == Items.written_book
              && itemstack1.getItem() == Items.writable_book) {
            itemstack1.setTagInfo("author", new NBTTagString(playerEntity.getCommandSenderName()));
            itemstack1.setTagInfo(
                "title", new NBTTagString(itemstack.getTagCompound().getString("title")));
            itemstack1.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8));
            itemstack1.func_150996_a(Items.written_book);
          }

          return;
        }
      } catch (Exception exception3) {
        logger.error("Couldn\'t sign book", exception3);
        return;
      } finally {
        packetbuffer.release();
      }

      return;
    } else {
      DataInputStream datainputstream;
      int i;

      if ("MC|TrSel".equals(p_147349_1_.func_149559_c())) {
        try {
          datainputstream =
              new DataInputStream(new ByteArrayInputStream(p_147349_1_.func_149558_e()));
          i = datainputstream.readInt();
          Container container = playerEntity.openContainer;

          if (container instanceof ContainerMerchant) {
            ((ContainerMerchant) container).setCurrentRecipeIndex(i);
          }
        } catch (Exception exception2) {
          logger.error("Couldn\'t select trade", exception2);
        }
      } else if ("MC|AdvCdm".equals(p_147349_1_.func_149559_c())) {
        if (!serverController.isCommandBlockEnabled()) {
          playerEntity.addChatMessage(
              new ChatComponentTranslation("advMode.notEnabled", new Object[0]));
        } else if (PermissionManager.checkPermission(playerEntity, "mc.cmdblocks")
            && playerEntity.capabilities.isCreativeMode) {
          packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));

          try {
            byte b0 = packetbuffer.readByte();
            CommandBlockLogic commandblocklogic = null;

            if (b0 == 0) {
              TileEntity tileentity =
                  playerEntity.worldObj.getTileEntity(
                      packetbuffer.readInt(), packetbuffer.readInt(), packetbuffer.readInt());

              if (tileentity instanceof TileEntityCommandBlock) {
                commandblocklogic = ((TileEntityCommandBlock) tileentity).func_145993_a();
              }
            } else if (b0 == 1) {
              Entity entity = playerEntity.worldObj.getEntityByID(packetbuffer.readInt());

              if (entity instanceof EntityMinecartCommandBlock) {
                commandblocklogic = ((EntityMinecartCommandBlock) entity).func_145822_e();
              }
            }

            String s1 = packetbuffer.readStringFromBuffer(packetbuffer.readableBytes());

            if (commandblocklogic != null) {
              commandblocklogic.func_145752_a(s1);
              commandblocklogic.func_145756_e();
              playerEntity.addChatMessage(
                  new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1}));
            }
          } catch (Exception exception1) {
            logger.error("Couldn\'t set command block", exception1);
          } finally {
            packetbuffer.release();
          }
        } else {
          playerEntity.addChatMessage(
              new ChatComponentTranslation("advMode.notAllowed", new Object[0]));
        }
      } else if ("MC|Beacon".equals(p_147349_1_.func_149559_c())) {
        if (playerEntity.openContainer instanceof ContainerBeacon) {
          try {
            datainputstream =
                new DataInputStream(new ByteArrayInputStream(p_147349_1_.func_149558_e()));
            i = datainputstream.readInt();
            int j = datainputstream.readInt();
            ContainerBeacon containerbeacon = (ContainerBeacon) playerEntity.openContainer;
            Slot slot = containerbeacon.getSlot(0);

            if (slot.getHasStack()) {
              slot.decrStackSize(1);
              TileEntityBeacon tileentitybeacon = containerbeacon.func_148327_e();
              tileentitybeacon.setPrimaryEffect(i);
              tileentitybeacon.setSecondaryEffect(j);
              tileentitybeacon.markDirty();
            }
          } catch (Exception exception) {
            logger.error("Couldn\'t set beacon", exception);
          }
        }
      } else if ("MC|ItemName".equals(p_147349_1_.func_149559_c())
          && playerEntity.openContainer instanceof ContainerRepair) {
        ContainerRepair containerrepair = (ContainerRepair) playerEntity.openContainer;

        if (p_147349_1_.func_149558_e() != null && p_147349_1_.func_149558_e().length >= 1) {
          String s =
              ChatAllowedCharacters.filerAllowedCharacters(
                  new String(p_147349_1_.func_149558_e(), Charsets.UTF_8));

          if (s.length() <= 30) {
            containerrepair.updateItemName(s);
          }
        } else {
          containerrepair.updateItemName("");
        }
      }
    }
  }
 public boolean isAllowedCharacter(char charTyped) {
   return ChatAllowedCharacters.isAllowedCharacter(charTyped);
 }
  /** Process the contents of this packet */
  public void handle(NetHandlerPlayServer handler) {
    PacketThreadUtil.processPacket(this, handler, handler.playerEntity.getWorldForPlayer());
    PacketBuffer var2;
    ItemStack var3;
    ItemStack var4;

    if ("MC|BEdit".equals(this.channel)) {
      var2 = new PacketBuffer(Unpooled.wrappedBuffer(this.data));

      try {
        var3 = var2.readItemStackFromBuffer();

        if (var3 == null) return;

        if (!ItemWritableBook.validBookPageTagContents(var3.getTagCompound())) {
          throw new IOException("Invalid book tag!");
        }

        var4 = handler.playerEntity.inventory.getCurrentItem();

        if (var4 != null) {
          if (var3.getItem() == Items.writable_book && var3.getItem() == var4.getItem()) {
            var4.setTagInfo("pages", var3.getTagCompound().getTagList("pages", 8));
          }
        }
      } catch (Exception ignored) {
      } finally {
        var2.release();
      }

    } else if ("MC|BSign".equals(this.channel)) {
      var2 = new PacketBuffer(Unpooled.wrappedBuffer(this.data));

      try {
        var3 = var2.readItemStackFromBuffer();

        if (var3 == null) {
          return;
        }

        if (!ItemEditableBook.validBookTagContents(var3.getTagCompound())) {
          throw new IOException("Invalid book tag!");
        }

        var4 = handler.playerEntity.inventory.getCurrentItem();

        if (var4 != null) {
          if (var3.getItem() == Items.written_book && var4.getItem() == Items.writable_book) {
            var4.setTagInfo("author", new NBTTagString(handler.playerEntity.getName()));
            var4.setTagInfo("title", new NBTTagString(var3.getTagCompound().getString("title")));
            var4.setTagInfo("pages", var3.getTagCompound().getTagList("pages", 8));
            var4.setItem(Items.written_book);
          }
        }
      } catch (Exception ignored) {
      } finally {
        var2.release();
      }
    } else if ("MC|TrSel".equals(this.channel)) {
      try {
        int var40 = this.data.readInt();
        Container container = handler.playerEntity.openContainer;

        if (container instanceof ContainerMerchant) {
          ((ContainerMerchant) container).setCurrentRecipeIndex(var40);
        }
      } catch (Exception ignored) {
      }
    } else if ("MC|AdvCdm".equals(this.channel)) {
      if (!handler.serverController.isCommandBlockEnabled()) {
        handler.playerEntity.addChatMessage(new FormattedTextTranslation("advMode.notEnabled"));
      } else if (handler.playerEntity.canCommandSenderUseCommand(2, "")
          && handler.playerEntity.capabilities.isCreativeMode) {
        var2 = this.data;

        try {
          byte var43 = var2.readByte();
          CommandBlockLogic var46 = null;

          if (var43 == 0) {
            var46 =
                $.bind(
                    handler.playerEntity.world.getTileEntity(
                        new BlockPos(var2.readInt(), var2.readInt(), var2.readInt()),
                        TileEntityCommandBlock.class),
                    TileEntityCommandBlock::getCommandBlockLogic);
          } else if (var43 == 1) {
            var46 =
                $.bind(
                    handler.playerEntity.world.getEntityByID(
                        var2.readInt(), EntityMinecartCommandBlock.class),
                    EntityMinecartCommandBlock::getCommandBlockLogic);
          }

          String var49 = var2.readString(var2.readableBytes());
          boolean var6 = var2.readBoolean();

          if (var46 != null) {
            var46.setCommand(var49);
            var46.setCommandFeedback(var6);

            if (!var6) {
              var46.func_145750_b(null);
            }

            var46.markForUpdate();
            handler.playerEntity.addChatMessage(
                new FormattedTextTranslation("advMode.setCommand.success", var49));
          }
        } catch (Exception ignored) {
        } finally {
          var2.release();
        }
      } else {
        handler.playerEntity.addChatMessage(new FormattedTextTranslation("advMode.notAllowed"));
      }
    } else if ("MC|Beacon".equals(this.channel)) {
      if (handler.playerEntity.openContainer instanceof ContainerBeacon) {
        try {
          var2 = this.data;
          int var44 = var2.readInt();
          int var47 = var2.readInt();
          ContainerBeacon var50 = (ContainerBeacon) handler.playerEntity.openContainer;
          Slot var51 = var50.getSlot(0);

          if (var51.hasStack()) {
            var51.decreaseStackSize(1);
            IInventory var7 = var50.getTileEntity();
            var7.setField(1, var44);
            var7.setField(2, var47);
            var7.markDirty();
          }
        } catch (Exception ignored) {
        }
      }
    } else if ("MC|ItemName".equals(this.channel)
        && handler.playerEntity.openContainer instanceof ContainerAnvil) {
      ContainerAnvil container = (ContainerAnvil) handler.playerEntity.openContainer;

      if (this.data != null && this.data.readableBytes() >= 1) {
        String data = ChatAllowedCharacters.filterAllowedCharacters(this.data.readString(32767));

        if (data.length() <= 30) {
          container.updateItemName(data);
        }
      } else {
        container.updateItemName("");
      }
    }
  }