public static TitleAction fromId(final int id) { for (final TitleAction ta : TitleAction.values()) { if (ta.getActionId() == id) { return ta; } } return null; }
@Override public void readPacket(final PacketDataSerializer data) throws IOException { this.action = TitleAction.fromId(data.readVarInt()); if (this.action == null) { return; } switch (this.action) { case SET_TITLE: case SET_SUBTITLE: this.text = data.readBaseComponent(); break; case SET_TIMES: this.fadeIn = data.readVarInt(); this.stay = data.readVarInt(); this.fadeOut = data.readVarInt(); break; case HIDE: case RESET: // No fields break; } }