@Override
 public void fromBytes(ByteBuf buf) {
   super.fromBytes(buf);
   byte command = buf.readByte();
   if (command == 0) {
     mat = Mats.values()[buf.readByte()];
   } else if (command == 1) {
     enchant = buf.readShort();
   } else if (command == 2) {
   } else {
     throw new InvalidParameterException();
   }
 }
 @Override
 public void toBytes(ByteBuf buf) {
   super.toBytes(buf);
   if (mat != null) {
     buf.writeByte(0);
     buf.writeByte(mat.ordinal());
   } else if (enchant >= 0) {
     buf.writeByte(1);
     buf.writeShort(enchant);
   } else {
     buf.writeByte(2);
   }
 }